#ifdef _MSC_VER
#pragma once
#endif // _MSC_VER
#ifndef _APISETCONSOLE_
#define _APISETCONSOLE_
#include <apiset.h>
#include <apisetcconv.h>
#include <minwindef.h>
#include <minwinbase.h>
#include <wincontypes.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#pragma region Application Family or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
(
);
(
);
#if (_WIN32_WINNT >= 0x0500)
(
);
#define ATTACH_PARENT_PROCESS ((DWORD)-1)
#endif /* _WIN32_WINNT >= 0x0500 */
(
);
(
);
#define ENABLE_PROCESSED_INPUT 0x0001
#define ENABLE_LINE_INPUT 0x0002
#define ENABLE_ECHO_INPUT 0x0004
#define ENABLE_WINDOW_INPUT 0x0008
#define ENABLE_MOUSE_INPUT 0x0010
#define ENABLE_INSERT_MODE 0x0020
#define ENABLE_QUICK_EDIT_MODE 0x0040
#define ENABLE_EXTENDED_FLAGS 0x0080
#define ENABLE_AUTO_POSITION 0x0100
#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200
#define ENABLE_PROCESSED_OUTPUT 0x0001
#define ENABLE_WRAP_AT_EOL_OUTPUT 0x0002
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#define DISABLE_NEWLINE_AUTO_RETURN 0x0008
#define ENABLE_LVB_GRID_WORLDWIDE 0x0010
(
_In_ HANDLE hConsoleHandle,
);
(
_In_ HANDLE hConsoleHandle,
);
(
_In_ HANDLE hConsoleInput,
_Out_ LPDWORD lpNumberOfEvents
);
_Success_(return != FALSE)
(
_In_ HANDLE hConsoleInput,
_Out_writes_to_(nLength,*lpNumberOfEventsRead) PINPUT_RECORD lpBuffer,
_Out_ _Deref_out_range_(<=,nLength) LPDWORD lpNumberOfEventsRead
);
_Success_(return != FALSE)
(
_In_ HANDLE hConsoleInput,
_Out_writes_to_(nLength,*lpNumberOfEventsRead) PINPUT_RECORD lpBuffer,
_Out_ _Deref_out_range_(<=,nLength) LPDWORD lpNumberOfEventsRead
);
#ifdef UNICODE
#define ReadConsoleInput ReadConsoleInputW
#else
#define ReadConsoleInput ReadConsoleInputA
#endif // !UNICODE
#ifndef UNICODE
#define PeekConsoleInput PeekConsoleInputA
#endif
(
_In_ HANDLE hConsoleInput,
_Out_writes_(nLength) PINPUT_RECORD lpBuffer,
_Out_ LPDWORD lpNumberOfEventsRead
);
(
_In_ HANDLE hConsoleInput,
_Out_writes_(nLength) PINPUT_RECORD lpBuffer,
_Out_ LPDWORD lpNumberOfEventsRead
);
#ifdef UNICODE
#define PeekConsoleInput PeekConsoleInputW
#else
#define PeekConsoleInput PeekConsoleInputA
#endif // !UNICODE
typedef
struct
_CONSOLE_READCONSOLE_CONTROL
{
;
;
;
;
}
CONSOLE_READCONSOLE_CONTROL
, *
PCONSOLE_READCONSOLE_CONTROL
;
_Success_(return != FALSE)
(
_In_ HANDLE hConsoleInput,
_Out_writes_bytes_to_(nNumberOfCharsToRead * sizeof(TCHAR%),*lpNumberOfCharsRead * sizeof(TCHAR%)) LPVOID lpBuffer,
_In_ DWORD nNumberOfCharsToRead,
_Out_ _Deref_out_range_(<=,nNumberOfCharsToRead) LPDWORD lpNumberOfCharsRead,
_In_opt_ PCONSOLE_READCONSOLE_CONTROL pInputControl
PCONSOLE_READCONSOLE_CONTROL
);
_Success_(return != FALSE)
(
_In_ HANDLE hConsoleInput,
_Out_writes_bytes_to_(nNumberOfCharsToRead * sizeof(TCHAR%),*lpNumberOfCharsRead * sizeof(TCHAR%)) LPVOID lpBuffer,
_In_ DWORD nNumberOfCharsToRead,
_Out_ _Deref_out_range_(<=,nNumberOfCharsToRead) LPDWORD lpNumberOfCharsRead,
_In_opt_ PCONSOLE_READCONSOLE_CONTROL pInputControl
PCONSOLE_READCONSOLE_CONTROL
);
#ifdef UNICODE
#define ReadConsole ReadConsoleW
#else
#define ReadConsole ReadConsoleA
#endif // !UNICODE
(
_In_ HANDLE hConsoleOutput,
_In_reads_(nNumberOfCharsToWrite) CONST VOID* lpBuffer,
_In_ DWORD nNumberOfCharsToWrite,
_Out_opt_ LPDWORD lpNumberOfCharsWritten,
_Reserved_ LPVOID lpReserved
);
(
_In_ HANDLE hConsoleOutput,
_In_reads_(nNumberOfCharsToWrite) CONST VOID* lpBuffer,
_In_ DWORD nNumberOfCharsToWrite,
_Out_opt_ LPDWORD lpNumberOfCharsWritten,
_Reserved_ LPVOID lpReserved
);
#ifdef UNICODE
#define WriteConsole WriteConsoleW
#else
#define WriteConsole WriteConsoleA
#endif // !UNICODE
#define CTRL_C_EVENT 0
#define CTRL_BREAK_EVENT 1
#define CTRL_CLOSE_EVENT 2
#define CTRL_LOGOFF_EVENT 5
#define CTRL_SHUTDOWN_EVENT 6
typedef
(WINAPI *PHANDLER_ROUTINE)(
);
(
_In_opt_ PHANDLER_ROUTINE HandlerRoutine,
);
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
#pragma endregion
#pragma region Desktop Family or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
#if (NTDDI_VERSION >= NTDDI_WIN10_RS5)
#define PSEUDOCONSOLE_INHERIT_CURSOR (0x1)
(
);
(
);
(
);
#endif
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
#pragma endregion
#ifdef __cplusplus
}
#endif
#endif // _APISETCONSOLE_