Annotation of mstools/h/wincon.h, revision 1.1.1.1

1.1       root        1: /*++ BUILD Version: 0002    // Increment this if a change has global effects
                      2: 
                      3: Copyright (c) 1989  Microsoft Corporation
                      4: 
                      5: Module Name:
                      6: 
                      7:     console.h
                      8: 
                      9: Abstract:
                     10: 
                     11:     This module contains the public data structures, data types,
                     12:     and procedures exported by the NT console subsystem.
                     13: 
                     14: Created:
                     15: 
                     16:     26-Oct-1990
                     17: 
                     18: Revision History:
                     19: 
                     20: --*/
                     21: 
                     22: #ifndef _WINCON_
                     23: #define _WINCON_
                     24: 
                     25: typedef struct _COORD {
                     26:     SHORT X;
                     27:     SHORT Y;
                     28: } COORD, *PCOORD;
                     29: 
                     30: typedef struct _SMALL_RECT {
                     31:     SHORT Left;
                     32:     SHORT Top;
                     33:     SHORT Right;
                     34:     SHORT Bottom;
                     35: } SMALL_RECT, *PSMALL_RECT;
                     36: 
                     37: typedef struct _KEY_EVENT_RECORD {
                     38:     BOOL bKeyDown;
                     39:     WORD wRepeatCount;
                     40:     WORD wVirtualKeyCode;
                     41:     WORD wVirtualScanCode;
                     42:     union {
                     43:         WCHAR UnicodeChar;
                     44:         CHAR   AsciiChar;
                     45:     } uChar;
                     46:     DWORD dwControlKeyState;
                     47: } KEY_EVENT_RECORD, *PKEY_EVENT_RECORD;
                     48: 
                     49: //
                     50: // ControlKeyState flags
                     51: //
                     52: 
                     53: #define RIGHT_ALT_PRESSED     0x0001 // the right alt key is pressed.
                     54: #define LEFT_ALT_PRESSED      0x0002 // the left alt key is pressed.
                     55: #define RIGHT_CTRL_PRESSED    0x0004 // the right ctrl key is pressed.
                     56: #define LEFT_CTRL_PRESSED     0x0008 // the left ctrl key is pressed.
                     57: #define SHIFT_PRESSED         0x0010 // the shift key is pressed.
                     58: #define NUMLOCK_ON            0x0020 // the numlock light is on.
                     59: #define SCROLLLOCK_ON         0x0040 // the scrolllock light is on.
                     60: #define CAPSLOCK_ON           0x0080 // the capslock light is on.
                     61: #define ENHANCED_KEY          0x0100 // the key is enhanced.
                     62: 
                     63: typedef struct _MOUSE_EVENT_RECORD {
                     64:     COORD dwMousePosition;
                     65:     DWORD dwButtonState;
                     66:     DWORD dwControlKeyState;
                     67:     DWORD dwEventFlags;
                     68: } MOUSE_EVENT_RECORD, *PMOUSE_EVENT_RECORD;
                     69: 
                     70: //
                     71: // ButtonState flags
                     72: //
                     73: 
                     74: #define FROM_LEFT_1ST_BUTTON_PRESSED    0x0001
                     75: #define RIGHTMOST_BUTTON_PRESSED        0x0002
                     76: #define FROM_LEFT_2ND_BUTTON_PRESSED    0x0004
                     77: #define FROM_LEFT_3RD_BUTTON_PRESSED    0x0008
                     78: #define FROM_LEFT_4TH_BUTTON_PRESSED    0x0010
                     79: 
                     80: //
                     81: // EventFlags
                     82: //
                     83: 
                     84: #define MOUSE_MOVED   0x0001
                     85: #define DOUBLE_CLICK  0x0002
                     86: 
                     87: typedef struct _WINDOW_BUFFER_SIZE_RECORD {
                     88:     COORD dwSize;
                     89: } WINDOW_BUFFER_SIZE_RECORD, *PWINDOW_BUFFER_SIZE_RECORD;
                     90: 
                     91: typedef struct _INPUT_RECORD {
                     92:     WORD EventType;
                     93:     union {
                     94:         KEY_EVENT_RECORD KeyEvent;
                     95:         MOUSE_EVENT_RECORD MouseEvent;
                     96:         WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
                     97:     } Event;
                     98: } INPUT_RECORD, *PINPUT_RECORD;
                     99: 
                    100: //
                    101: //  EventType flags:
                    102: //
                    103: 
                    104: #define KEY_EVENT         0x0001 // Event contains key event record
                    105: #define MOUSE_EVENT       0x0002 // Event contains mouse event record
                    106: #define WINDOW_BUFFER_SIZE_EVENT 0x0004 // Event contains window change event record
                    107: 
                    108: typedef struct _CHAR_INFO {
                    109:     union {
                    110:         WCHAR UnicodeChar;
                    111:         CHAR   AsciiChar;
                    112:     } Char;
                    113:     WORD Attributes;
                    114: } CHAR_INFO, *PCHAR_INFO;
                    115: 
                    116: //
                    117: // Attributes flags:
                    118: //
                    119: 
                    120: #define FOREGROUND_BLUE      0x0001 // text color contains blue.
                    121: #define FOREGROUND_GREEN     0x0002 // text color contains green.
                    122: #define FOREGROUND_RED       0x0004 // text color contains red.
                    123: #define FOREGROUND_INTENSITY 0x0008 // text color is intensified.
                    124: #define BACKGROUND_BLUE      0x0010 // background color contains blue.
                    125: #define BACKGROUND_GREEN     0x0020 // background color contains green.
                    126: #define BACKGROUND_RED       0x0040 // background color contains red.
                    127: #define BACKGROUND_INTENSITY 0x0080 // background color is intensified.
                    128: 
                    129: 
                    130: typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
                    131:     COORD dwSize;
                    132:     COORD dwCursorPosition;
                    133:     WORD  wAttributes;
                    134:     SMALL_RECT srWindow;
                    135:     COORD dwMaximumWindowSize;
                    136: } CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO;
                    137: 
                    138: typedef struct _CONSOLE_CURSOR_INFO {
                    139:     DWORD  dwSize;
                    140:     BOOL   bVisible;
                    141: } CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO;
                    142: 
                    143: //
                    144: // typedef for ctrl-c handler routines
                    145: //
                    146: 
                    147: typedef
                    148: BOOL
                    149: (*PHANDLER_ROUTINE)(
                    150:     IN ULONG CtrlType
                    151:     );
                    152: 
                    153: #define CTRL_C_EVENT 0
                    154: #define CTRL_BREAK_EVENT 1
                    155: 
                    156: //
                    157: //  Input Mode flags:
                    158: //
                    159: 
                    160: #define ENABLE_PROCESSED_INPUT 0x0001
                    161: #define ENABLE_LINE_INPUT      0x0002
                    162: #define ENABLE_ECHO_INPUT      0x0004
                    163: #define ENABLE_WINDOW_INPUT    0x0008
                    164: #define ENABLE_MOUSE_INPUT     0x0010
                    165: 
                    166: //
                    167: // Output Mode flags:
                    168: //
                    169: 
                    170: #define ENABLE_PROCESSED_OUTPUT  0x0001
                    171: #define ENABLE_WRAP_AT_EOL_OUTPUT  0x0002
                    172: 
                    173: //
                    174: // direct API definitions.
                    175: //
                    176: 
                    177: BOOL
                    178: APIENTRY
                    179: PeekConsoleInput(
                    180:     HANDLE hConsoleInput,
                    181:     PINPUT_RECORD lpBuffer,
                    182:     DWORD nLength,
                    183:     LPDWORD lpNumberOfEventsRead
                    184:     );
                    185: 
                    186: BOOL
                    187: APIENTRY
                    188: ReadConsoleInput(
                    189:     HANDLE hConsoleInput,
                    190:     PINPUT_RECORD lpBuffer,
                    191:     DWORD nLength,
                    192:     LPDWORD lpNumberOfEventsRead
                    193:     );
                    194: 
                    195: BOOL
                    196: APIENTRY
                    197: WriteConsoleInput(
                    198:     HANDLE hConsoleInput,
                    199:     PINPUT_RECORD lpBuffer,
                    200:     DWORD nLength,
                    201:     LPDWORD lpNumberOfEventsWritten
                    202:     );
                    203: 
                    204: BOOL
                    205: APIENTRY
                    206: ReadConsoleOutput(
                    207:     HANDLE hConsoleOutput,
                    208:     PCHAR_INFO lpBuffer,
                    209:     COORD dwBufferSize,
                    210:     COORD dwBufferCoord,
                    211:     PSMALL_RECT lpReadRegion
                    212:     );
                    213: 
                    214: BOOL
                    215: APIENTRY
                    216: WriteConsoleOutput(
                    217:     HANDLE hConsoleOutput,
                    218:     PCHAR_INFO lpBuffer,
                    219:     COORD dwBufferSize,
                    220:     COORD dwBufferCoord,
                    221:     PSMALL_RECT lpWriteRegion
                    222:     );
                    223: 
                    224: BOOL
                    225: APIENTRY
                    226: ReadConsoleOutputCharacter(
                    227:     HANDLE hConsoleOutput,
                    228:     LPSTR lpCharacter,
                    229:     DWORD nLength,
                    230:     COORD dwReadCoord,
                    231:     LPDWORD lpNumberOfCharsRead
                    232:     );
                    233: 
                    234: BOOL
                    235: APIENTRY
                    236: ReadConsoleOutputAttribute(
                    237:     HANDLE hConsoleOutput,
                    238:     LPWORD lpAttribute,
                    239:     DWORD nLength,
                    240:     COORD dwReadCoord,
                    241:     LPDWORD lpNumberOfAttrsRead
                    242:     );
                    243: 
                    244: BOOL
                    245: APIENTRY
                    246: WriteConsoleOutputCharacter(
                    247:     HANDLE hConsoleOutput,
                    248:     LPSTR lpCharacter,
                    249:     DWORD nLength,
                    250:     COORD dwWriteCoord,
                    251:     LPDWORD lpNumberOfCharsWritten
                    252:     );
                    253: 
                    254: BOOL
                    255: APIENTRY
                    256: WriteConsoleOutputAttribute(
                    257:     HANDLE hConsoleOutput,
                    258:     LPWORD lpAttribute,
                    259:     DWORD nLength,
                    260:     COORD dwWriteCoord,
                    261:     LPDWORD lpNumberOfAttrsWritten
                    262:     );
                    263: 
                    264: BOOL
                    265: APIENTRY
                    266: FillConsoleOutputCharacter(
                    267:     HANDLE hConsoleOutput,
                    268:     CHAR   cCharacter,
                    269:     DWORD  nLength,
                    270:     COORD  dwWriteCoord,
                    271:     LPDWORD lpNumberOfCharsWritten
                    272:     );
                    273: 
                    274: BOOL
                    275: APIENTRY
                    276: FillConsoleOutputAttribute(
                    277:     HANDLE hConsoleOutput,
                    278:     WORD   wAttribute,
                    279:     DWORD  nLength,
                    280:     COORD  dwWriteCoord,
                    281:     LPDWORD lpNumberOfAttrsWritten
                    282:     );
                    283: 
                    284: BOOL
                    285: APIENTRY
                    286: GetConsoleMode(
                    287:     HANDLE hConsoleHandle,
                    288:     LPDWORD lpMode
                    289:     );
                    290: 
                    291: BOOL
                    292: APIENTRY
                    293: GetNumberOfConsoleInputEvents(
                    294:     HANDLE hConsoleInput,
                    295:     LPDWORD lpNumberOfEvents
                    296:     );
                    297: 
                    298: BOOL
                    299: APIENTRY
                    300: GetConsoleScreenBufferInfo(
                    301:     HANDLE hConsoleOutput,
                    302:     PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
                    303:     );
                    304: 
                    305: COORD
                    306: APIENTRY
                    307: GetLargestConsoleWindowSize(
                    308:     HANDLE hConsoleOutput
                    309:     );
                    310: 
                    311: BOOL
                    312: APIENTRY
                    313: GetConsoleCursorInfo(
                    314:     HANDLE hConsoleOutput,
                    315:     PCONSOLE_CURSOR_INFO lpConsoleCursorInfo
                    316:     );
                    317: 
                    318: BOOL
                    319: APIENTRY
                    320: GetNumberOfConsoleMouseButtons(
                    321:     LPDWORD lpNumberOfMouseButtons
                    322:     );
                    323: 
                    324: BOOL
                    325: APIENTRY
                    326: SetConsoleMode(
                    327:     HANDLE hConsoleHandle,
                    328:     DWORD dwMode
                    329:     );
                    330: 
                    331: BOOL
                    332: APIENTRY
                    333: SetConsoleActiveScreenBuffer(
                    334:     HANDLE hConsoleOutput
                    335:     );
                    336: 
                    337: BOOL
                    338: APIENTRY
                    339: FlushConsoleInputBuffer(
                    340:     HANDLE hConsoleInput
                    341:     );
                    342: 
                    343: BOOL
                    344: APIENTRY
                    345: SetConsoleScreenBufferSize(
                    346:     HANDLE hConsoleOutput,
                    347:     COORD dwSize
                    348:     );
                    349: 
                    350: BOOL
                    351: APIENTRY
                    352: SetConsoleCursorPosition(
                    353:     HANDLE hConsoleOutput,
                    354:     COORD dwCursorPosition
                    355:     );
                    356: 
                    357: BOOL
                    358: APIENTRY
                    359: SetConsoleCursorInfo(
                    360:     HANDLE hConsoleOutput,
                    361:     PCONSOLE_CURSOR_INFO lpConsoleCursorInfo
                    362:     );
                    363: 
                    364: BOOL
                    365: APIENTRY
                    366: ScrollConsoleScreenBuffer(
                    367:     HANDLE hConsoleOutput,
                    368:     PSMALL_RECT lpScrollRectangle,
                    369:     PSMALL_RECT lpClipRectangle,
                    370:     COORD dwDestinationOrigin,
                    371:     PCHAR_INFO lpFill
                    372:     );
                    373: 
                    374: BOOL
                    375: APIENTRY
                    376: SetConsoleWindowInfo(
                    377:     HANDLE hConsoleOutput,
                    378:     BOOL bAbsolute,
                    379:     PSMALL_RECT lpConsoleWindow
                    380:     );
                    381: 
                    382: BOOL
                    383: APIENTRY
                    384: SetConsoleTextAttribute(
                    385:     HANDLE hConsoleOutput,
                    386:     WORD wAttributes
                    387:     );
                    388: 
                    389: BOOL
                    390: APIENTRY
                    391: SetConsoleCtrlHandler(
                    392:     IN PHANDLER_ROUTINE HandlerRoutine,
                    393:     IN BOOL Add
                    394:     );
                    395:     
                    396: BOOL
                    397: APIENTRY
                    398: AllocConsole( VOID );
                    399: 
                    400: BOOL
                    401: APIENTRY
                    402: FreeConsole( VOID );
                    403: 
                    404: 
                    405: DWORD
                    406: APIENTRY
                    407: GetConsoleTitle(
                    408:     LPSTR lpConsoleTitle,
                    409:     DWORD nSize
                    410:     );
                    411: 
                    412: BOOL
                    413: APIENTRY
                    414: SetConsoleTitle(
                    415:     LPSTR lpConsoleTitle
                    416:     );
                    417: 
                    418: #define CONSOLE_TEXTMODE_BUFFER  1
                    419: 
                    420: HANDLE
                    421: APIENTRY
                    422: CreateConsoleScreenBuffer(
                    423:     DWORD dwDesiredAccess,
                    424:     DWORD dwShareMode,
                    425:     LPSECURITY_ATTRIBUTES lpSecurityAttributes,
                    426:     IN DWORD dwFlags,
                    427:     IN PVOID lpScreenBufferData OPTIONAL
                    428:     );
                    429: 
                    430: #endif // _WINCON_

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.