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_NOREMOVE 0x0001 123 #define CONSOLE_READ_NOWAIT 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 } KEY_EVENT_RECORD, *PKEY_EVENT_RECORD; 250 251 C_ASSERT(FIELD_OFFSET(KEY_EVENT_RECORD, uChar) == 0xA); 252 253 typedef struct _MOUSE_EVENT_RECORD { 254 COORD dwMousePosition; 255 DWORD dwButtonState; 256 DWORD dwControlKeyState; 257 DWORD dwEventFlags; 258 } MOUSE_EVENT_RECORD, *PMOUSE_EVENT_RECORD; 259 260 typedef struct _WINDOW_BUFFER_SIZE_RECORD { 261 COORD dwSize; 262 } WINDOW_BUFFER_SIZE_RECORD, *PWINDOW_BUFFER_SIZE_RECORD; 263 264 typedef struct _MENU_EVENT_RECORD { 265 UINT dwCommandId; 266 } MENU_EVENT_RECORD, *PMENU_EVENT_RECORD; 267 268 typedef struct _FOCUS_EVENT_RECORD { 269 BOOL bSetFocus; 270 } FOCUS_EVENT_RECORD, *PFOCUS_EVENT_RECORD; 271 272 typedef struct _INPUT_RECORD { 273 WORD EventType; 274 union { 275 KEY_EVENT_RECORD KeyEvent; 276 MOUSE_EVENT_RECORD MouseEvent; 277 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; 278 MENU_EVENT_RECORD MenuEvent; 279 FOCUS_EVENT_RECORD FocusEvent; 280 } Event; 281 } INPUT_RECORD, *PINPUT_RECORD; 282 283 #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA) 284 typedef struct _CONSOLE_HISTORY_INFO { 285 UINT cbSize; 286 UINT HistoryBufferSize; 287 UINT NumberOfHistoryBuffers; 288 DWORD dwFlags; 289 } CONSOLE_HISTORY_INFO, *PCONSOLE_HISTORY_INFO; 290 291 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX { 292 ULONG cbSize; 293 COORD dwSize; 294 COORD dwCursorPosition; 295 WORD wAttributes; 296 SMALL_RECT srWindow; 297 COORD dwMaximumWindowSize; 298 WORD wPopupAttributes; 299 BOOL bFullscreenSupported; 300 COLORREF ColorTable[16]; 301 } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX; 302 303 #ifndef NOGDI 304 typedef struct _CONSOLE_FONT_INFOEX { 305 ULONG cbSize; 306 DWORD nFont; 307 COORD dwFontSize; 308 UINT FontFamily; 309 UINT FontWeight; 310 WCHAR FaceName[LF_FACESIZE]; 311 } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX; 312 #endif 313 #endif 314 315 BOOL WINAPI AllocConsole(VOID); 316 317 #if (_WIN32_WINNT >= _WIN32_WINNT_WINXP) 318 BOOL WINAPI AttachConsole(_In_ DWORD); 319 320 BOOL WINAPI AddConsoleAliasA(_In_ LPCSTR, _In_ LPCSTR, _In_ LPCSTR); 321 BOOL WINAPI AddConsoleAliasW(_In_ LPCWSTR, _In_ LPCWSTR, _In_ LPCWSTR); 322 323 DWORD 324 WINAPI 325 GetConsoleAliasA( 326 _In_ LPSTR Source, 327 _Out_writes_(TargetBufferLength) LPSTR TargetBuffer, 328 _In_ DWORD TargetBufferLength, 329 _In_ LPSTR ExeName); 330 331 DWORD 332 WINAPI 333 GetConsoleAliasW( 334 _In_ LPWSTR Source, 335 _Out_writes_(TargetBufferLength) LPWSTR TargetBuffer, 336 _In_ DWORD TargetBufferLength, 337 _In_ LPWSTR ExeName); 338 339 DWORD 340 WINAPI 341 GetConsoleAliasesA( 342 _Out_writes_(AliasBufferLength) LPSTR AliasBuffer, 343 _In_ DWORD AliasBufferLength, 344 _In_ LPSTR ExeName); 345 346 DWORD 347 WINAPI 348 GetConsoleAliasesW( 349 _Out_writes_(AliasBufferLength) LPWSTR AliasBuffer, 350 _In_ DWORD AliasBufferLength, 351 _In_ LPWSTR ExeName); 352 353 DWORD WINAPI GetConsoleAliasesLengthA(_In_ LPSTR ExeName); 354 DWORD WINAPI GetConsoleAliasesLengthW(_In_ LPWSTR ExeName); 355 356 DWORD 357 WINAPI 358 GetConsoleAliasExesA( 359 _Out_writes_(ExeNameBufferLength) LPSTR ExeNameBuffer, 360 _In_ DWORD ExeNameBufferLength); 361 362 DWORD 363 WINAPI 364 GetConsoleAliasExesW( 365 _Out_writes_(ExeNameBufferLength) LPWSTR ExeNameBuffer, 366 _In_ DWORD ExeNameBufferLength); 367 368 DWORD WINAPI GetConsoleAliasExesLengthA(VOID); 369 DWORD WINAPI GetConsoleAliasExesLengthW(VOID); 370 #endif 371 372 HANDLE 373 WINAPI 374 CreateConsoleScreenBuffer( 375 _In_ DWORD, 376 _In_ DWORD, 377 _In_opt_ CONST SECURITY_ATTRIBUTES*, 378 _In_ DWORD, 379 _Reserved_ LPVOID); 380 381 BOOL 382 WINAPI 383 FillConsoleOutputAttribute( 384 _In_ HANDLE, 385 _In_ WORD, 386 _In_ DWORD, 387 _In_ COORD, 388 _Out_ PDWORD); 389 390 BOOL 391 WINAPI 392 FillConsoleOutputCharacterA( 393 _In_ HANDLE, 394 _In_ CHAR, 395 _In_ DWORD, 396 _In_ COORD, 397 _Out_ PDWORD); 398 399 BOOL 400 WINAPI 401 FillConsoleOutputCharacterW( 402 _In_ HANDLE, 403 _In_ WCHAR, 404 _In_ DWORD, 405 _In_ COORD, 406 _Out_ PDWORD); 407 408 BOOL WINAPI FlushConsoleInputBuffer(_In_ HANDLE); 409 BOOL WINAPI FreeConsole(VOID); 410 BOOL WINAPI GenerateConsoleCtrlEvent(_In_ DWORD, _In_ DWORD); 411 UINT WINAPI GetConsoleCP(VOID); 412 BOOL WINAPI GetConsoleCursorInfo(_In_ HANDLE, _Out_ PCONSOLE_CURSOR_INFO); 413 BOOL WINAPI GetConsoleMode(_In_ HANDLE, _Out_ PDWORD); 414 UINT WINAPI GetConsoleOutputCP(VOID); 415 416 BOOL 417 WINAPI 418 GetConsoleScreenBufferInfo( 419 _In_ HANDLE, 420 _Out_ PCONSOLE_SCREEN_BUFFER_INFO); 421 422 /* Undocumented, see http://blog.airesoft.co.uk/2012/10/things-ms-can-do-that-they-dont-tell-you-about-console-graphics/ */ 423 BOOL WINAPI InvalidateConsoleDIBits(_In_ HANDLE, _In_ PSMALL_RECT); 424 425 DWORD 426 WINAPI 427 GetConsoleTitleA( 428 _Out_writes_(nSize) LPSTR lpConsoleTitle, 429 _In_ DWORD nSize); 430 431 DWORD 432 WINAPI 433 GetConsoleTitleW( 434 _Out_writes_(nSize) LPWSTR lpConsoleTitle, 435 _In_ DWORD nSize); 436 437 COORD 438 WINAPI 439 GetConsoleFontSize( 440 _In_ HANDLE hConsoleOutput, 441 _In_ DWORD nFont); 442 443 BOOL 444 WINAPI 445 GetCurrentConsoleFont( 446 _In_ HANDLE hConsoleOutput, 447 _In_ BOOL bMaximumWindow, 448 _Out_ PCONSOLE_FONT_INFO lpConsoleCurrentFont); 449 450 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K) 451 452 HWND WINAPI GetConsoleWindow(VOID); 453 BOOL WINAPI GetConsoleDisplayMode(_Out_ LPDWORD lpModeFlags); 454 455 BOOL 456 WINAPI 457 SetConsoleDisplayMode( 458 _In_ HANDLE hConsoleOutput, 459 _In_ DWORD dwFlags, 460 _Out_opt_ PCOORD lpNewScreenBufferDimensions); 461 462 #endif 463 464 COORD WINAPI GetLargestConsoleWindowSize(_In_ HANDLE); 465 BOOL WINAPI GetNumberOfConsoleInputEvents(_In_ HANDLE, _Out_ PDWORD); 466 BOOL WINAPI GetNumberOfConsoleMouseButtons(_Out_ PDWORD); 467 468 _Success_(return != 0) 469 BOOL 470 WINAPI PeekConsoleInputA( 471 _In_ HANDLE hConsoleInput, 472 _Out_writes_(nLength) PINPUT_RECORD lpBuffer, 473 _In_ DWORD nLength, 474 _Out_ LPDWORD lpNumberOfEventsRead); 475 476 _Success_(return != 0) 477 BOOL 478 WINAPI 479 PeekConsoleInputW( 480 _In_ HANDLE hConsoleInput, 481 _Out_writes_(nLength) PINPUT_RECORD lpBuffer, 482 _In_ DWORD nLength, 483 _Out_ LPDWORD lpNumberOfEventsRead); 484 485 _Success_(return != 0) 486 BOOL 487 WINAPI 488 ReadConsoleA( 489 _In_ HANDLE hConsoleInput, 490 _Out_writes_bytes_to_(nNumberOfCharsToRead * sizeof(CHAR), *lpNumberOfCharsRead * sizeof(CHAR)) LPVOID lpBuffer, 491 _In_ DWORD nNumberOfCharsToRead, 492 _Out_ _Deref_out_range_(<= , nNumberOfCharsToRead) LPDWORD lpNumberOfCharsRead, 493 _In_opt_ PCONSOLE_READCONSOLE_CONTROL pInputControl); 494 495 _Success_(return != 0) 496 BOOL 497 WINAPI 498 ReadConsoleW( 499 _In_ HANDLE hConsoleInput, 500 _Out_writes_bytes_to_(nNumberOfCharsToRead * sizeof(WCHAR), *lpNumberOfCharsRead * sizeof(WCHAR)) LPVOID lpBuffer, 501 _In_ DWORD nNumberOfCharsToRead, 502 _Out_ _Deref_out_range_(<= , nNumberOfCharsToRead) LPDWORD lpNumberOfCharsRead, 503 _In_opt_ PCONSOLE_READCONSOLE_CONTROL pInputControl); 504 505 _Success_(return != 0) 506 BOOL 507 WINAPI 508 ReadConsoleInputA( 509 _In_ HANDLE hConsoleInput, 510 _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer, 511 _In_ DWORD nLength, 512 _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead); 513 514 _Success_(return != 0) 515 BOOL 516 WINAPI 517 ReadConsoleInputW( 518 _In_ HANDLE hConsoleInput, 519 _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer, 520 _In_ DWORD nLength, 521 _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead); 522 523 _Success_(return != 0) 524 BOOL 525 WINAPI 526 ReadConsoleInputExA( 527 _In_ HANDLE hConsoleInput, 528 _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer, 529 _In_ DWORD nLength, 530 _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead, 531 _In_ WORD wFlags); 532 533 _Success_(return != 0) 534 BOOL 535 WINAPI 536 ReadConsoleInputExW( 537 _In_ HANDLE hConsoleInput, 538 _Out_writes_to_(nLength, *lpNumberOfEventsRead) PINPUT_RECORD lpBuffer, 539 _In_ DWORD nLength, 540 _Out_ _Deref_out_range_(<= , nLength) LPDWORD lpNumberOfEventsRead, 541 _In_ WORD wFlags); 542 543 BOOL 544 WINAPI 545 ReadConsoleOutputAttribute( 546 _In_ HANDLE hConsoleOutput, 547 _Out_writes_(nLength) LPWORD lpAttribute, 548 _In_ DWORD nLength, 549 _In_ COORD dwReadCoord, 550 _Out_ LPDWORD lpNumberOfAttrsRead); 551 552 BOOL 553 WINAPI 554 ReadConsoleOutputCharacterA( 555 _In_ HANDLE hConsoleOutput, 556 _Out_writes_(nLength) LPSTR lpCharacter, 557 _In_ DWORD nLength, 558 _In_ COORD dwReadCoord, 559 _Out_ LPDWORD lpNumberOfCharsRead); 560 561 BOOL 562 WINAPI 563 ReadConsoleOutputCharacterW( 564 _In_ HANDLE hConsoleOutput, 565 _Out_writes_(nLength) LPWSTR lpCharacter, 566 _In_ DWORD nLength, 567 _In_ COORD dwReadCoord, 568 _Out_ LPDWORD lpNumberOfCharsRead); 569 570 BOOL 571 WINAPI 572 ReadConsoleOutputA( 573 _In_ HANDLE hConsoleOutput, 574 _Out_writes_(dwBufferSize.X * dwBufferSize.Y) PCHAR_INFO lpBuffer, 575 _In_ COORD dwBufferSize, 576 _In_ COORD dwBufferCoord, 577 _Inout_ PSMALL_RECT lpReadRegion); 578 579 BOOL 580 WINAPI 581 ReadConsoleOutputW( 582 _In_ HANDLE hConsoleOutput, 583 _Out_writes_(dwBufferSize.X * dwBufferSize.Y) PCHAR_INFO lpBuffer, 584 _In_ COORD dwBufferSize, 585 _In_ COORD dwBufferCoord, 586 _Inout_ PSMALL_RECT lpReadRegion); 587 588 BOOL 589 WINAPI 590 ScrollConsoleScreenBufferA( 591 _In_ HANDLE, 592 _In_ const SMALL_RECT*, 593 _In_opt_ const SMALL_RECT*, 594 _In_ COORD, 595 _In_ const CHAR_INFO*); 596 597 BOOL 598 WINAPI 599 ScrollConsoleScreenBufferW( 600 _In_ HANDLE, 601 _In_ const SMALL_RECT*, 602 _In_opt_ const SMALL_RECT*, 603 _In_ COORD, 604 _In_ const CHAR_INFO*); 605 606 BOOL WINAPI SetConsoleActiveScreenBuffer(_In_ HANDLE); 607 BOOL WINAPI SetConsoleCP(_In_ UINT); 608 BOOL WINAPI SetConsoleCtrlHandler(_In_opt_ PHANDLER_ROUTINE, _In_ BOOL); 609 BOOL WINAPI SetConsoleCursorInfo(_In_ HANDLE, _In_ const CONSOLE_CURSOR_INFO*); 610 BOOL WINAPI SetConsoleCursorPosition(_In_ HANDLE, _In_ COORD); 611 BOOL WINAPI SetConsoleMode(_In_ HANDLE, _In_ DWORD); 612 BOOL WINAPI SetConsoleOutputCP(_In_ UINT); 613 BOOL WINAPI SetConsoleScreenBufferSize(_In_ HANDLE, _In_ COORD); 614 BOOL WINAPI SetConsoleTextAttribute(_In_ HANDLE, _In_ WORD); 615 BOOL WINAPI SetConsoleTitleA(_In_ LPCSTR); 616 BOOL WINAPI SetConsoleTitleW(_In_ LPCWSTR); 617 618 BOOL 619 WINAPI 620 SetConsoleWindowInfo( 621 _In_ HANDLE, 622 _In_ BOOL, 623 _In_ const SMALL_RECT*); 624 625 /* Undocumented, see http://undoc.airesoft.co.uk/kernel32.dll/ConsoleMenuControl.php */ 626 HMENU WINAPI ConsoleMenuControl(_In_ HANDLE, _In_ DWORD, _In_ DWORD); 627 /* Undocumented */ 628 BOOL WINAPI SetConsoleMenuClose(_In_ BOOL); 629 /* Undocumented, see http://undoc.airesoft.co.uk/kernel32.dll/SetConsoleCursor.php */ 630 BOOL WINAPI SetConsoleCursor(_In_ HANDLE, _In_ HCURSOR); 631 /* Undocumented, see http://undoc.airesoft.co.uk/kernel32.dll/ShowConsoleCursor.php */ 632 INT WINAPI ShowConsoleCursor(_In_ HANDLE, _In_ BOOL); 633 /* Undocumented */ 634 BOOL WINAPI SetConsoleIcon(_In_ HICON); 635 /* Undocumented, see http://comments.gmane.org/gmane.comp.lang.harbour.devel/27844 */ 636 BOOL WINAPI SetConsolePalette(_In_ HANDLE, _In_ HPALETTE, _In_ UINT); 637 /* Undocumented */ 638 BOOL WINAPI CloseConsoleHandle(_In_ HANDLE); 639 /* Undocumented */ 640 HANDLE WINAPI GetConsoleInputWaitHandle(VOID); 641 /* Undocumented */ 642 BOOL WINAPI VerifyConsoleIoHandle(_In_ HANDLE); 643 /* Undocumented */ 644 BOOL 645 WINAPI 646 RegisterConsoleVDM(_In_ DWORD, _In_ HANDLE, _In_ HANDLE, _In_ HANDLE, _In_ DWORD, 647 _Out_ LPDWORD, _Out_ PVOID*, _In_ PVOID, _In_ DWORD, _In_ COORD, 648 _Out_ PVOID*); 649 650 BOOL 651 WINAPI 652 WriteConsoleA( 653 _In_ HANDLE hConsoleOutput, 654 _In_reads_(nNumberOfCharsToWrite) CONST VOID *lpBuffer, 655 _In_ DWORD nNumberOfCharsToWrite, 656 _Out_opt_ LPDWORD lpNumberOfCharsWritten, 657 _Reserved_ LPVOID lpReserved); 658 659 BOOL 660 WINAPI 661 WriteConsoleW( 662 _In_ HANDLE hConsoleOutput, 663 _In_reads_(nNumberOfCharsToWrite) CONST VOID *lpBuffer, 664 _In_ DWORD nNumberOfCharsToWrite, 665 _Out_opt_ LPDWORD lpNumberOfCharsWritten, 666 _Reserved_ LPVOID lpReserved); 667 668 BOOL 669 WINAPI 670 WriteConsoleInputA( 671 _In_ HANDLE hConsoleInput, 672 _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer, 673 _In_ DWORD nLength, 674 _Out_ LPDWORD lpNumberOfEventsWritten); 675 676 BOOL 677 WINAPI 678 WriteConsoleInputW( 679 _In_ HANDLE hConsoleInput, 680 _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer, 681 _In_ DWORD nLength, 682 _Out_ LPDWORD lpNumberOfEventsWritten); 683 684 BOOL 685 WINAPI 686 WriteConsoleInputVDMA( 687 _In_ HANDLE hConsoleInput, 688 _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer, 689 _In_ DWORD nLength, 690 _Out_ LPDWORD lpNumberOfEventsWritten); 691 692 BOOL 693 WINAPI 694 WriteConsoleInputVDMW( 695 _In_ HANDLE hConsoleInput, 696 _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer, 697 _In_ DWORD nLength, 698 _Out_ LPDWORD lpNumberOfEventsWritten); 699 700 BOOL 701 WINAPI 702 WriteConsoleOutputA( 703 _In_ HANDLE hConsoleOutput, 704 _In_reads_(dwBufferSize.X * dwBufferSize.Y) CONST CHAR_INFO *lpBuffer, 705 _In_ COORD dwBufferSize, 706 _In_ COORD dwBufferCoord, 707 _Inout_ PSMALL_RECT lpWriteRegion); 708 709 BOOL 710 WINAPI 711 WriteConsoleOutputW( 712 _In_ HANDLE hConsoleOutput, 713 _In_reads_(dwBufferSize.X * dwBufferSize.Y) CONST CHAR_INFO *lpBuffer, 714 _In_ COORD dwBufferSize, 715 _In_ COORD dwBufferCoord, 716 _Inout_ PSMALL_RECT lpWriteRegion); 717 718 BOOL 719 WINAPI 720 WriteConsoleOutputAttribute( 721 _In_ HANDLE hConsoleOutput, 722 _In_reads_(nLength) CONST WORD *lpAttribute, 723 _In_ DWORD nLength, 724 _In_ COORD dwWriteCoord, 725 _Out_ LPDWORD lpNumberOfAttrsWritten); 726 727 BOOL 728 WINAPI 729 WriteConsoleOutputCharacterA( 730 _In_ HANDLE hConsoleOutput, 731 _In_reads_(nLength) LPCSTR lpCharacter, 732 _In_ DWORD nLength, 733 _In_ COORD dwWriteCoord, 734 _Out_ LPDWORD lpNumberOfCharsWritten); 735 736 BOOL 737 WINAPI 738 WriteConsoleOutputCharacterW( 739 _In_ HANDLE hConsoleOutput, 740 _In_reads_(nLength) LPCWSTR lpCharacter, 741 _In_ DWORD nLength, 742 _In_ COORD dwWriteCoord, 743 _Out_ LPDWORD lpNumberOfCharsWritten); 744 745 746 #ifdef UNICODE 747 #define AddConsoleAlias AddConsoleAliasW 748 #define GetConsoleAlias GetConsoleAliasW 749 #define GetConsoleAliases GetConsoleAliasesW 750 #define GetConsoleAliasesLength GetConsoleAliasesLengthW 751 #define GetConsoleAliasExes GetConsoleAliasExesW 752 #define GetConsoleAliasExesLength GetConsoleAliasExesLengthW 753 #define GetConsoleTitle GetConsoleTitleW 754 #define PeekConsoleInput PeekConsoleInputW 755 #define ReadConsole ReadConsoleW 756 #define ReadConsoleInput ReadConsoleInputW 757 #define ReadConsoleInputEx ReadConsoleInputExW 758 #define ReadConsoleOutput ReadConsoleOutputW 759 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW 760 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW 761 #define SetConsoleTitle SetConsoleTitleW 762 #define WriteConsole WriteConsoleW 763 #define WriteConsoleInput WriteConsoleInputW 764 #define WriteConsoleInputVDM WriteConsoleInputVDMW 765 #define WriteConsoleOutput WriteConsoleOutputW 766 #define FillConsoleOutputCharacter FillConsoleOutputCharacterW 767 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW 768 #else 769 #define AddConsoleAlias AddConsoleAliasA 770 #define GetConsoleAlias GetConsoleAliasA 771 #define GetConsoleAliases GetConsoleAliasesA 772 #define GetConsoleAliasesLength GetConsoleAliasesLengthA 773 #define GetConsoleAliasExes GetConsoleAliasExesA 774 #define GetConsoleAliasExesLength GetConsoleAliasExesLengthA 775 #define GetConsoleTitle GetConsoleTitleA 776 #define PeekConsoleInput PeekConsoleInputA 777 #define ReadConsole ReadConsoleA 778 #define ReadConsoleInput ReadConsoleInputA 779 #define ReadConsoleInputEx ReadConsoleInputExA 780 #define ReadConsoleOutput ReadConsoleOutputA 781 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA 782 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA 783 #define SetConsoleTitle SetConsoleTitleA 784 #define WriteConsole WriteConsoleA 785 #define WriteConsoleInput WriteConsoleInputA 786 #define WriteConsoleInputVDM WriteConsoleInputVDMA 787 #define WriteConsoleOutput WriteConsoleOutputA 788 #define FillConsoleOutputCharacter FillConsoleOutputCharacterA 789 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA 790 #endif 791 792 #ifdef _MSC_VER 793 #pragma warning(pop) 794 #endif 795 796 #ifdef __cplusplus 797 } 798 #endif 799 800 #endif /* _WINCON_H */ 801