xref: /reactos/sdk/include/psdk/wincon.h (revision b8dd046e)
1 #ifndef _WINCON_H
2 #define _WINCON_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA) && !defined(NOGDI)
9 #  include "wingdi.h"
10 #endif
11 
12 #ifdef _MSC_VER
13 #pragma warning(push)
14 #pragma warning(disable:4820)
15 #endif
16 
17 /*
18  * Special PID for parent process for AttachConsole API
19  */
20 #if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
21 #define ATTACH_PARENT_PROCESS   ((DWORD)-1)
22 #endif
23 
24 /*
25  * Console display modes
26  */
27 // These codes are answered by GetConsoleDisplayMode
28 #define CONSOLE_WINDOWED            0
29 #define CONSOLE_FULLSCREEN          1
30 #define CONSOLE_FULLSCREEN_HARDWARE 2
31 
32 // These codes should be given to SetConsoleDisplayMode
33 #define CONSOLE_FULLSCREEN_MODE     1
34 #define CONSOLE_WINDOWED_MODE       2
35 
36 /*
37  * Color attributes for text and screen background
38  */
39 #define FOREGROUND_BLUE                 0x0001
40 #define FOREGROUND_GREEN                0x0002
41 #define FOREGROUND_RED                  0x0004
42 #define FOREGROUND_INTENSITY            0x0008
43 #define BACKGROUND_BLUE                 0x0010
44 #define BACKGROUND_GREEN                0x0020
45 #define BACKGROUND_RED                  0x0040
46 #define BACKGROUND_INTENSITY            0x0080
47 
48 #define COMMON_LVB_LEADING_BYTE         0x0100  /* DBCS Leading Byte  */
49 #define COMMON_LVB_TRAILING_BYTE        0x0200  /* DBCS Trailing Byte */
50 #define COMMON_LVB_GRID_HORIZONTAL      0x0400  /* Grid attribute: Top Horizontal */
51 #define COMMON_LVB_GRID_LVERTICAL       0x0800  /* Grid attribute: Left Vertical  */
52 #define COMMON_LVB_GRID_RVERTICAL       0x1000  /* Grid attribute: Right Vertical */
53 #define COMMON_LVB_REVERSE_VIDEO        0x4000  /* Reverse fore/back ground attribute */
54 #define COMMON_LVB_UNDERSCORE           0x8000  /* Underscore */
55 
56 #define COMMON_LVB_SBCSDBCS \
57     (COMMON_LVB_LEADING_BYTE | COMMON_LVB_TRAILING_BYTE) /* == 0x0300 */
58 
59 /*
60  * Screen buffer types
61  */
62 #define CONSOLE_TEXTMODE_BUFFER         1
63 #define CONSOLE_GRAPHICS_BUFFER         2   /* Undocumented, see http://blog.airesoft.co.uk/2012/10/things-ms-can-do-that-they-dont-tell-you-about-console-graphics/ */
64 
65 /*
66  * Control handler codes
67  */
68 #define CTRL_C_EVENT            0
69 #define CTRL_BREAK_EVENT        1
70 #define CTRL_CLOSE_EVENT        2
71 #define CTRL_LAST_CLOSE_EVENT   3   /* Undocumented */
72 #define CTRL_LOGOFF_EVENT       5
73 #define CTRL_SHUTDOWN_EVENT     6
74 
75 /*
76  * Input mode flags
77  */
78 #define ENABLE_PROCESSED_INPUT          0x0001
79 #define ENABLE_LINE_INPUT               0x0002
80 #define ENABLE_ECHO_INPUT               0x0004
81 #define ENABLE_WINDOW_INPUT             0x0008
82 #define ENABLE_MOUSE_INPUT              0x0010
83 #define ENABLE_INSERT_MODE              0x0020
84 #define ENABLE_QUICK_EDIT_MODE          0x0040
85 #define ENABLE_EXTENDED_FLAGS           0x0080
86 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
87 #define ENABLE_AUTO_POSITION            0x0100
88 #endif
89 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
90 #define ENABLE_VIRTUAL_TERMINAL_INPUT   0x0200
91 #endif
92 
93 /*
94  * Output mode flags
95  */
96 #define ENABLE_PROCESSED_OUTPUT         0x0001
97 #define ENABLE_WRAP_AT_EOL_OUTPUT       0x0002
98 
99 /*
100  * Console selection flags
101  */
102 #define CONSOLE_NO_SELECTION            0x0000
103 #define CONSOLE_SELECTION_IN_PROGRESS   0x0001
104 #define CONSOLE_SELECTION_NOT_EMPTY     0x0002
105 #define CONSOLE_MOUSE_SELECTION         0x0004
106 #define CONSOLE_MOUSE_DOWN              0x0008
107 
108 /*
109  * History information and mode flags
110  */
111 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
112 // For Get/SetConsoleHistoryInfo
113 #define HISTORY_NO_DUP_FLAG             0x0001
114 // For SetConsoleCommandHistoryMode
115 #define CONSOLE_OVERSTRIKE              0x0001
116 #endif
117 
118 
119 /*
120  * Read input flags
121  */
122 #define CONSOLE_READ_KEEPEVENT          0x0001
123 #define CONSOLE_READ_CONTINUE           0x0002
124 
125 /*
126  * Event types
127  */
128 #define KEY_EVENT                       0x0001
129 #define MOUSE_EVENT                     0x0002
130 #define WINDOW_BUFFER_SIZE_EVENT        0x0004
131 #define MENU_EVENT                      0x0008
132 #define FOCUS_EVENT                     0x0010
133 
134 /*
135  * ControlKeyState flags
136  */
137 #define RIGHT_ALT_PRESSED               0x0001
138 #define LEFT_ALT_PRESSED                0x0002
139 #define RIGHT_CTRL_PRESSED              0x0004
140 #define LEFT_CTRL_PRESSED               0x0008
141 #define SHIFT_PRESSED                   0x0010
142 #define NUMLOCK_ON                      0x0020
143 #define SCROLLLOCK_ON                   0x0040
144 #define CAPSLOCK_ON                     0x0080
145 #define ENHANCED_KEY                    0x0100
146 
147 // NLS Japanese flags
148 #define NLS_DBCSCHAR                    0x00010000  /* SBCS/DBCS mode     */
149 #define NLS_ALPHANUMERIC                0x00000000  /* Alphanumeric mode  */
150 #define NLS_KATAKANA                    0x00020000  /* Katakana mode      */
151 #define NLS_HIRAGANA                    0x00040000  /* Hiragana mode      */
152 #define NLS_ROMAN                       0x00400000  /* Roman/Noroman mode */
153 #define NLS_IME_CONVERSION              0x00800000  /* IME conversion     */
154 #define NLS_IME_DISABLE                 0x20000000  /* IME enable/disable */
155 
156 /*
157  * ButtonState flags
158  */
159 #define FROM_LEFT_1ST_BUTTON_PRESSED    0x0001
160 #define RIGHTMOST_BUTTON_PRESSED        0x0002
161 #define FROM_LEFT_2ND_BUTTON_PRESSED    0x0004
162 #define FROM_LEFT_3RD_BUTTON_PRESSED    0x0008
163 #define FROM_LEFT_4TH_BUTTON_PRESSED    0x0010
164 
165 /*
166  * Mouse event flags
167  */
168 #define MOUSE_MOVED                     0x0001
169 #define DOUBLE_CLICK                    0x0002
170 #define MOUSE_WHEELED                   0x0004
171 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
172 #define MOUSE_HWHEELED                  0x0008
173 #endif
174 
175 typedef struct _CONSOLE_READCONSOLE_CONTROL {
176     ULONG nLength;
177     ULONG nInitialChars;
178     ULONG dwCtrlWakeupMask;
179     ULONG dwControlKeyState;
180 } CONSOLE_READCONSOLE_CONTROL, *PCONSOLE_READCONSOLE_CONTROL;
181 
182 typedef struct _CHAR_INFO {
183     union {
184         WCHAR UnicodeChar;
185         CHAR AsciiChar;
186     } Char;
187     WORD Attributes;
188 } CHAR_INFO,*PCHAR_INFO;
189 
190 typedef struct _SMALL_RECT {
191     SHORT Left;
192     SHORT Top;
193     SHORT Right;
194     SHORT Bottom;
195 } SMALL_RECT,*PSMALL_RECT;
196 
197 typedef struct _CONSOLE_CURSOR_INFO {
198     DWORD dwSize;
199     BOOL  bVisible;
200 } CONSOLE_CURSOR_INFO,*PCONSOLE_CURSOR_INFO;
201 
202 typedef struct _COORD {
203     SHORT X;
204     SHORT Y;
205 } COORD, *PCOORD;
206 
207 typedef struct _CONSOLE_SELECTION_INFO {
208     DWORD dwFlags;
209     COORD dwSelectionAnchor;
210     SMALL_RECT srSelection;
211 } CONSOLE_SELECTION_INFO, *PCONSOLE_SELECTION_INFO;
212 
213 typedef struct _CONSOLE_FONT_INFO {
214     DWORD nFont;
215     COORD dwFontSize;
216 } CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO;
217 
218 typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
219     COORD      dwSize;
220     COORD      dwCursorPosition;
221     WORD       wAttributes;
222     SMALL_RECT srWindow;
223     COORD      dwMaximumWindowSize;
224 } CONSOLE_SCREEN_BUFFER_INFO,*PCONSOLE_SCREEN_BUFFER_INFO;
225 
226 /* Undocumented, see http://blog.airesoft.co.uk/2012/10/things-ms-can-do-that-they-dont-tell-you-about-console-graphics/ */
227 #if defined(_WINGDI_) && !defined(NOGDI)
228 typedef struct _CONSOLE_GRAPHICS_BUFFER_INFO {
229     DWORD        dwBitMapInfoLength;
230     LPBITMAPINFO lpBitMapInfo;
231     DWORD        dwUsage;    // DIB_PAL_COLORS or DIB_RGB_COLORS
232     HANDLE       hMutex;
233     PVOID        lpBitMap;
234 } CONSOLE_GRAPHICS_BUFFER_INFO, *PCONSOLE_GRAPHICS_BUFFER_INFO;
235 #endif
236 
237 typedef BOOL(CALLBACK *PHANDLER_ROUTINE)(_In_ DWORD);
238 
239 typedef struct _KEY_EVENT_RECORD {
240     BOOL bKeyDown;
241     WORD wRepeatCount;
242     WORD wVirtualKeyCode;
243     WORD wVirtualScanCode;
244     union {
245         WCHAR UnicodeChar;
246         CHAR  AsciiChar;
247     } uChar;
248     DWORD dwControlKeyState;
249 }
250 #ifdef __GNUC__
251 /* gcc's alignment is not what win32 expects */
252 PACKED
253 #endif
254 KEY_EVENT_RECORD, *PKEY_EVENT_RECORD;
255 
256 typedef struct _MOUSE_EVENT_RECORD {
257     COORD dwMousePosition;
258     DWORD dwButtonState;
259     DWORD dwControlKeyState;
260     DWORD dwEventFlags;
261 } MOUSE_EVENT_RECORD, *PMOUSE_EVENT_RECORD;
262 
263 typedef struct _WINDOW_BUFFER_SIZE_RECORD {
264     COORD dwSize;
265 } WINDOW_BUFFER_SIZE_RECORD, *PWINDOW_BUFFER_SIZE_RECORD;
266 
267 typedef struct _MENU_EVENT_RECORD {
268     UINT dwCommandId;
269 } MENU_EVENT_RECORD, *PMENU_EVENT_RECORD;
270 
271 typedef struct _FOCUS_EVENT_RECORD {
272     BOOL bSetFocus;
273 } FOCUS_EVENT_RECORD, *PFOCUS_EVENT_RECORD;
274 
275 typedef struct _INPUT_RECORD {
276     WORD EventType;
277     union {
278         KEY_EVENT_RECORD KeyEvent;
279         MOUSE_EVENT_RECORD MouseEvent;
280         WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
281         MENU_EVENT_RECORD MenuEvent;
282         FOCUS_EVENT_RECORD FocusEvent;
283     } Event;
284 } INPUT_RECORD, *PINPUT_RECORD;
285 
286 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
287 typedef struct _CONSOLE_HISTORY_INFO {
288     UINT cbSize;
289     UINT HistoryBufferSize;
290     UINT NumberOfHistoryBuffers;
291     DWORD dwFlags;
292 } CONSOLE_HISTORY_INFO, *PCONSOLE_HISTORY_INFO;
293 
294 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX {
295     ULONG cbSize;
296     COORD dwSize;
297     COORD dwCursorPosition;
298     WORD wAttributes;
299     SMALL_RECT srWindow;
300     COORD dwMaximumWindowSize;
301     WORD wPopupAttributes;
302     BOOL bFullscreenSupported;
303     COLORREF ColorTable[16];
304 } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX;
305 
306 #ifndef NOGDI
307 typedef struct _CONSOLE_FONT_INFOEX {
308     ULONG cbSize;
309     DWORD nFont;
310     COORD dwFontSize;
311     UINT FontFamily;
312     UINT FontWeight;
313     WCHAR FaceName[LF_FACESIZE];
314 } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
315 #endif
316 #endif
317 
318 BOOL WINAPI AllocConsole(VOID);
319 
320 #if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
321 BOOL WINAPI AttachConsole(_In_ DWORD);
322 
323 BOOL WINAPI AddConsoleAliasA(_In_ LPCSTR, _In_ LPCSTR, _In_ LPCSTR);
324 BOOL WINAPI AddConsoleAliasW(_In_ LPCWSTR, _In_ LPCWSTR, _In_ LPCWSTR);
325 
326 DWORD
327 WINAPI
328 GetConsoleAliasA(
329   _In_ LPSTR Source,
330   _Out_writes_(TargetBufferLength) LPSTR TargetBuffer,
331   _In_ DWORD TargetBufferLength,
332   _In_ LPSTR ExeName);
333 
334 DWORD
335 WINAPI
336 GetConsoleAliasW(
337   _In_ LPWSTR Source,
338   _Out_writes_(TargetBufferLength) LPWSTR TargetBuffer,
339   _In_ DWORD TargetBufferLength,
340   _In_ LPWSTR ExeName);
341 
342 DWORD
343 WINAPI
344 GetConsoleAliasesA(
345   _Out_writes_(AliasBufferLength) LPSTR AliasBuffer,
346   _In_ DWORD AliasBufferLength,
347   _In_ LPSTR ExeName);
348 
349 DWORD
350 WINAPI
351 GetConsoleAliasesW(
352   _Out_writes_(AliasBufferLength) LPWSTR AliasBuffer,
353   _In_ DWORD AliasBufferLength,
354   _In_ LPWSTR ExeName);
355 
356 DWORD WINAPI GetConsoleAliasesLengthA(_In_ LPSTR ExeName);
357 DWORD WINAPI GetConsoleAliasesLengthW(_In_ LPWSTR ExeName);
358 
359 DWORD
360 WINAPI
361 GetConsoleAliasExesA(
362   _Out_writes_(ExeNameBufferLength) LPSTR ExeNameBuffer,
363   _In_ DWORD ExeNameBufferLength);
364 
365 DWORD
366 WINAPI
367 GetConsoleAliasExesW(
368   _Out_writes_(ExeNameBufferLength) LPWSTR ExeNameBuffer,
369   _In_ DWORD ExeNameBufferLength);
370 
371 DWORD WINAPI GetConsoleAliasExesLengthA(VOID);
372 DWORD WINAPI GetConsoleAliasExesLengthW(VOID);
373 #endif
374 
375 HANDLE
376 WINAPI
377 CreateConsoleScreenBuffer(
378   _In_ DWORD,
379   _In_ DWORD,
380   _In_opt_ CONST SECURITY_ATTRIBUTES*,
381   _In_ DWORD,
382   _Reserved_ LPVOID);
383 
384 BOOL
385 WINAPI
386 FillConsoleOutputAttribute(
387   _In_ HANDLE,
388   _In_ WORD,
389   _In_ DWORD,
390   _In_ COORD,
391   _Out_ PDWORD);
392 
393 BOOL
394 WINAPI
395 FillConsoleOutputCharacterA(
396   _In_ HANDLE,
397   _In_ CHAR,
398   _In_ DWORD,
399   _In_ COORD,
400   _Out_ PDWORD);
401 
402 BOOL
403 WINAPI
404 FillConsoleOutputCharacterW(
405   _In_ HANDLE,
406   _In_ WCHAR,
407   _In_ DWORD,
408   _In_ COORD,
409   _Out_ PDWORD);
410 
411 BOOL WINAPI FlushConsoleInputBuffer(_In_ HANDLE);
412 BOOL WINAPI FreeConsole(VOID);
413 BOOL WINAPI GenerateConsoleCtrlEvent(_In_ DWORD, _In_ DWORD);
414 UINT WINAPI GetConsoleCP(VOID);
415 BOOL WINAPI GetConsoleCursorInfo(_In_ HANDLE, _Out_ PCONSOLE_CURSOR_INFO);
416 BOOL WINAPI GetConsoleMode(_In_ HANDLE, _Out_ PDWORD);
417 UINT WINAPI GetConsoleOutputCP(VOID);
418 
419 BOOL
420 WINAPI
421 GetConsoleScreenBufferInfo(
422   _In_ HANDLE,
423   _Out_ PCONSOLE_SCREEN_BUFFER_INFO);
424 
425 /* Undocumented, see http://blog.airesoft.co.uk/2012/10/things-ms-can-do-that-they-dont-tell-you-about-console-graphics/ */
426 BOOL WINAPI InvalidateConsoleDIBits(_In_ HANDLE, _In_ PSMALL_RECT);
427 
428 DWORD
429 WINAPI
430 GetConsoleTitleA(
431   _Out_writes_(nSize) LPSTR lpConsoleTitle,
432   _In_ DWORD nSize);
433 
434 DWORD
435 WINAPI
436 GetConsoleTitleW(
437   _Out_writes_(nSize) LPWSTR lpConsoleTitle,
438   _In_ DWORD nSize);
439 
440 COORD
441 WINAPI
442 GetConsoleFontSize(
443   _In_ HANDLE hConsoleOutput,
444   _In_ DWORD nFont);
445 
446 BOOL
447 WINAPI
448 GetCurrentConsoleFont(
449   _In_  HANDLE hConsoleOutput,
450   _In_  BOOL bMaximumWindow,
451   _Out_ PCONSOLE_FONT_INFO lpConsoleCurrentFont);
452 
453 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
454 
455 HWND WINAPI GetConsoleWindow(VOID);
456 BOOL WINAPI GetConsoleDisplayMode(_Out_ LPDWORD lpModeFlags);
457 
458 BOOL
459 WINAPI
460 SetConsoleDisplayMode(
461   _In_ HANDLE hConsoleOutput,
462   _In_ DWORD dwFlags,
463   _Out_opt_ PCOORD lpNewScreenBufferDimensions);
464 
465 #endif
466 
467 COORD WINAPI GetLargestConsoleWindowSize(_In_ HANDLE);
468 BOOL WINAPI GetNumberOfConsoleInputEvents(_In_ HANDLE, _Out_ PDWORD);
469 BOOL WINAPI GetNumberOfConsoleMouseButtons(_Out_ PDWORD);
470 
471 _Success_(return != 0)
472 BOOL
473 WINAPI PeekConsoleInputA(
474   _In_ HANDLE hConsoleInput,
475   _Out_writes_(nLength) PINPUT_RECORD lpBuffer,
476   _In_ DWORD nLength,
477   _Out_ LPDWORD lpNumberOfEventsRead);
478 
479 _Success_(return != 0)
480 BOOL
481 WINAPI
482 PeekConsoleInputW(
483   _In_ HANDLE hConsoleInput,
484   _Out_writes_(nLength) PINPUT_RECORD lpBuffer,
485   _In_ DWORD nLength,
486   _Out_ LPDWORD lpNumberOfEventsRead);
487 
488 _Success_(return != 0)
489 BOOL
490 WINAPI
491 ReadConsoleA(
492   _In_ HANDLE hConsoleInput,
493   _Out_writes_bytes_to_(nNumberOfCharsToRead * sizeof(CHAR), *lpNumberOfCharsRead * sizeof(CHAR)) LPVOID lpBuffer,
494   _In_ DWORD nNumberOfCharsToRead,
495   _Out_ _Deref_out_range_(<= , nNumberOfCharsToRead) LPDWORD lpNumberOfCharsRead,
496   _In_opt_ PCONSOLE_READCONSOLE_CONTROL pInputControl);
497 
498 _Success_(return != 0)
499 BOOL
500 WINAPI
501 ReadConsoleW(
502   _In_ HANDLE hConsoleInput,
503   _Out_writes_bytes_to_(nNumberOfCharsToRead * sizeof(WCHAR), *lpNumberOfCharsRead * sizeof(WCHAR)) LPVOID lpBuffer,
504   _In_ DWORD nNumberOfCharsToRead,
505   _Out_ _Deref_out_range_(<= , nNumberOfCharsToRead) LPDWORD lpNumberOfCharsRead,
506   _In_opt_ PCONSOLE_READCONSOLE_CONTROL pInputControl);
507 
508 _Success_(return != 0)
509 BOOL
510 WINAPI
511 ReadConsoleInputA(
512   _In_ HANDLE hConsoleInput,
513   _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer,
514   _In_ DWORD nLength,
515   _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead);
516 
517 _Success_(return != 0)
518 BOOL
519 WINAPI
520 ReadConsoleInputW(
521   _In_ HANDLE hConsoleInput,
522   _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer,
523   _In_ DWORD nLength,
524   _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead);
525 
526 _Success_(return != 0)
527 BOOL
528 WINAPI
529 ReadConsoleInputExA(
530   _In_ HANDLE hConsoleInput,
531   _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer,
532   _In_ DWORD nLength,
533   _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead,
534   _In_ WORD wFlags);
535 
536 _Success_(return != 0)
537 BOOL
538 WINAPI
539 ReadConsoleInputExW(
540   _In_ HANDLE hConsoleInput,
541   _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer,
542   _In_ DWORD nLength,
543   _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead,
544   _In_ WORD wFlags);
545 
546 BOOL
547 WINAPI
548 ReadConsoleOutputAttribute(
549   _In_ HANDLE hConsoleOutput,
550   _Out_writes_(nLength) LPWORD lpAttribute,
551   _In_ DWORD nLength,
552   _In_ COORD dwReadCoord,
553   _Out_ LPDWORD lpNumberOfAttrsRead);
554 
555 BOOL
556 WINAPI
557 ReadConsoleOutputCharacterA(
558   _In_ HANDLE hConsoleOutput,
559   _Out_writes_(nLength) LPSTR lpCharacter,
560   _In_ DWORD nLength,
561   _In_ COORD dwReadCoord,
562   _Out_ LPDWORD lpNumberOfCharsRead);
563 
564 BOOL
565 WINAPI
566 ReadConsoleOutputCharacterW(
567   _In_ HANDLE hConsoleOutput,
568   _Out_writes_(nLength) LPWSTR lpCharacter,
569   _In_ DWORD nLength,
570   _In_ COORD dwReadCoord,
571   _Out_ LPDWORD lpNumberOfCharsRead);
572 
573 BOOL
574 WINAPI
575 ReadConsoleOutputA(
576   _In_ HANDLE hConsoleOutput,
577   _Out_writes_(dwBufferSize.X * dwBufferSize.Y) PCHAR_INFO lpBuffer,
578   _In_ COORD dwBufferSize,
579   _In_ COORD dwBufferCoord,
580   _Inout_ PSMALL_RECT lpReadRegion);
581 
582 BOOL
583 WINAPI
584 ReadConsoleOutputW(
585   _In_ HANDLE hConsoleOutput,
586   _Out_writes_(dwBufferSize.X * dwBufferSize.Y) PCHAR_INFO lpBuffer,
587   _In_ COORD dwBufferSize,
588   _In_ COORD dwBufferCoord,
589   _Inout_ PSMALL_RECT lpReadRegion);
590 
591 BOOL
592 WINAPI
593 ScrollConsoleScreenBufferA(
594   _In_ HANDLE,
595   _In_ const SMALL_RECT*,
596   _In_opt_ const SMALL_RECT*,
597   _In_ COORD,
598   _In_ const CHAR_INFO*);
599 
600 BOOL
601 WINAPI
602 ScrollConsoleScreenBufferW(
603   _In_ HANDLE,
604   _In_ const SMALL_RECT*,
605   _In_opt_ const SMALL_RECT*,
606   _In_ COORD,
607   _In_ const CHAR_INFO*);
608 
609 BOOL WINAPI SetConsoleActiveScreenBuffer(_In_ HANDLE);
610 BOOL WINAPI SetConsoleCP(_In_ UINT);
611 BOOL WINAPI SetConsoleCtrlHandler(_In_opt_ PHANDLER_ROUTINE, _In_ BOOL);
612 BOOL WINAPI SetConsoleCursorInfo(_In_ HANDLE, _In_ const CONSOLE_CURSOR_INFO*);
613 BOOL WINAPI SetConsoleCursorPosition(_In_ HANDLE, _In_ COORD);
614 BOOL WINAPI SetConsoleMode(_In_ HANDLE, _In_ DWORD);
615 BOOL WINAPI SetConsoleOutputCP(_In_ UINT);
616 BOOL WINAPI SetConsoleScreenBufferSize(_In_ HANDLE, _In_ COORD);
617 BOOL WINAPI SetConsoleTextAttribute(_In_ HANDLE, _In_ WORD);
618 BOOL WINAPI SetConsoleTitleA(_In_ LPCSTR);
619 BOOL WINAPI SetConsoleTitleW(_In_ LPCWSTR);
620 
621 BOOL
622 WINAPI
623 SetConsoleWindowInfo(
624   _In_ HANDLE,
625   _In_ BOOL,
626   _In_ const SMALL_RECT*);
627 
628 /* Undocumented, see http://undoc.airesoft.co.uk/kernel32.dll/ConsoleMenuControl.php */
629 HMENU WINAPI ConsoleMenuControl(_In_ HANDLE, _In_ DWORD, _In_ DWORD);
630 /* Undocumented */
631 BOOL WINAPI SetConsoleMenuClose(_In_ BOOL);
632 /* Undocumented, see http://undoc.airesoft.co.uk/kernel32.dll/SetConsoleCursor.php */
633 BOOL WINAPI SetConsoleCursor(_In_ HANDLE, _In_ HCURSOR);
634 /* Undocumented, see http://undoc.airesoft.co.uk/kernel32.dll/ShowConsoleCursor.php */
635 INT WINAPI ShowConsoleCursor(_In_ HANDLE, _In_ BOOL);
636 /* Undocumented */
637 BOOL WINAPI SetConsoleIcon(_In_ HICON);
638 /* Undocumented, see http://comments.gmane.org/gmane.comp.lang.harbour.devel/27844 */
639 BOOL WINAPI SetConsolePalette(_In_ HANDLE, _In_ HPALETTE, _In_ UINT);
640 /* Undocumented */
641 BOOL WINAPI CloseConsoleHandle(_In_ HANDLE);
642 /* Undocumented */
643 HANDLE WINAPI GetConsoleInputWaitHandle(VOID);
644 /* Undocumented */
645 BOOL WINAPI VerifyConsoleIoHandle(_In_ HANDLE);
646 /* Undocumented */
647 BOOL
648 WINAPI
649 RegisterConsoleVDM(_In_ DWORD, _In_ HANDLE, _In_ HANDLE, _In_ HANDLE, _In_ DWORD,
650                    _Out_ LPDWORD, _Out_ PVOID*, _In_ PVOID, _In_ DWORD, _In_ COORD,
651                    _Out_ PVOID*);
652 
653 BOOL
654 WINAPI
655 WriteConsoleA(
656   _In_ HANDLE hConsoleOutput,
657   _In_reads_(nNumberOfCharsToWrite) CONST VOID *lpBuffer,
658   _In_ DWORD nNumberOfCharsToWrite,
659   _Out_opt_ LPDWORD lpNumberOfCharsWritten,
660   _Reserved_ LPVOID lpReserved);
661 
662 BOOL
663 WINAPI
664 WriteConsoleW(
665   _In_ HANDLE hConsoleOutput,
666   _In_reads_(nNumberOfCharsToWrite) CONST VOID *lpBuffer,
667   _In_ DWORD nNumberOfCharsToWrite,
668   _Out_opt_ LPDWORD lpNumberOfCharsWritten,
669   _Reserved_ LPVOID lpReserved);
670 
671 BOOL
672 WINAPI
673 WriteConsoleInputA(
674   _In_ HANDLE hConsoleInput,
675   _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer,
676   _In_ DWORD nLength,
677   _Out_ LPDWORD lpNumberOfEventsWritten);
678 
679 BOOL
680 WINAPI
681 WriteConsoleInputW(
682   _In_ HANDLE hConsoleInput,
683   _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer,
684   _In_ DWORD nLength,
685   _Out_ LPDWORD lpNumberOfEventsWritten);
686 
687 BOOL
688 WINAPI
689 WriteConsoleInputVDMA(
690   _In_ HANDLE hConsoleInput,
691   _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer,
692   _In_ DWORD nLength,
693   _Out_ LPDWORD lpNumberOfEventsWritten);
694 
695 BOOL
696 WINAPI
697 WriteConsoleInputVDMW(
698   _In_ HANDLE hConsoleInput,
699   _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer,
700   _In_ DWORD nLength,
701   _Out_ LPDWORD lpNumberOfEventsWritten);
702 
703 BOOL
704 WINAPI
705 WriteConsoleOutputA(
706   _In_ HANDLE hConsoleOutput,
707   _In_reads_(dwBufferSize.X * dwBufferSize.Y) CONST CHAR_INFO *lpBuffer,
708   _In_ COORD dwBufferSize,
709   _In_ COORD dwBufferCoord,
710   _Inout_ PSMALL_RECT lpWriteRegion);
711 
712 BOOL
713 WINAPI
714 WriteConsoleOutputW(
715   _In_ HANDLE hConsoleOutput,
716   _In_reads_(dwBufferSize.X * dwBufferSize.Y) CONST CHAR_INFO *lpBuffer,
717   _In_ COORD dwBufferSize,
718   _In_ COORD dwBufferCoord,
719   _Inout_ PSMALL_RECT lpWriteRegion);
720 
721 BOOL
722 WINAPI
723 WriteConsoleOutputAttribute(
724   _In_ HANDLE hConsoleOutput,
725   _In_reads_(nLength) CONST WORD *lpAttribute,
726   _In_ DWORD nLength,
727   _In_ COORD dwWriteCoord,
728   _Out_ LPDWORD lpNumberOfAttrsWritten);
729 
730 BOOL
731 WINAPI
732 WriteConsoleOutputCharacterA(
733   _In_ HANDLE hConsoleOutput,
734   _In_reads_(nLength) LPCSTR lpCharacter,
735   _In_ DWORD nLength,
736   _In_ COORD dwWriteCoord,
737   _Out_ LPDWORD lpNumberOfCharsWritten);
738 
739 BOOL
740 WINAPI
741 WriteConsoleOutputCharacterW(
742   _In_ HANDLE hConsoleOutput,
743   _In_reads_(nLength) LPCWSTR lpCharacter,
744   _In_ DWORD nLength,
745   _In_ COORD dwWriteCoord,
746   _Out_ LPDWORD lpNumberOfCharsWritten);
747 
748 
749 #ifdef UNICODE
750 #define AddConsoleAlias AddConsoleAliasW
751 #define GetConsoleAlias GetConsoleAliasW
752 #define GetConsoleAliases GetConsoleAliasesW
753 #define GetConsoleAliasesLength GetConsoleAliasesLengthW
754 #define GetConsoleAliasExes GetConsoleAliasExesW
755 #define GetConsoleAliasExesLength GetConsoleAliasExesLengthW
756 #define GetConsoleTitle GetConsoleTitleW
757 #define PeekConsoleInput PeekConsoleInputW
758 #define ReadConsole ReadConsoleW
759 #define ReadConsoleInput ReadConsoleInputW
760 #define ReadConsoleInputEx ReadConsoleInputExW
761 #define ReadConsoleOutput ReadConsoleOutputW
762 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW
763 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW
764 #define SetConsoleTitle SetConsoleTitleW
765 #define WriteConsole WriteConsoleW
766 #define WriteConsoleInput WriteConsoleInputW
767 #define WriteConsoleInputVDM WriteConsoleInputVDMW
768 #define WriteConsoleOutput WriteConsoleOutputW
769 #define FillConsoleOutputCharacter FillConsoleOutputCharacterW
770 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW
771 #else
772 #define AddConsoleAlias AddConsoleAliasA
773 #define GetConsoleAlias GetConsoleAliasA
774 #define GetConsoleAliases GetConsoleAliasesA
775 #define GetConsoleAliasesLength GetConsoleAliasesLengthA
776 #define GetConsoleAliasExes GetConsoleAliasExesA
777 #define GetConsoleAliasExesLength GetConsoleAliasExesLengthA
778 #define GetConsoleTitle GetConsoleTitleA
779 #define PeekConsoleInput PeekConsoleInputA
780 #define ReadConsole ReadConsoleA
781 #define ReadConsoleInput ReadConsoleInputA
782 #define ReadConsoleInputEx ReadConsoleInputExA
783 #define ReadConsoleOutput ReadConsoleOutputA
784 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA
785 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA
786 #define SetConsoleTitle SetConsoleTitleA
787 #define WriteConsole WriteConsoleA
788 #define WriteConsoleInput WriteConsoleInputA
789 #define WriteConsoleInputVDM WriteConsoleInputVDMA
790 #define WriteConsoleOutput WriteConsoleOutputA
791 #define FillConsoleOutputCharacter FillConsoleOutputCharacterA
792 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
793 #endif
794 
795 #ifdef _MSC_VER
796 #pragma warning(pop)
797 #endif
798 
799 #ifdef __cplusplus
800 }
801 #endif
802 
803 #endif /* _WINCON_H */
804