4 #pragma GCC system_header
12 #define FOREGROUND_BLUE 1
13 #define FOREGROUND_GREEN 2
14 #define FOREGROUND_RED 4
15 #define FOREGROUND_INTENSITY 8
16 #define BACKGROUND_BLUE 16
17 #define BACKGROUND_GREEN 32
18 #define BACKGROUND_RED 64
19 #define BACKGROUND_INTENSITY 128
20 #define CTRL_C_EVENT 0
21 #define CTRL_BREAK_EVENT 1
22 #define CTRL_CLOSE_EVENT 2
23 #define CTRL_LOGOFF_EVENT 5
24 #define CTRL_SHUTDOWN_EVENT 6
25 #define ENABLE_LINE_INPUT 2
26 #define ENABLE_ECHO_INPUT 4
27 #define ENABLE_PROCESSED_INPUT 1
28 #define ENABLE_WINDOW_INPUT 8
29 #define ENABLE_MOUSE_INPUT 16
30 #define ENABLE_PROCESSED_OUTPUT 1
31 #define ENABLE_WRAP_AT_EOL_OUTPUT 2
34 #define WINDOW_BUFFER_SIZE_EVENT 4
36 #define FOCUS_EVENT 16
37 #define CAPSLOCK_ON 128
38 #define ENHANCED_KEY 256
39 #define RIGHT_ALT_PRESSED 1
40 #define LEFT_ALT_PRESSED 2
41 #define RIGHT_CTRL_PRESSED 4
42 #define LEFT_CTRL_PRESSED 8
43 #define SHIFT_PRESSED 16
45 #define SCROLLLOCK_ON 64
46 #define FROM_LEFT_1ST_BUTTON_PRESSED 1
47 #define RIGHTMOST_BUTTON_PRESSED 2
48 #define FROM_LEFT_2ND_BUTTON_PRESSED 4
49 #define FROM_LEFT_3RD_BUTTON_PRESSED 8
50 #define FROM_LEFT_4TH_BUTTON_PRESSED 16
52 #define DOUBLE_CLICK 2
53 #define MOUSE_WHEELED 4
55 typedef struct _CHAR_INFO
{
61 } CHAR_INFO
,*PCHAR_INFO
;
62 typedef struct _SMALL_RECT
{
67 } SMALL_RECT
,*PSMALL_RECT
;
68 typedef struct _CONSOLE_CURSOR_INFO
{
71 } CONSOLE_CURSOR_INFO
,*PCONSOLE_CURSOR_INFO
;
72 typedef struct _COORD
{
76 typedef struct _CONSOLE_SCREEN_BUFFER_INFO
{
78 COORD dwCursorPosition
;
81 COORD dwMaximumWindowSize
;
82 } CONSOLE_SCREEN_BUFFER_INFO
,*PCONSOLE_SCREEN_BUFFER_INFO
;
83 typedef BOOL(CALLBACK
*PHANDLER_ROUTINE
)(DWORD
);
84 typedef struct _KEY_EVENT_RECORD
{
88 WORD wVirtualScanCode
;
93 DWORD dwControlKeyState
;
96 /* gcc's alignment is not what win32 expects */
101 typedef struct _MOUSE_EVENT_RECORD
{
102 COORD dwMousePosition
;
104 DWORD dwControlKeyState
;
106 } MOUSE_EVENT_RECORD
;
107 typedef struct _WINDOW_BUFFER_SIZE_RECORD
{ COORD dwSize
; } WINDOW_BUFFER_SIZE_RECORD
;
108 typedef struct _MENU_EVENT_RECORD
{ UINT dwCommandId
; } MENU_EVENT_RECORD
,*PMENU_EVENT_RECORD
;
109 typedef struct _FOCUS_EVENT_RECORD
{ BOOL bSetFocus
; } FOCUS_EVENT_RECORD
;
110 typedef struct _INPUT_RECORD
{
113 KEY_EVENT_RECORD KeyEvent
;
114 MOUSE_EVENT_RECORD MouseEvent
;
115 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
;
116 MENU_EVENT_RECORD MenuEvent
;
117 FOCUS_EVENT_RECORD FocusEvent
;
119 } INPUT_RECORD
,*PINPUT_RECORD
;
121 BOOL WINAPI
AllocConsole(void);
122 HANDLE WINAPI
CreateConsoleScreenBuffer(DWORD
,DWORD
,LPSECURITY_ATTRIBUTES
,DWORD
,PVOID
);
123 BOOL WINAPI
FillConsoleOutputAttribute(HANDLE
,WORD
,DWORD
,COORD
,PDWORD
);
124 BOOL WINAPI
FillConsoleOutputCharacterA(HANDLE
,CHAR
,DWORD
,COORD
,PDWORD
);
125 BOOL WINAPI
FillConsoleOutputCharacterW(HANDLE
,WCHAR
,DWORD
,COORD
,PDWORD
);
126 BOOL WINAPI
FlushConsoleInputBuffer(HANDLE
);
127 BOOL WINAPI
FreeConsole(void);
128 BOOL WINAPI
GenerateConsoleCtrlEvent(DWORD
,DWORD
);
129 UINT WINAPI
GetConsoleCP(void);
130 BOOL WINAPI
GetConsoleCursorInfo(HANDLE
,PCONSOLE_CURSOR_INFO
);
131 BOOL WINAPI
GetConsoleMode(HANDLE
,PDWORD
);
132 UINT WINAPI
GetConsoleOutputCP(void);
133 BOOL WINAPI
GetConsoleScreenBufferInfo(HANDLE
,PCONSOLE_SCREEN_BUFFER_INFO
);
134 DWORD WINAPI
GetConsoleTitleA(LPSTR
,DWORD
);
135 DWORD WINAPI
GetConsoleTitleW(LPWSTR
,DWORD
);
136 COORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
137 BOOL WINAPI
GetNumberOfConsoleInputEvents(HANDLE
,PDWORD
);
138 BOOL WINAPI
GetNumberOfConsoleMouseButtons(PDWORD
);
139 BOOL WINAPI
PeekConsoleInputA(HANDLE
,PINPUT_RECORD
,DWORD
,PDWORD
);
140 BOOL WINAPI
PeekConsoleInputW(HANDLE
,PINPUT_RECORD
,DWORD
,PDWORD
);
141 BOOL WINAPI
ReadConsoleA(HANDLE
,PVOID
,DWORD
,PDWORD
,PVOID
);
142 BOOL WINAPI
ReadConsoleW(HANDLE
,PVOID
,DWORD
,PDWORD
,PVOID
);
143 BOOL WINAPI
ReadConsoleInputA(HANDLE
,PINPUT_RECORD
,DWORD
,PDWORD
);
144 BOOL WINAPI
ReadConsoleInputW(HANDLE
,PINPUT_RECORD
,DWORD
,PDWORD
);
145 BOOL WINAPI
ReadConsoleOutputAttribute(HANDLE
,LPWORD
,DWORD
,COORD
,LPDWORD
);
146 BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE
,LPSTR
,DWORD
,COORD
,PDWORD
);
147 BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE
,LPWSTR
,DWORD
,COORD
,PDWORD
);
148 BOOL WINAPI
ReadConsoleOutputA(HANDLE
,PCHAR_INFO
,COORD
,COORD
,PSMALL_RECT
);
149 BOOL WINAPI
ReadConsoleOutputW(HANDLE
,PCHAR_INFO
,COORD
,COORD
,PSMALL_RECT
);
150 BOOL WINAPI
ScrollConsoleScreenBufferA(HANDLE
,const SMALL_RECT
*,const SMALL_RECT
*,COORD
,const CHAR_INFO
*);
151 BOOL WINAPI
ScrollConsoleScreenBufferW(HANDLE
,const SMALL_RECT
*,const SMALL_RECT
*,COORD
,const CHAR_INFO
*);
152 BOOL WINAPI
SetConsoleActiveScreenBuffer(HANDLE
);
153 BOOL WINAPI
SetConsoleCP(UINT
);
154 BOOL WINAPI
SetConsoleCtrlHandler(PHANDLER_ROUTINE
,BOOL
);
155 BOOL WINAPI
SetConsoleCursorInfo(HANDLE
,const CONSOLE_CURSOR_INFO
*);
156 BOOL WINAPI
SetConsoleCursorPosition(HANDLE
,COORD
);
157 BOOL WINAPI
SetConsoleMode(HANDLE
,DWORD
);
158 BOOL WINAPI
SetConsoleOutputCP(UINT
);
159 BOOL WINAPI
SetConsoleScreenBufferSize(HANDLE
,COORD
);
160 BOOL WINAPI
SetConsoleTextAttribute(HANDLE
,WORD
);
161 BOOL WINAPI
SetConsoleTitleA(LPCSTR
);
162 BOOL WINAPI
SetConsoleTitleW(LPCWSTR
);
163 BOOL WINAPI
SetConsoleWindowInfo(HANDLE
,BOOL
,const SMALL_RECT
*);
164 BOOL WINAPI
WriteConsoleA(HANDLE
,PCVOID
,DWORD
,PDWORD
,PVOID
);
165 BOOL WINAPI
WriteConsoleW(HANDLE
,PCVOID
,DWORD
,PDWORD
,PVOID
);
166 BOOL WINAPI
WriteConsoleInputA(HANDLE
,const INPUT_RECORD
*,DWORD
,PDWORD
);
167 BOOL WINAPI
WriteConsoleInputW(HANDLE
,const INPUT_RECORD
*,DWORD
,PDWORD
);
168 BOOL WINAPI
WriteConsoleOutputA(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,PSMALL_RECT
);
169 BOOL WINAPI
WriteConsoleOutputW(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,PSMALL_RECT
);
170 BOOL WINAPI
WriteConsoleOutputAttribute(HANDLE
,const WORD
*,DWORD
,COORD
,PDWORD
);
171 BOOL WINAPI
WriteConsoleOutputCharacterA(HANDLE
,LPCSTR
,DWORD
,COORD
,PDWORD
);
172 BOOL WINAPI
WriteConsoleOutputCharacterW(HANDLE
,LPCWSTR
,DWORD
,COORD
,PDWORD
);
175 #define FillConsoleOutputCharacter FillConsoleOutputCharacterW
176 #define GetConsoleTitle GetConsoleTitleW
177 #define PeekConsoleInput PeekConsoleInputW
178 #define ReadConsole ReadConsoleW
179 #define ReadConsoleInput ReadConsoleInputW
180 #define ReadConsoleOutput ReadConsoleOutputW
181 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW
182 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW
183 #define SetConsoleTitle SetConsoleTitleW
184 #define WriteConsole WriteConsoleW
185 #define WriteConsoleInput WriteConsoleInputW
186 #define WriteConsoleOutput WriteConsoleOutputW
187 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW
189 #define FillConsoleOutputCharacter FillConsoleOutputCharacterA
190 #define GetConsoleTitle GetConsoleTitleA
191 #define PeekConsoleInput PeekConsoleInputA
192 #define ReadConsole ReadConsoleA
193 #define ReadConsoleInput ReadConsoleInputA
194 #define ReadConsoleOutput ReadConsoleOutputA
195 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA
196 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA
197 #define SetConsoleTitle SetConsoleTitleA
198 #define WriteConsole WriteConsoleA
199 #define WriteConsoleInput WriteConsoleInputA
200 #define WriteConsoleOutput WriteConsoleOutputA
201 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA