1 #ifndef __WINE_WINCON_H
2 #define __WINE_WINCON_H
4 #include "winbase.h" /* for COORD */
7 #define CTRL_BREAK_EVENT 1
8 #define CTRL_CLOSE_EVENT 2
9 #define CTRL_LOGOFF_EVENT 5
10 #define CTRL_SHUTDOWN_EVENT 6
12 /* Console Mode flags */
13 #define ENABLE_PROCESSED_INPUT 0x01
14 #define ENABLE_LINE_INPUT 0x02
15 #define ENABLE_ECHO_INPUT 0x04
16 #define ENABLE_WINDOW_INPUT 0x08
17 #define ENABLE_MOUSE_INPUT 0x10
19 #define ENABLE_PROCESSED_OUTPUT 0x01
20 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
23 typedef BOOL
HANDLER_ROUTINE(WORD
);
25 /* Attributes flags: */
27 #define FOREGROUND_BLUE 0x0001 /* text color contains blue. */
28 #define FOREGROUND_GREEN 0x0002 /* text color contains green. */
29 #define FOREGROUND_RED 0x0004 /* text color contains red. */
30 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
31 #define BACKGROUND_BLUE 0x0010 /* background color contains blue. */
32 #define BACKGROUND_GREEN 0x0020 /* background color contains green. */
33 #define BACKGROUND_RED 0x0040 /* background color contains red. */
34 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
36 typedef struct _CONSOLE_CURSOR_INFO
{
37 DWORD dwSize
; /* Between 1 & 100 for percentage of cell filled */
38 BOOL bVisible
; /* Visibility of cursor */
39 } CONSOLE_CURSOR_INFO
, *LPCONSOLE_CURSOR_INFO
;
42 typedef struct tagCOORD
49 typedef struct tagSMALL_RECT
55 } SMALL_RECT
,*LPSMALL_RECT
;
57 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
60 COORD dwCursorPosition
;
63 COORD dwMaximumWindowSize
;
64 } CONSOLE_SCREEN_BUFFER_INFO
,*LPCONSOLE_SCREEN_BUFFER_INFO
;
66 typedef struct tagCHAR_INFO
74 } CHAR_INFO
,*LPCHAR_INFO
;
76 typedef struct tagKEY_EVENT_RECORD
78 BOOL bKeyDown
; /* 04 */
79 WORD wRepeatCount
; /* 08 */
80 WORD wVirtualKeyCode
; /* 0A */
81 WORD wVirtualScanCode
; /* 0C */
84 WCHAR UniCodeChar
; /* 0E */
85 CHAR AsciiChar
; /* 0E */
87 DWORD dwControlKeyState
; /* 10 */
88 } KEY_EVENT_RECORD
,*LPKEY_EVENT_RECORD
;
90 /* dwControlKeyState bitmask */
91 #define RIGHT_ALT_PRESSED 0x0001
92 #define LEFT_ALT_PRESSED 0x0002
93 #define RIGHT_CTRL_PRESSED 0x0004
94 #define LEFT_CTRL_PRESSED 0x0008
95 #define SHIFT_PRESSED 0x0010
96 #define NUMLOCK_ON 0x0020
97 #define SCROLLLOCK_ON 0x0040
98 #define CAPSLOCK_ON 0x0080
99 #define ENHANCED_KEY 0x0100
101 typedef struct tagMOUSE_EVENT_RECORD
103 COORD dwMousePosition
;
105 DWORD dwControlKeyState
;
107 } MOUSE_EVENT_RECORD
,*LPMOUSE_EVENT_RECORD
;
109 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
112 } WINDOW_BUFFER_SIZE_RECORD
,*LPWINDOW_BUFFER_SIZE_RECORD
;
114 typedef struct tagMENU_EVENT_RECORD
116 UINT dwCommandId
; /* perhaps UINT16 ??? */
117 } MENU_EVENT_RECORD
,*LPMENU_EVENT_RECORD
;
119 typedef struct tagFOCUS_EVENT_RECORD
121 BOOL bSetFocus
; /* perhaps BOOL16 ??? */
122 } FOCUS_EVENT_RECORD
,*LPFOCUS_EVENT_RECORD
;
124 typedef struct tagINPUT_RECORD
126 WORD EventType
; /* 00 */
129 KEY_EVENT_RECORD KeyEvent
;
130 MOUSE_EVENT_RECORD MouseEvent
;
131 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
;
132 MENU_EVENT_RECORD MenuEvent
;
133 FOCUS_EVENT_RECORD FocusEvent
;
135 } INPUT_RECORD
,*LPINPUT_RECORD
;
137 /* INPUT_RECORD.wEventType */
138 #define KEY_EVENT 0x01
139 #define MOUSE_EVENT 0x02
140 #define WINDOW_BUFFER_SIZE_EVENT 0x04
141 #define MENU_EVENT 0x08
142 #define FOCUS_EVENT 0x10
144 BOOL WINAPI
WriteConsoleOutputA( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
, COORD dwBufferCoord
, LPSMALL_RECT lpWriteRegion
);
145 BOOL WINAPI
WriteConsoleOutputW( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
, COORD dwBufferCoord
, LPSMALL_RECT lpWriteRegion
);
146 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
147 BOOL WINAPI
WriteConsoleInputA( HANDLE handle
, INPUT_RECORD
*buffer
,
148 DWORD count
, LPDWORD written
);
149 BOOL WINAPI
WriteConsoleInputW( HANDLE handle
, INPUT_RECORD
*buffer
,
150 DWORD count
, LPDWORD written
);
151 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
152 BOOL WINAPI
PeekConsoleInputA( HANDLE handle
, LPINPUT_RECORD buffer
,
153 DWORD count
, LPDWORD read
);
154 BOOL WINAPI
PeekConsoleInputW( HANDLE handle
, LPINPUT_RECORD buffer
,
155 DWORD count
, LPDWORD read
);
156 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
157 BOOL WINAPI
ReadConsoleA( HANDLE hConsoleInput
, LPVOID lpBuffer
,
158 DWORD nNumberOfCharsToRead
,
159 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
160 BOOL WINAPI
ReadConsoleW( HANDLE hConsoleInput
, LPVOID lpBuffer
,
161 DWORD nNumberOfCharsToRead
,
162 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
163 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
164 BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput
,
165 LPINPUT_RECORD lpBuffer
, DWORD nLength
,
166 LPDWORD lpNumberOfEventsRead
);
167 BOOL WINAPI
ReadConsoleInputW(HANDLE hConsoleInput
,
168 LPINPUT_RECORD lpBuffer
, DWORD nLength
,
169 LPDWORD lpNumberOfEventsRead
);
170 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
173 extern HANDLE
CONSOLE_OpenHandle( BOOL output
, DWORD access
, LPSECURITY_ATTRIBUTES sa
);
176 #endif /* __WINE_WINCON_H */