Last active
July 11, 2018 12:50
-
-
Save fcharlie/7fe15617e444e1f854e7a086396eae00 to your computer and use it in GitHub Desktop.
console API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// begin_consoleapi_h | |
/******************************************************************************** | |
* * | |
* consoleapi.h -- ApiSet Contract for api-ms-win-core-console-l1 * | |
* * | |
* Copyright (c) Microsoft Corporation. All rights reserved. * | |
* * | |
********************************************************************************/ | |
#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) | |
WINBASEAPI | |
BOOL | |
WINAPI | |
AllocConsole( | |
VOID | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
FreeConsole( | |
VOID | |
); | |
#if (_WIN32_WINNT >= 0x0500) | |
WINBASEAPI | |
BOOL | |
WINAPI | |
AttachConsole( | |
_In_ DWORD dwProcessId | |
); | |
#define ATTACH_PARENT_PROCESS ((DWORD)-1) | |
#endif /* _WIN32_WINNT >= 0x0500 */ | |
WINBASEAPI | |
UINT | |
WINAPI | |
GetConsoleCP( | |
VOID | |
); | |
WINBASEAPI | |
UINT | |
WINAPI | |
GetConsoleOutputCP( | |
VOID | |
); | |
// | |
// Input Mode flags: | |
// | |
#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 | |
// | |
// Output Mode flags: | |
// | |
#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 | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetConsoleMode( | |
_In_ HANDLE hConsoleHandle, | |
_Out_ LPDWORD lpMode | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleMode( | |
_In_ HANDLE hConsoleHandle, | |
_In_ DWORD dwMode | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetNumberOfConsoleInputEvents( | |
_In_ HANDLE hConsoleInput, | |
_Out_ LPDWORD lpNumberOfEvents | |
); | |
WINBASEAPI | |
_Success_(return != FALSE) | |
BOOL | |
WINAPI | |
ReadConsoleInputA( | |
_In_ HANDLE hConsoleInput, | |
_Out_writes_to_(nLength,*lpNumberOfEventsRead) PINPUT_RECORD lpBuffer, | |
_In_ DWORD nLength, | |
_Out_ _Deref_out_range_(<=,nLength) LPDWORD lpNumberOfEventsRead | |
); | |
WINBASEAPI | |
_Success_(return != FALSE) | |
BOOL | |
WINAPI | |
ReadConsoleInputW( | |
_In_ HANDLE hConsoleInput, | |
_Out_writes_to_(nLength,*lpNumberOfEventsRead) PINPUT_RECORD lpBuffer, | |
_In_ DWORD nLength, | |
_Out_ _Deref_out_range_(<=,nLength) LPDWORD lpNumberOfEventsRead | |
); | |
#ifdef UNICODE | |
#define ReadConsoleInput ReadConsoleInputW | |
#else | |
#define ReadConsoleInput ReadConsoleInputA | |
#endif // !UNICODE | |
// end_consoleapi_h | |
#ifndef UNICODE | |
#define PeekConsoleInput PeekConsoleInputA | |
#endif | |
// begin_consoleapi_h | |
WINBASEAPI | |
BOOL | |
WINAPI | |
PeekConsoleInputA( | |
_In_ HANDLE hConsoleInput, | |
_Out_writes_(nLength) PINPUT_RECORD lpBuffer, | |
_In_ DWORD nLength, | |
_Out_ LPDWORD lpNumberOfEventsRead | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
PeekConsoleInputW( | |
_In_ HANDLE hConsoleInput, | |
_Out_writes_(nLength) PINPUT_RECORD lpBuffer, | |
_In_ DWORD nLength, | |
_Out_ LPDWORD lpNumberOfEventsRead | |
); | |
#ifdef UNICODE | |
#define PeekConsoleInput PeekConsoleInputW | |
#else | |
#define PeekConsoleInput PeekConsoleInputA | |
#endif // !UNICODE | |
typedef struct _CONSOLE_READCONSOLE_CONTROL { | |
ULONG nLength; | |
ULONG nInitialChars; | |
ULONG dwCtrlWakeupMask; | |
ULONG dwControlKeyState; | |
} CONSOLE_READCONSOLE_CONTROL, *PCONSOLE_READCONSOLE_CONTROL; | |
WINBASEAPI | |
_Success_(return != FALSE) | |
BOOL | |
WINAPI | |
ReadConsoleA( | |
_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 | |
); | |
WINBASEAPI | |
_Success_(return != FALSE) | |
BOOL | |
WINAPI | |
ReadConsoleW( | |
_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 | |
); | |
#ifdef UNICODE | |
#define ReadConsole ReadConsoleW | |
#else | |
#define ReadConsole ReadConsoleA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleA( | |
_In_ HANDLE hConsoleOutput, | |
_In_reads_(nNumberOfCharsToWrite) CONST VOID* lpBuffer, | |
_In_ DWORD nNumberOfCharsToWrite, | |
_Out_opt_ LPDWORD lpNumberOfCharsWritten, | |
_Reserved_ LPVOID lpReserved | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleW( | |
_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 | |
// | |
// Ctrl Event flags | |
// | |
#define CTRL_C_EVENT 0 | |
#define CTRL_BREAK_EVENT 1 | |
#define CTRL_CLOSE_EVENT 2 | |
// 3 is reserved! | |
// 4 is reserved! | |
#define CTRL_LOGOFF_EVENT 5 | |
#define CTRL_SHUTDOWN_EVENT 6 | |
// | |
// typedef for ctrl-c handler routines | |
// | |
typedef | |
BOOL | |
(WINAPI *PHANDLER_ROUTINE)( | |
_In_ DWORD CtrlType | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleCtrlHandler( | |
_In_opt_ PHANDLER_ROUTINE HandlerRoutine, | |
_In_ BOOL Add | |
); | |
#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) | |
// CreatePseudoConsole Flags | |
#define PSEUDOCONSOLE_INHERIT_CURSOR (0x1) | |
WINBASEAPI | |
HRESULT | |
WINAPI | |
CreatePseudoConsole( | |
_In_ COORD size, | |
_In_ HANDLE hInput, | |
_In_ HANDLE hOutput, | |
_In_ DWORD dwFlags, | |
_Out_ HPCON* phPC | |
); | |
WINBASEAPI | |
HRESULT | |
WINAPI | |
ResizePseudoConsole( | |
_In_ HPCON hPC, | |
_In_ COORD size | |
); | |
WINBASEAPI | |
VOID | |
WINAPI | |
ClosePseudoConsole( | |
_In_ HPCON hPC | |
); | |
#endif | |
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) | |
#pragma endregion | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif // _APISETCONSOLE_ | |
// end_consoleapi_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************** | |
* * | |
* consoleapi2.h -- ApiSet Contract for api-ms-win-core-console-l2 * | |
* * | |
* Copyright (c) Microsoft Corporation. All rights reserved. * | |
* * | |
********************************************************************************/ | |
#ifdef _MSC_VER | |
#pragma once | |
#endif // _MSC_VER | |
#ifndef _APISETCONSOLEL2_ | |
#define _APISETCONSOLEL2_ | |
#include <apiset.h> | |
#include <apisetcconv.h> | |
#include <minwindef.h> | |
#include <minwinbase.h> | |
#include <wincontypes.h> | |
#include <windef.h> | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
#pragma region Application Family or OneCore Family | |
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) | |
// | |
// Attributes flags: | |
// | |
#define FOREGROUND_BLUE 0x0001 // text color contains blue. | |
#define FOREGROUND_GREEN 0x0002 // text color contains green. | |
#define FOREGROUND_RED 0x0004 // text color contains red. | |
#define FOREGROUND_INTENSITY 0x0008 // text color is intensified. | |
#define BACKGROUND_BLUE 0x0010 // background color contains blue. | |
#define BACKGROUND_GREEN 0x0020 // background color contains green. | |
#define BACKGROUND_RED 0x0040 // background color contains red. | |
#define BACKGROUND_INTENSITY 0x0080 // background color is intensified. | |
#define COMMON_LVB_LEADING_BYTE 0x0100 // Leading Byte of DBCS | |
#define COMMON_LVB_TRAILING_BYTE 0x0200 // Trailing Byte of DBCS | |
#define COMMON_LVB_GRID_HORIZONTAL 0x0400 // DBCS: Grid attribute: top horizontal. | |
#define COMMON_LVB_GRID_LVERTICAL 0x0800 // DBCS: Grid attribute: left vertical. | |
#define COMMON_LVB_GRID_RVERTICAL 0x1000 // DBCS: Grid attribute: right vertical. | |
#define COMMON_LVB_REVERSE_VIDEO 0x4000 // DBCS: Reverse fore/back ground attribute. | |
#define COMMON_LVB_UNDERSCORE 0x8000 // DBCS: Underscore. | |
#define COMMON_LVB_SBCSDBCS 0x0300 // SBCS or DBCS flag. | |
WINBASEAPI | |
BOOL | |
WINAPI | |
FillConsoleOutputCharacterA( | |
_In_ HANDLE hConsoleOutput, | |
_In_ CHAR cCharacter, | |
_In_ DWORD nLength, | |
_In_ COORD dwWriteCoord, | |
_Out_ LPDWORD lpNumberOfCharsWritten | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
FillConsoleOutputCharacterW( | |
_In_ HANDLE hConsoleOutput, | |
_In_ WCHAR cCharacter, | |
_In_ DWORD nLength, | |
_In_ COORD dwWriteCoord, | |
_Out_ LPDWORD lpNumberOfCharsWritten | |
); | |
#ifdef UNICODE | |
#define FillConsoleOutputCharacter FillConsoleOutputCharacterW | |
#else | |
#define FillConsoleOutputCharacter FillConsoleOutputCharacterA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
WINAPI | |
FillConsoleOutputAttribute( | |
_In_ HANDLE hConsoleOutput, | |
_In_ WORD wAttribute, | |
_In_ DWORD nLength, | |
_In_ COORD dwWriteCoord, | |
_Out_ LPDWORD lpNumberOfAttrsWritten | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GenerateConsoleCtrlEvent( | |
_In_ DWORD dwCtrlEvent, | |
_In_ DWORD dwProcessGroupId | |
); | |
WINBASEAPI | |
HANDLE | |
WINAPI | |
CreateConsoleScreenBuffer( | |
_In_ DWORD dwDesiredAccess, | |
_In_ DWORD dwShareMode, | |
_In_opt_ CONST SECURITY_ATTRIBUTES* lpSecurityAttributes, | |
_In_ DWORD dwFlags, | |
_Reserved_ LPVOID lpScreenBufferData | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleActiveScreenBuffer( | |
_In_ HANDLE hConsoleOutput | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
FlushConsoleInputBuffer( | |
_In_ HANDLE hConsoleInput | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleCP( | |
_In_ UINT wCodePageID | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleOutputCP( | |
_In_ UINT wCodePageID | |
); | |
typedef struct _CONSOLE_CURSOR_INFO { | |
DWORD dwSize; | |
BOOL bVisible; | |
} CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO; | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetConsoleCursorInfo( | |
_In_ HANDLE hConsoleOutput, | |
_Out_ PCONSOLE_CURSOR_INFO lpConsoleCursorInfo | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleCursorInfo( | |
_In_ HANDLE hConsoleOutput, | |
_In_ CONST CONSOLE_CURSOR_INFO* lpConsoleCursorInfo | |
); | |
typedef struct _CONSOLE_SCREEN_BUFFER_INFO { | |
COORD dwSize; | |
COORD dwCursorPosition; | |
WORD wAttributes; | |
SMALL_RECT srWindow; | |
COORD dwMaximumWindowSize; | |
} CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO; | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetConsoleScreenBufferInfo( | |
_In_ HANDLE hConsoleOutput, | |
_Out_ PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo | |
); | |
typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX { | |
ULONG cbSize; | |
COORD dwSize; | |
COORD dwCursorPosition; | |
WORD wAttributes; | |
SMALL_RECT srWindow; | |
COORD dwMaximumWindowSize; | |
WORD wPopupAttributes; | |
BOOL bFullscreenSupported; | |
COLORREF ColorTable[16]; | |
} CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX; | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetConsoleScreenBufferInfoEx( | |
_In_ HANDLE hConsoleOutput, | |
_Inout_ PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleScreenBufferInfoEx( | |
_In_ HANDLE hConsoleOutput, | |
_In_ PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleScreenBufferSize( | |
_In_ HANDLE hConsoleOutput, | |
_In_ COORD dwSize | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleCursorPosition( | |
_In_ HANDLE hConsoleOutput, | |
_In_ COORD dwCursorPosition | |
); | |
WINBASEAPI | |
COORD | |
WINAPI | |
GetLargestConsoleWindowSize( | |
_In_ HANDLE hConsoleOutput | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleTextAttribute( | |
_In_ HANDLE hConsoleOutput, | |
_In_ WORD wAttributes | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleWindowInfo( | |
_In_ HANDLE hConsoleOutput, | |
_In_ BOOL bAbsolute, | |
_In_ CONST SMALL_RECT* lpConsoleWindow | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleOutputCharacterA( | |
_In_ HANDLE hConsoleOutput, | |
_In_reads_(nLength) LPCSTR lpCharacter, | |
_In_ DWORD nLength, | |
_In_ COORD dwWriteCoord, | |
_Out_ LPDWORD lpNumberOfCharsWritten | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleOutputCharacterW( | |
_In_ HANDLE hConsoleOutput, | |
_In_reads_(nLength) LPCWSTR lpCharacter, | |
_In_ DWORD nLength, | |
_In_ COORD dwWriteCoord, | |
_Out_ LPDWORD lpNumberOfCharsWritten | |
); | |
#ifdef UNICODE | |
#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW | |
#else | |
#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleOutputAttribute( | |
_In_ HANDLE hConsoleOutput, | |
_In_reads_(nLength) CONST WORD* lpAttribute, | |
_In_ DWORD nLength, | |
_In_ COORD dwWriteCoord, | |
_Out_ LPDWORD lpNumberOfAttrsWritten | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
ReadConsoleOutputCharacterA( | |
_In_ HANDLE hConsoleOutput, | |
_Out_writes_(nLength) LPSTR lpCharacter, | |
_In_ DWORD nLength, | |
_In_ COORD dwReadCoord, | |
_Out_ LPDWORD lpNumberOfCharsRead | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
ReadConsoleOutputCharacterW( | |
_In_ HANDLE hConsoleOutput, | |
_Out_writes_(nLength) LPWSTR lpCharacter, | |
_In_ DWORD nLength, | |
_In_ COORD dwReadCoord, | |
_Out_ LPDWORD lpNumberOfCharsRead | |
); | |
#ifdef UNICODE | |
#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW | |
#else | |
#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
WINAPI | |
ReadConsoleOutputAttribute( | |
_In_ HANDLE hConsoleOutput, | |
_Out_writes_(nLength) LPWORD lpAttribute, | |
_In_ DWORD nLength, | |
_In_ COORD dwReadCoord, | |
_Out_ LPDWORD lpNumberOfAttrsRead | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleInputA( | |
_In_ HANDLE hConsoleInput, | |
_In_reads_(nLength) CONST INPUT_RECORD* lpBuffer, | |
_In_ DWORD nLength, | |
_Out_ LPDWORD lpNumberOfEventsWritten | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleInputW( | |
_In_ HANDLE hConsoleInput, | |
_In_reads_(nLength) CONST INPUT_RECORD* lpBuffer, | |
_In_ DWORD nLength, | |
_Out_ LPDWORD lpNumberOfEventsWritten | |
); | |
#ifdef UNICODE | |
#define WriteConsoleInput WriteConsoleInputW | |
#else | |
#define WriteConsoleInput WriteConsoleInputA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
WINAPI | |
ScrollConsoleScreenBufferA( | |
_In_ HANDLE hConsoleOutput, | |
_In_ CONST SMALL_RECT* lpScrollRectangle, | |
_In_opt_ CONST SMALL_RECT* lpClipRectangle, | |
_In_ COORD dwDestinationOrigin, | |
_In_ CONST CHAR_INFO* lpFill | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
ScrollConsoleScreenBufferW( | |
_In_ HANDLE hConsoleOutput, | |
_In_ CONST SMALL_RECT* lpScrollRectangle, | |
_In_opt_ CONST SMALL_RECT* lpClipRectangle, | |
_In_ COORD dwDestinationOrigin, | |
_In_ CONST CHAR_INFO* lpFill | |
); | |
#ifdef UNICODE | |
#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW | |
#else | |
#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleOutputA( | |
_In_ HANDLE hConsoleOutput, | |
_In_reads_(dwBufferSize.X * dwBufferSize.Y) CONST CHAR_INFO* lpBuffer, | |
_In_ COORD dwBufferSize, | |
_In_ COORD dwBufferCoord, | |
_Inout_ PSMALL_RECT lpWriteRegion | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
WriteConsoleOutputW( | |
_In_ HANDLE hConsoleOutput, | |
_In_reads_(dwBufferSize.X * dwBufferSize.Y) CONST CHAR_INFO* lpBuffer, | |
_In_ COORD dwBufferSize, | |
_In_ COORD dwBufferCoord, | |
_Inout_ PSMALL_RECT lpWriteRegion | |
); | |
#ifdef UNICODE | |
#define WriteConsoleOutput WriteConsoleOutputW | |
#else | |
#define WriteConsoleOutput WriteConsoleOutputA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
WINAPI | |
ReadConsoleOutputA( | |
_In_ HANDLE hConsoleOutput, | |
_Out_writes_(dwBufferSize.X * dwBufferSize.Y) PCHAR_INFO lpBuffer, | |
_In_ COORD dwBufferSize, | |
_In_ COORD dwBufferCoord, | |
_Inout_ PSMALL_RECT lpReadRegion | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
ReadConsoleOutputW( | |
_In_ HANDLE hConsoleOutput, | |
_Out_writes_(dwBufferSize.X * dwBufferSize.Y) PCHAR_INFO lpBuffer, | |
_In_ COORD dwBufferSize, | |
_In_ COORD dwBufferCoord, | |
_Inout_ PSMALL_RECT lpReadRegion | |
); | |
#ifdef UNICODE | |
#define ReadConsoleOutput ReadConsoleOutputW | |
#else | |
#define ReadConsoleOutput ReadConsoleOutputA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
WINAPI | |
GetConsoleTitleA( | |
_Out_writes_(nSize) LPSTR lpConsoleTitle, | |
_In_ DWORD nSize | |
); | |
WINBASEAPI | |
DWORD | |
WINAPI | |
GetConsoleTitleW( | |
_Out_writes_(nSize) LPWSTR lpConsoleTitle, | |
_In_ DWORD nSize | |
); | |
#ifdef UNICODE | |
#define GetConsoleTitle GetConsoleTitleW | |
#else | |
#define GetConsoleTitle GetConsoleTitleA | |
#endif // !UNICODE | |
#if (_WIN32_WINNT >= 0x0600) | |
WINBASEAPI | |
DWORD | |
WINAPI | |
GetConsoleOriginalTitleA( | |
_Out_writes_(nSize) LPSTR lpConsoleTitle, | |
_In_ DWORD nSize | |
); | |
WINBASEAPI | |
DWORD | |
WINAPI | |
GetConsoleOriginalTitleW( | |
_Out_writes_(nSize) LPWSTR lpConsoleTitle, | |
_In_ DWORD nSize | |
); | |
#ifdef UNICODE | |
#define GetConsoleOriginalTitle GetConsoleOriginalTitleW | |
#else | |
#define GetConsoleOriginalTitle GetConsoleOriginalTitleA | |
#endif // !UNICODE | |
#endif /* _WIN32_WINNT >= 0x0600 */ | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleTitleA( | |
_In_ LPCSTR lpConsoleTitle | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleTitleW( | |
_In_ LPCWSTR lpConsoleTitle | |
); | |
#ifdef UNICODE | |
#define SetConsoleTitle SetConsoleTitleW | |
#else | |
#define SetConsoleTitle SetConsoleTitleA | |
#endif // !UNICODE | |
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) | |
#pragma endregion | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif // _APISETCONSOLEL2_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************** | |
* * | |
* consoleapi3.h -- ApiSet Contract for api-ms-win-core-console-l3 * | |
* * | |
* Copyright (c) Microsoft Corporation. All rights reserved. * | |
* * | |
********************************************************************************/ | |
#ifdef _MSC_VER | |
#pragma once | |
#endif // _MSC_VER | |
#ifndef _APISETCONSOLEL3_ | |
#define _APISETCONSOLEL3_ | |
#include <apiset.h> | |
#include <apisetcconv.h> | |
#include <minwindef.h> | |
#include <minwinbase.h> | |
#include <wincontypes.h> | |
#include <windef.h> | |
#ifndef NOGDI | |
#include <wingdi.h> | |
#endif | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
#pragma region Application Family or OneCore Family | |
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetNumberOfConsoleMouseButtons( | |
_Out_ LPDWORD lpNumberOfMouseButtons | |
); | |
#if (_WIN32_WINNT >= 0x0500) | |
WINBASEAPI | |
COORD | |
WINAPI | |
GetConsoleFontSize( | |
_In_ HANDLE hConsoleOutput, | |
_In_ DWORD nFont | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetCurrentConsoleFont( | |
_In_ HANDLE hConsoleOutput, | |
_In_ BOOL bMaximumWindow, | |
_Out_ PCONSOLE_FONT_INFO lpConsoleCurrentFont | |
); | |
#ifndef NOGDI | |
typedef struct _CONSOLE_FONT_INFOEX { | |
ULONG cbSize; | |
DWORD nFont; | |
COORD dwFontSize; | |
UINT FontFamily; | |
UINT FontWeight; | |
WCHAR FaceName[LF_FACESIZE]; | |
} CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX; | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetCurrentConsoleFontEx( | |
_In_ HANDLE hConsoleOutput, | |
_In_ BOOL bMaximumWindow, | |
_Out_ PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetCurrentConsoleFontEx( | |
_In_ HANDLE hConsoleOutput, | |
_In_ BOOL bMaximumWindow, | |
_In_ PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx | |
); | |
#endif | |
// | |
// Selection flags | |
// | |
#define CONSOLE_NO_SELECTION 0x0000 | |
#define CONSOLE_SELECTION_IN_PROGRESS 0x0001 // selection has begun | |
#define CONSOLE_SELECTION_NOT_EMPTY 0x0002 // non-null select rectangle | |
#define CONSOLE_MOUSE_SELECTION 0x0004 // selecting with mouse | |
#define CONSOLE_MOUSE_DOWN 0x0008 // mouse is down | |
typedef struct _CONSOLE_SELECTION_INFO { | |
DWORD dwFlags; | |
COORD dwSelectionAnchor; | |
SMALL_RECT srSelection; | |
} CONSOLE_SELECTION_INFO, *PCONSOLE_SELECTION_INFO; | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetConsoleSelectionInfo( | |
_Out_ PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo | |
); | |
// | |
// History flags | |
// | |
#define HISTORY_NO_DUP_FLAG 0x1 | |
typedef struct _CONSOLE_HISTORY_INFO { | |
UINT cbSize; | |
UINT HistoryBufferSize; | |
UINT NumberOfHistoryBuffers; | |
DWORD dwFlags; | |
} CONSOLE_HISTORY_INFO, *PCONSOLE_HISTORY_INFO; | |
WINBASEAPI | |
BOOL | |
WINAPI | |
GetConsoleHistoryInfo( | |
_Out_ PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo | |
); | |
WINBASEAPI | |
BOOL | |
WINAPI | |
SetConsoleHistoryInfo( | |
_In_ PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo | |
); | |
#define CONSOLE_FULLSCREEN 1 // fullscreen console | |
#define CONSOLE_FULLSCREEN_HARDWARE 2 // console owns the hardware | |
WINBASEAPI | |
BOOL | |
APIENTRY | |
GetConsoleDisplayMode( | |
_Out_ LPDWORD lpModeFlags | |
); | |
#define CONSOLE_FULLSCREEN_MODE 1 | |
#define CONSOLE_WINDOWED_MODE 2 | |
WINBASEAPI | |
BOOL | |
APIENTRY | |
SetConsoleDisplayMode( | |
_In_ HANDLE hConsoleOutput, | |
_In_ DWORD dwFlags, | |
_Out_opt_ PCOORD lpNewScreenBufferDimensions | |
); | |
WINBASEAPI | |
HWND | |
APIENTRY | |
GetConsoleWindow( | |
VOID | |
); | |
#endif /* _WIN32_WINNT >= 0x0500 */ | |
#if (_WIN32_WINNT >= 0x0501) | |
WINBASEAPI | |
BOOL | |
APIENTRY | |
AddConsoleAliasA( | |
_In_ LPSTR Source, | |
_In_ LPSTR Target, | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
BOOL | |
APIENTRY | |
AddConsoleAliasW( | |
_In_ LPWSTR Source, | |
_In_ LPWSTR Target, | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define AddConsoleAlias AddConsoleAliasW | |
#else | |
#define AddConsoleAlias AddConsoleAliasA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasA( | |
_In_ LPSTR Source, | |
_Out_writes_(TargetBufferLength) LPSTR TargetBuffer, | |
_In_ DWORD TargetBufferLength, | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasW( | |
_In_ LPWSTR Source, | |
_Out_writes_(TargetBufferLength) LPWSTR TargetBuffer, | |
_In_ DWORD TargetBufferLength, | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define GetConsoleAlias GetConsoleAliasW | |
#else | |
#define GetConsoleAlias GetConsoleAliasA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasesLengthA( | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasesLengthW( | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define GetConsoleAliasesLength GetConsoleAliasesLengthW | |
#else | |
#define GetConsoleAliasesLength GetConsoleAliasesLengthA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasExesLengthA( | |
VOID | |
); | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasExesLengthW( | |
VOID | |
); | |
#ifdef UNICODE | |
#define GetConsoleAliasExesLength GetConsoleAliasExesLengthW | |
#else | |
#define GetConsoleAliasExesLength GetConsoleAliasExesLengthA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasesA( | |
_Out_writes_(AliasBufferLength) LPSTR AliasBuffer, | |
_In_ DWORD AliasBufferLength, | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasesW( | |
_Out_writes_(AliasBufferLength) LPWSTR AliasBuffer, | |
_In_ DWORD AliasBufferLength, | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define GetConsoleAliases GetConsoleAliasesW | |
#else | |
#define GetConsoleAliases GetConsoleAliasesA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasExesA( | |
_Out_writes_(ExeNameBufferLength) LPSTR ExeNameBuffer, | |
_In_ DWORD ExeNameBufferLength | |
); | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleAliasExesW( | |
_Out_writes_(ExeNameBufferLength) LPWSTR ExeNameBuffer, | |
_In_ DWORD ExeNameBufferLength | |
); | |
#ifdef UNICODE | |
#define GetConsoleAliasExes GetConsoleAliasExesW | |
#else | |
#define GetConsoleAliasExes GetConsoleAliasExesA | |
#endif // !UNICODE | |
#endif /* _WIN32_WINNT >= 0x0501 */ | |
WINBASEAPI | |
VOID | |
APIENTRY | |
ExpungeConsoleCommandHistoryA( | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
VOID | |
APIENTRY | |
ExpungeConsoleCommandHistoryW( | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define ExpungeConsoleCommandHistory ExpungeConsoleCommandHistoryW | |
#else | |
#define ExpungeConsoleCommandHistory ExpungeConsoleCommandHistoryA | |
#endif // !UNICODE | |
WINBASEAPI | |
BOOL | |
APIENTRY | |
SetConsoleNumberOfCommandsA( | |
_In_ DWORD Number, | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
BOOL | |
APIENTRY | |
SetConsoleNumberOfCommandsW( | |
_In_ DWORD Number, | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define SetConsoleNumberOfCommands SetConsoleNumberOfCommandsW | |
#else | |
#define SetConsoleNumberOfCommands SetConsoleNumberOfCommandsA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleCommandHistoryLengthA( | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleCommandHistoryLengthW( | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define GetConsoleCommandHistoryLength GetConsoleCommandHistoryLengthW | |
#else | |
#define GetConsoleCommandHistoryLength GetConsoleCommandHistoryLengthA | |
#endif // !UNICODE | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleCommandHistoryA( | |
_Out_writes_bytes_(CommandBufferLength) LPSTR Commands, | |
_In_ DWORD CommandBufferLength, | |
_In_ LPSTR ExeName | |
); | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleCommandHistoryW( | |
_Out_writes_bytes_(CommandBufferLength) LPWSTR Commands, | |
_In_ DWORD CommandBufferLength, | |
_In_ LPWSTR ExeName | |
); | |
#ifdef UNICODE | |
#define GetConsoleCommandHistory GetConsoleCommandHistoryW | |
#else | |
#define GetConsoleCommandHistory GetConsoleCommandHistoryA | |
#endif // !UNICODE | |
#if (_WIN32_WINNT >= 0x0501) | |
WINBASEAPI | |
DWORD | |
APIENTRY | |
GetConsoleProcessList( | |
_Out_writes_(dwProcessCount) LPDWORD lpdwProcessList, | |
_In_ DWORD dwProcessCount | |
); | |
#endif /* _WIN32_WINNT >= 0x0501 */ | |
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) | |
#pragma endregion | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif // _APISETCONSOLEL3_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment