1 #ifndef __WINE_WINCON_H
2 #define __WINE_WINCON_H
5 #define CTRL_BREAK_EVENT 1
6 #define CTRL_CLOSE_EVENT 2
7 #define CTRL_LOGOFF_EVENT 5
8 #define CTRL_SHUTDOWN_EVENT 6
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
17 #define ENABLE_PROCESSED_OUTPUT 0x01
18 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
21 typedef BOOL
HANDLER_ROUTINE(WORD
);
23 /* Attributes flags: */
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. */
34 typedef struct _CONSOLE_CURSOR_INFO
{
35 DWORD dwSize
; /* Between 1 & 100 for percentage of cell filled */
36 BOOL bVisible
; /* Visibility of cursor */
37 } CONSOLE_CURSOR_INFO
, *LPCONSOLE_CURSOR_INFO
;
39 typedef struct tagCOORD
45 typedef struct tagSMALL_RECT
51 } SMALL_RECT
,*LPSMALL_RECT
;
53 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
56 COORD dwCursorPosition
;
59 COORD dwMaximumWindowSize
;
60 } CONSOLE_SCREEN_BUFFER_INFO
,*LPCONSOLE_SCREEN_BUFFER_INFO
;
62 typedef struct tagCHAR_INFO
70 } CHAR_INFO
,*LPCHAR_INFO
;
72 typedef struct tagKEY_EVENT_RECORD
74 BOOL bKeyDown
; /* 04 */
75 WORD wRepeatCount
; /* 08 */
76 WORD wVirtualKeyCode
; /* 0A */
77 WORD wVirtualScanCode
; /* 0C */
80 WCHAR UniCodeChar
; /* 0E */
81 CHAR AsciiChar
; /* 0E */
83 DWORD dwControlKeyState
; /* 10 */
84 } KEY_EVENT_RECORD
,*LPKEY_EVENT_RECORD
;
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
97 typedef struct tagMOUSE_EVENT_RECORD
99 COORD dwMousePosition
;
101 DWORD dwControlKeyState
;
103 } MOUSE_EVENT_RECORD
,*LPMOUSE_EVENT_RECORD
;
105 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
108 } WINDOW_BUFFER_SIZE_RECORD
,*LPWINDOW_BUFFER_SIZE_RECORD
;
110 typedef struct tagMENU_EVENT_RECORD
112 UINT dwCommandId
; /* perhaps UINT16 ??? */
113 } MENU_EVENT_RECORD
,*LPMENU_EVENT_RECORD
;
115 typedef struct tagFOCUS_EVENT_RECORD
117 BOOL bSetFocus
; /* perhaps BOOL16 ??? */
118 } FOCUS_EVENT_RECORD
,*LPFOCUS_EVENT_RECORD
;
120 typedef struct tagINPUT_RECORD
122 WORD EventType
; /* 00 */
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
;
131 } INPUT_RECORD
,*LPINPUT_RECORD
;
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
141 /* Note: this should return a COORD, but calling convention for returning
142 * structures is different between Windows and gcc on i386. */
143 DWORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
145 inline static COORD
__wine_GetLargestConsoleWindowSize_wrapper(HANDLE h
)
147 DWORD dw
= GetLargestConsoleWindowSize(h
);
148 return *(COORD
*)&dw
;
150 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
153 COORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
154 #endif /* __i386__ */
156 BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE
,LPSTR
,DWORD
,COORD
,LPDWORD
);
157 BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE
,LPWSTR
,DWORD
,COORD
,LPDWORD
);
158 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
159 BOOL WINAPI
SetConsoleCursorPosition(HANDLE
,COORD
);
161 BOOL WINAPI
WriteConsoleOutputA( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
, COORD dwBufferCoord
, LPSMALL_RECT lpWriteRegion
);
162 BOOL WINAPI
WriteConsoleOutputW( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
, COORD dwBufferCoord
, LPSMALL_RECT lpWriteRegion
);
163 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
164 BOOL WINAPI
WriteConsoleInputA( HANDLE handle
, INPUT_RECORD
*buffer
,
165 DWORD count
, LPDWORD written
);
166 BOOL WINAPI
WriteConsoleInputW( HANDLE handle
, INPUT_RECORD
*buffer
,
167 DWORD count
, LPDWORD written
);
168 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
169 BOOL WINAPI
PeekConsoleInputA( HANDLE handle
, LPINPUT_RECORD buffer
,
170 DWORD count
, LPDWORD read
);
171 BOOL WINAPI
PeekConsoleInputW( HANDLE handle
, LPINPUT_RECORD buffer
,
172 DWORD count
, LPDWORD read
);
173 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
174 BOOL WINAPI
ReadConsoleA( HANDLE hConsoleInput
, LPVOID lpBuffer
,
175 DWORD nNumberOfCharsToRead
,
176 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
177 BOOL WINAPI
ReadConsoleW( HANDLE hConsoleInput
, LPVOID lpBuffer
,
178 DWORD nNumberOfCharsToRead
,
179 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
180 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
181 BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput
,
182 LPINPUT_RECORD lpBuffer
, DWORD nLength
,
183 LPDWORD lpNumberOfEventsRead
);
184 BOOL WINAPI
ReadConsoleInputW(HANDLE hConsoleInput
,
185 LPINPUT_RECORD lpBuffer
, DWORD nLength
,
186 LPDWORD lpNumberOfEventsRead
);
187 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
189 BOOL WINAPI
GetConsoleScreenBufferInfo(HANDLE hConsoleOutput
,
190 LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
);
191 BOOL WINAPI
SetConsoleScreenBufferSize(HANDLE hConsoleOutput
,
194 #endif /* __WINE_WINCON_H */