Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 1 | #ifndef __WINE_WINCON_H |
| 2 | #define __WINE_WINCON_H |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 3 | |
| 4 | #define CTRL_C_EVENT 0 |
| 5 | #define CTRL_BREAK_EVENT 1 |
| 6 | #define CTRL_CLOSE_EVENT 2 |
| 7 | #define CTRL_LOGOFF_EVENT 5 |
| 8 | #define CTRL_SHUTDOWN_EVENT 6 |
| 9 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 10 | /* Console Mode flags */ |
| 11 | #define ENABLE_PROCESSED_INPUT 0x01 |
| 12 | #define ENABLE_LINE_INPUT 0x02 |
| 13 | #define ENABLE_ECHO_INPUT 0x04 |
| 14 | #define ENABLE_WINDOW_INPUT 0x08 |
| 15 | #define ENABLE_MOUSE_INPUT 0x10 |
| 16 | |
| 17 | #define ENABLE_PROCESSED_OUTPUT 0x01 |
| 18 | #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02 |
| 19 | |
| 20 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 21 | typedef BOOL HANDLER_ROUTINE(WORD); |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 22 | |
Alexandre Julliard | b1bac32 | 1996-12-15 19:45:59 +0000 | [diff] [blame] | 23 | /* Attributes flags: */ |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 24 | |
| 25 | #define FOREGROUND_BLUE 0x0001 /* text color contains blue. */ |
| 26 | #define FOREGROUND_GREEN 0x0002 /* text color contains green. */ |
| 27 | #define FOREGROUND_RED 0x0004 /* text color contains red. */ |
| 28 | #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */ |
| 29 | #define BACKGROUND_BLUE 0x0010 /* background color contains blue. */ |
| 30 | #define BACKGROUND_GREEN 0x0020 /* background color contains green. */ |
| 31 | #define BACKGROUND_RED 0x0040 /* background color contains red. */ |
| 32 | #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */ |
| 33 | |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 34 | typedef struct _CONSOLE_CURSOR_INFO { |
| 35 | DWORD dwSize; /* Between 1 & 100 for percentage of cell filled */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 36 | BOOL bVisible; /* Visibility of cursor */ |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 37 | } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO; |
| 38 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 39 | typedef struct tagCOORD |
| 40 | { |
Alexandre Julliard | f818d42 | 2000-05-03 17:48:21 +0000 | [diff] [blame^] | 41 | SHORT X; |
| 42 | SHORT Y; |
| 43 | } COORD, *LPCOORD; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 44 | |
| 45 | typedef struct tagSMALL_RECT |
| 46 | { |
Alexandre Julliard | f818d42 | 2000-05-03 17:48:21 +0000 | [diff] [blame^] | 47 | SHORT Left; |
| 48 | SHORT Top; |
| 49 | SHORT Right; |
| 50 | SHORT Bottom; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 51 | } SMALL_RECT,*LPSMALL_RECT; |
| 52 | |
| 53 | typedef struct tagCONSOLE_SCREEN_BUFFER_INFO |
| 54 | { |
| 55 | COORD dwSize; |
| 56 | COORD dwCursorPosition; |
| 57 | WORD wAttributes; |
| 58 | SMALL_RECT srWindow; |
| 59 | COORD dwMaximumWindowSize; |
| 60 | } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO; |
| 61 | |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 62 | typedef struct tagCHAR_INFO |
| 63 | { |
| 64 | union |
| 65 | { |
| 66 | WCHAR UnicodeChar; |
| 67 | CHAR AsciiChar; |
| 68 | } Char; |
| 69 | WORD Attributes; |
| 70 | } CHAR_INFO,*LPCHAR_INFO; |
| 71 | |
| 72 | typedef struct tagKEY_EVENT_RECORD |
| 73 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 74 | BOOL bKeyDown; /* 04 */ |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 75 | WORD wRepeatCount; /* 08 */ |
| 76 | WORD wVirtualKeyCode; /* 0A */ |
| 77 | WORD wVirtualScanCode; /* 0C */ |
| 78 | union /* 0E */ |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 79 | { |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 80 | WCHAR UniCodeChar; /* 0E */ |
| 81 | CHAR AsciiChar; /* 0E */ |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 82 | } uChar; |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 83 | DWORD dwControlKeyState; /* 10 */ |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 84 | } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD; |
| 85 | |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 86 | /* dwControlKeyState bitmask */ |
| 87 | #define RIGHT_ALT_PRESSED 0x0001 |
| 88 | #define LEFT_ALT_PRESSED 0x0002 |
| 89 | #define RIGHT_CTRL_PRESSED 0x0004 |
| 90 | #define LEFT_CTRL_PRESSED 0x0008 |
| 91 | #define SHIFT_PRESSED 0x0010 |
| 92 | #define NUMLOCK_ON 0x0020 |
| 93 | #define SCROLLLOCK_ON 0x0040 |
| 94 | #define CAPSLOCK_ON 0x0080 |
| 95 | #define ENHANCED_KEY 0x0100 |
| 96 | |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 97 | typedef struct tagMOUSE_EVENT_RECORD |
| 98 | { |
| 99 | COORD dwMousePosition; |
| 100 | DWORD dwButtonState; |
| 101 | DWORD dwControlKeyState; |
| 102 | DWORD dwEventFlags; |
| 103 | } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD; |
| 104 | |
| 105 | typedef struct tagWINDOW_BUFFER_SIZE_RECORD |
| 106 | { |
| 107 | COORD dwSize; |
| 108 | } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD; |
| 109 | |
| 110 | typedef struct tagMENU_EVENT_RECORD |
| 111 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 112 | UINT dwCommandId; /* perhaps UINT16 ??? */ |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 113 | } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD; |
| 114 | |
| 115 | typedef struct tagFOCUS_EVENT_RECORD |
| 116 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 117 | BOOL bSetFocus; /* perhaps BOOL16 ??? */ |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 118 | } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD; |
| 119 | |
| 120 | typedef struct tagINPUT_RECORD |
| 121 | { |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 122 | WORD EventType; /* 00 */ |
Alexandre Julliard | 60ce85c | 1998-02-01 18:33:27 +0000 | [diff] [blame] | 123 | union |
| 124 | { |
| 125 | KEY_EVENT_RECORD KeyEvent; |
| 126 | MOUSE_EVENT_RECORD MouseEvent; |
| 127 | WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; |
| 128 | MENU_EVENT_RECORD MenuEvent; |
| 129 | FOCUS_EVENT_RECORD FocusEvent; |
| 130 | } Event; |
| 131 | } INPUT_RECORD,*LPINPUT_RECORD; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 132 | |
Marcus Meissner | 537772a | 1998-12-09 16:37:04 +0000 | [diff] [blame] | 133 | /* INPUT_RECORD.wEventType */ |
| 134 | #define KEY_EVENT 0x01 |
| 135 | #define MOUSE_EVENT 0x02 |
| 136 | #define WINDOW_BUFFER_SIZE_EVENT 0x04 |
| 137 | #define MENU_EVENT 0x08 |
| 138 | #define FOCUS_EVENT 0x10 |
| 139 | |
Alexandre Julliard | f818d42 | 2000-05-03 17:48:21 +0000 | [diff] [blame^] | 140 | COORD WINAPI GetLargestConsoleWindowSize(HANDLE); |
| 141 | BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD); |
| 142 | BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD); |
| 143 | #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter) |
| 144 | BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD); |
| 145 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 146 | BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, LPSMALL_RECT lpWriteRegion); |
| 147 | BOOL WINAPI WriteConsoleOutputW( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, LPSMALL_RECT lpWriteRegion); |
Marcus Meissner | 03479f8 | 1999-01-28 10:06:38 +0000 | [diff] [blame] | 148 | #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 149 | BOOL WINAPI WriteConsoleInputA( HANDLE handle, INPUT_RECORD *buffer, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 150 | DWORD count, LPDWORD written ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 151 | BOOL WINAPI WriteConsoleInputW( HANDLE handle, INPUT_RECORD *buffer, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 152 | DWORD count, LPDWORD written ); |
| 153 | #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 154 | BOOL WINAPI PeekConsoleInputA( HANDLE handle, LPINPUT_RECORD buffer, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 155 | DWORD count, LPDWORD read ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 156 | BOOL WINAPI PeekConsoleInputW( HANDLE handle, LPINPUT_RECORD buffer, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 157 | DWORD count, LPDWORD read ); |
| 158 | #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 159 | BOOL WINAPI ReadConsoleA( HANDLE hConsoleInput, LPVOID lpBuffer, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 160 | DWORD nNumberOfCharsToRead, |
| 161 | LPDWORD lpNumberOfCharsRead, LPVOID lpReserved); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 162 | BOOL WINAPI ReadConsoleW( HANDLE hConsoleInput, LPVOID lpBuffer, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 163 | DWORD nNumberOfCharsToRead, |
| 164 | LPDWORD lpNumberOfCharsRead, LPVOID lpReserved); |
| 165 | #define ReadConsole WINELIB_NAME_AW(ReadConsole) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 166 | BOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 167 | LPINPUT_RECORD lpBuffer, DWORD nLength, |
| 168 | LPDWORD lpNumberOfEventsRead); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 169 | BOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput, |
Marcus Meissner | 69c0bbe | 1999-02-09 14:25:57 +0000 | [diff] [blame] | 170 | LPINPUT_RECORD lpBuffer, DWORD nLength, |
| 171 | LPDWORD lpNumberOfEventsRead); |
| 172 | #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput) |
Marcus Meissner | 03479f8 | 1999-01-28 10:06:38 +0000 | [diff] [blame] | 173 | |
Ove Kaaven | b10e912 | 2000-01-30 02:53:33 +0000 | [diff] [blame] | 174 | BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, |
| 175 | LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); |
Ove Kaaven | b10e912 | 2000-01-30 02:53:33 +0000 | [diff] [blame] | 176 | BOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput, |
| 177 | COORD dwSize); |
| 178 | |
Marcus Meissner | 03479f8 | 1999-01-28 10:06:38 +0000 | [diff] [blame] | 179 | #ifdef __WINE__ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 180 | extern HANDLE CONSOLE_OpenHandle( BOOL output, DWORD access, LPSECURITY_ATTRIBUTES sa ); |
Marcus Meissner | 03479f8 | 1999-01-28 10:06:38 +0000 | [diff] [blame] | 181 | #endif |
| 182 | |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 183 | #endif /* __WINE_WINCON_H */ |