kernel32/tests: Don't close the stop_event handle.
[wine.git] / include / wincon.h
blob8f4d54cc0e35c61285c244d8dd18de9209c544b1
1 /*
2 * Copyright (C) the Wine project
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_WINCON_H
20 #define __WINE_WINCON_H
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
26 #ifndef NOGDI
27 #include <wingdi.h>
28 #endif
30 /* AttachConsole special pid value */
31 #define ATTACH_PARENT_PROCESS ((DWORD) -1)
33 /* GetConsoleDisplayMode flags */
34 #define CONSOLE_FULLSCREEN 1
35 #define CONSOLE_FULLSCREEN_HARDWARE 2
37 /* SetConsoleDisplayMode flags */
38 #define CONSOLE_FULLSCREEN_MODE 1
39 #define CONSOLE_WINDOWED_MODE 2
41 /* CONSOLE_SELECTION_INFO.dwFlags */
42 #define CONSOLE_NO_SELECTION 0x00
43 #define CONSOLE_SELECTION_IN_PROGRESS 0x01
44 #define CONSOLE_SELECTION_NOT_EMPTY 0x02
45 #define CONSOLE_MOUSE_SELECTION 0x04
46 #define CONSOLE_MOUSE_DOWN 0x08
48 /* handler routine control signal type */
49 #define CTRL_C_EVENT 0
50 #define CTRL_BREAK_EVENT 1
51 #define CTRL_CLOSE_EVENT 2
52 #define CTRL_LOGOFF_EVENT 5
53 #define CTRL_SHUTDOWN_EVENT 6
55 /* Console Mode flags */
56 #define ENABLE_PROCESSED_INPUT 0x0001
57 #define ENABLE_LINE_INPUT 0x0002
58 #define ENABLE_ECHO_INPUT 0x0004
59 #define ENABLE_WINDOW_INPUT 0x0008
60 #define ENABLE_MOUSE_INPUT 0x0010
61 #define ENABLE_INSERT_MODE 0x0020
62 #define ENABLE_QUICK_EDIT_MODE 0x0040
63 #define ENABLE_EXTENDED_FLAGS 0x0080
64 #define ENABLE_AUTO_POSITION 0x0100
66 #define ENABLE_PROCESSED_OUTPUT 0x01
67 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
70 typedef BOOL (WINAPI *PHANDLER_ROUTINE)(DWORD dwCtrlType);
72 /* Attributes flags: */
74 #define FOREGROUND_BLUE 0x0001
75 #define FOREGROUND_GREEN 0x0002
76 #define FOREGROUND_RED 0x0004
77 #define FOREGROUND_INTENSITY 0x0008
78 #define BACKGROUND_BLUE 0x0010
79 #define BACKGROUND_GREEN 0x0020
80 #define BACKGROUND_RED 0x0040
81 #define BACKGROUND_INTENSITY 0x0080
82 #define COMMON_LVB_LEADING_BYTE 0x0100
83 #define COMMON_LVB_TRAILING_BYTE 0x0200
84 #define COMMON_LVB_GRID_HORIZONTAL 0x0400
85 #define COMMON_LVB_GRID_LVERTICAL 0x0800
86 #define COMMON_LVB_GRID_RVERTICAL 0x1000
87 #define COMMON_LVB_REVERSE_VIDEO 0x4000
88 #define COMMON_LVB_UNDERSCORE 0x8000
90 /* CONSOLE_HISTORY_INFO.dwFlags */
91 #define HISTORY_NO_DUP_FLAG 0x01
93 typedef struct _CONSOLE_CURSOR_INFO {
94 DWORD dwSize; /* Between 1 & 100 for percentage of cell filled */
95 BOOL bVisible; /* Visibility of cursor */
96 } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
98 typedef struct tagCOORD
100 SHORT X;
101 SHORT Y;
102 } COORD, *LPCOORD;
104 typedef struct tagSMALL_RECT
106 SHORT Left;
107 SHORT Top;
108 SHORT Right;
109 SHORT Bottom;
110 } SMALL_RECT,*LPSMALL_RECT;
112 typedef struct _CONSOLE_FONT_INFO
114 DWORD nFont;
115 COORD dwFontSize;
116 } CONSOLE_FONT_INFO,*LPCONSOLE_FONT_INFO;
118 #ifndef NOGDI
119 typedef struct _CONSOLE_FONT_INFOEX
121 ULONG cbSize;
122 DWORD nFont;
123 COORD dwFontSize;
124 UINT FontFamily;
125 UINT FontWeight;
126 WCHAR FaceName[LF_FACESIZE];
127 } CONSOLE_FONT_INFOEX,*LPCONSOLE_FONT_INFOEX;
129 WINBASEAPI BOOL WINAPI GetCurrentConsoleFontEx(HANDLE,BOOL,LPCONSOLE_FONT_INFOEX);
130 WINBASEAPI BOOL WINAPI SetCurrentConsoleFontEx(HANDLE,BOOL,LPCONSOLE_FONT_INFOEX);
131 #endif
133 typedef struct tagCONSOLE_HISTORY_INFO
135 UINT cbSize;
136 UINT HistoryBufferSize;
137 UINT NumberOfHistoryBuffers;
138 DWORD dwFlags;
139 } CONSOLE_HISTORY_INFO,*LPCONSOLE_HISTORY_INFO;
141 typedef struct _CONSOLE_READCONSOLE_CONTROL
143 ULONG nLength;
144 ULONG nInitialChars;
145 ULONG dwCtrlWakeupMask;
146 ULONG dwConsoleKeyState;
147 } CONSOLE_READCONSOLE_CONTROL,*LPCONSOLE_READCONSOLE_CONTROL;
149 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
151 COORD dwSize;
152 COORD dwCursorPosition;
153 WORD wAttributes;
154 SMALL_RECT srWindow;
155 COORD dwMaximumWindowSize;
156 } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO;
158 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX
160 ULONG cbSize;
161 COORD dwSize;
162 COORD dwCursorPosition;
163 WORD wAttributes;
164 SMALL_RECT srWindow;
165 COORD dwMaximumWindowSize;
166 WORD wPopupAttributes;
167 BOOL bFullscreenSupported;
168 COLORREF ColorTable[16];
169 } CONSOLE_SCREEN_BUFFER_INFOEX,*LPCONSOLE_SCREEN_BUFFER_INFOEX;
171 typedef struct _CONSOLE_SELECTION_INFO
173 DWORD dwFlags;
174 COORD dwSelectionAnchor;
175 SMALL_RECT srSelection;
176 } CONSOLE_SELECTION_INFO,*LPCONSOLE_SELECTION_INFO;
178 typedef struct tagCHAR_INFO
180 union
182 WCHAR UnicodeChar;
183 CHAR AsciiChar;
184 } Char;
185 WORD Attributes;
186 } CHAR_INFO,*LPCHAR_INFO;
188 typedef struct tagKEY_EVENT_RECORD
190 BOOL bKeyDown; /* 04 */
191 WORD wRepeatCount; /* 08 */
192 WORD wVirtualKeyCode; /* 0A */
193 WORD wVirtualScanCode; /* 0C */
194 union /* 0E */
196 WCHAR UnicodeChar; /* 0E */
197 CHAR AsciiChar; /* 0E */
198 } uChar;
199 DWORD dwControlKeyState; /* 10 */
200 } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD;
202 /* dwControlKeyState bitmask */
203 #define RIGHT_ALT_PRESSED 0x0001
204 #define LEFT_ALT_PRESSED 0x0002
205 #define RIGHT_CTRL_PRESSED 0x0004
206 #define LEFT_CTRL_PRESSED 0x0008
207 #define SHIFT_PRESSED 0x0010
208 #define NUMLOCK_ON 0x0020
209 #define SCROLLLOCK_ON 0x0040
210 #define CAPSLOCK_ON 0x0080
211 #define ENHANCED_KEY 0x0100
213 typedef struct tagMOUSE_EVENT_RECORD
215 COORD dwMousePosition;
216 DWORD dwButtonState;
217 DWORD dwControlKeyState;
218 DWORD dwEventFlags;
219 } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD;
221 /* MOUSE_EVENT_RECORD.dwButtonState */
222 #define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
223 #define RIGHTMOST_BUTTON_PRESSED 0x0002
224 #define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
225 #define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
226 #define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
228 /* MOUSE_EVENT_RECORD.dwEventFlags */
229 #define MOUSE_MOVED 0x0001
230 #define DOUBLE_CLICK 0x0002
231 #define MOUSE_WHEELED 0x0004
232 #define MOUSE_HWHEELED 0x0008
234 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
236 COORD dwSize;
237 } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD;
239 typedef struct tagMENU_EVENT_RECORD
241 UINT dwCommandId; /* perhaps UINT16 ??? */
242 } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD;
244 typedef struct tagFOCUS_EVENT_RECORD
246 BOOL bSetFocus; /* perhaps BOOL16 ??? */
247 } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD;
249 typedef struct tagINPUT_RECORD
251 WORD EventType; /* 00 */
252 union
254 KEY_EVENT_RECORD KeyEvent;
255 MOUSE_EVENT_RECORD MouseEvent;
256 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
257 MENU_EVENT_RECORD MenuEvent;
258 FOCUS_EVENT_RECORD FocusEvent;
259 } Event;
260 } INPUT_RECORD,*PINPUT_RECORD;
262 /* INPUT_RECORD.wEventType */
263 #define KEY_EVENT 0x01
264 #define MOUSE_EVENT 0x02
265 #define WINDOW_BUFFER_SIZE_EVENT 0x04
266 #define MENU_EVENT 0x08
267 #define FOCUS_EVENT 0x10
269 #define CONSOLE_TEXTMODE_BUFFER 1
271 #ifdef __i386__
272 /* Note: this should return a COORD, but calling convention for returning
273 * structures is different between Windows and gcc on i386. */
275 WINBASEAPI DWORD WINAPI GetConsoleFontSize(HANDLE, DWORD);
276 WINBASEAPI DWORD WINAPI GetLargestConsoleWindowSize(HANDLE);
278 static inline COORD __wine_GetConsoleFontSize_wrapper(HANDLE h, DWORD d)
280 union {
281 COORD c;
282 DWORD dw;
283 } u;
284 u.dw = GetConsoleFontSize(h, d);
285 return u.c;
287 #define GetConsoleFontSize(h, d) __wine_GetConsoleFontSize_wrapper(h, d)
289 static inline COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h)
291 union {
292 COORD c;
293 DWORD dw;
294 } u;
295 u.dw = GetLargestConsoleWindowSize(h);
296 return u.c;
298 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
300 #else /* __i386__ */
301 WINBASEAPI COORD WINAPI GetConsoleFontSize(HANDLE, DWORD);
302 WINBASEAPI COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
303 #endif /* __i386__ */
305 WINBASEAPI BOOL WINAPI AddConsoleAliasA(LPSTR,LPSTR,LPSTR);
306 WINBASEAPI BOOL WINAPI AddConsoleAliasW(LPWSTR,LPWSTR,LPWSTR);
307 #define AddConsoleAlias WINELIB_NAME_AW(AddConsoleAlias)
308 WINBASEAPI BOOL WINAPI AllocConsole(VOID);
309 WINBASEAPI BOOL WINAPI AttachConsole(DWORD);
310 WINBASEAPI HANDLE WINAPI CreateConsoleScreenBuffer( DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,LPVOID);
311 WINBASEAPI BOOL WINAPI FillConsoleOutputAttribute( HANDLE,WORD,DWORD,COORD,LPDWORD);
312 WINBASEAPI BOOL WINAPI FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,LPDWORD);
313 WINBASEAPI BOOL WINAPI FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,LPDWORD);
314 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
315 WINBASEAPI BOOL WINAPI FlushConsoleInputBuffer( HANDLE);
316 WINBASEAPI BOOL WINAPI FreeConsole(VOID);
317 WINBASEAPI BOOL WINAPI GenerateConsoleCtrlEvent( DWORD,DWORD);
318 WINBASEAPI DWORD WINAPI GetConsoleAliasA(LPSTR,LPSTR,DWORD,LPSTR);
319 WINBASEAPI DWORD WINAPI GetConsoleAliasW(LPWSTR,LPWSTR,DWORD,LPWSTR);
320 #define GetConsoleAlias WINELIB_NAME_AW(GetConsoleAlias)
321 WINBASEAPI DWORD WINAPI GetConsoleAliasesA(LPSTR,DWORD,LPSTR);
322 WINBASEAPI DWORD WINAPI GetConsoleAliasesW(LPWSTR,DWORD,LPWSTR);
323 #define GetConsoleAliases WINELIB_NAME_AW(GetConsoleAliases)
324 WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthA(LPSTR);
325 WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR);
326 #define GetConsoleAliasesLength WINELIB_NAME_AW(GetConsoleAliasesLength)
327 WINBASEAPI DWORD WINAPI GetConsoleAliasExesA(LPSTR,DWORD);
328 WINBASEAPI DWORD WINAPI GetConsoleAliasExesW(LPWSTR,DWORD);
329 #define GetConsoleAliasExes WINELIB_NAME_AW(GetConsoleAliasExes)
330 WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthA(VOID);
331 WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthW(VOID);
332 #define GetConsoleAliasExesLength WINELIB_NAME_AW(GetConsoleAliasExesLength)
333 WINBASEAPI UINT WINAPI GetConsoleCP(VOID);
334 WINBASEAPI BOOL WINAPI GetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
335 WINBASEAPI BOOL WINAPI GetConsoleDisplayMode(LPDWORD);
336 WINBASEAPI BOOL WINAPI GetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO);
337 WINBASEAPI BOOL WINAPI GetConsoleInputExeNameA(DWORD,LPSTR);
338 WINBASEAPI BOOL WINAPI GetConsoleInputExeNameW(DWORD,LPWSTR);
339 #define GetConsoleInputExeName WINELIB_NAME_AW(GetConsoleInputExeName)
340 WINBASEAPI BOOL WINAPI GetConsoleMode( HANDLE,LPDWORD);
341 WINBASEAPI DWORD WINAPI GetConsoleOriginalTitleA(LPSTR,DWORD);
342 WINBASEAPI DWORD WINAPI GetConsoleOriginalTitleW(LPWSTR,DWORD);
343 #define GetConsoleOriginalTitle WINELIB_NAME_AW(GetConsoleOriginalTitle)
344 WINBASEAPI UINT WINAPI GetConsoleOutputCP(VOID);
345 WINBASEAPI DWORD WINAPI GetConsoleProcessList(LPDWORD,DWORD);
346 WINBASEAPI BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFO);
347 WINBASEAPI BOOL WINAPI GetConsoleScreenBufferInfoEx(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFOEX);
348 WINBASEAPI DWORD WINAPI GetConsoleTitleA(LPSTR,DWORD);
349 WINBASEAPI DWORD WINAPI GetConsoleTitleW(LPWSTR,DWORD);
350 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
351 WINBASEAPI HWND WINAPI GetConsoleWindow(void);
352 WINBASEAPI BOOL WINAPI GetCurrentConsoleFont(HANDLE,BOOL,LPCONSOLE_FONT_INFO);
353 WINBASEAPI BOOL WINAPI GetNumberOfConsoleInputEvents( HANDLE,LPDWORD);
354 WINBASEAPI BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
355 WINBASEAPI BOOL WINAPI PeekConsoleInputA( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
356 WINBASEAPI BOOL WINAPI PeekConsoleInputW( HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
357 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
358 WINBASEAPI BOOL WINAPI ReadConsoleA(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
359 WINBASEAPI BOOL WINAPI ReadConsoleW(HANDLE,LPVOID,DWORD,LPDWORD,LPVOID);
360 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
361 WINBASEAPI BOOL WINAPI ReadConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
362 WINBASEAPI BOOL WINAPI ReadConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,LPDWORD);
363 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
364 WINBASEAPI BOOL WINAPI ReadConsoleOutputA( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
365 WINBASEAPI BOOL WINAPI ReadConsoleOutputW( HANDLE,LPCHAR_INFO,COORD,COORD,LPSMALL_RECT);
366 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
367 WINBASEAPI BOOL WINAPI ReadConsoleOutputAttribute( HANDLE,LPWORD,DWORD,COORD,LPDWORD);
368 WINBASEAPI BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
369 WINBASEAPI BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
370 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
371 WINBASEAPI BOOL WINAPI ScrollConsoleScreenBufferA( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
372 WINBASEAPI BOOL WINAPI ScrollConsoleScreenBufferW( HANDLE,LPSMALL_RECT,LPSMALL_RECT,COORD,LPCHAR_INFO);
373 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
374 WINBASEAPI BOOL WINAPI SetConsoleActiveScreenBuffer( HANDLE);
375 WINBASEAPI BOOL WINAPI SetConsoleCP(UINT);
376 WINBASEAPI BOOL WINAPI SetConsoleCtrlHandler( PHANDLER_ROUTINE,BOOL);
377 WINBASEAPI BOOL WINAPI SetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO);
378 WINBASEAPI BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
379 WINBASEAPI BOOL WINAPI SetConsoleDisplayMode(HANDLE,DWORD,LPCOORD);
380 WINBASEAPI BOOL WINAPI SetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO);
381 WINBASEAPI BOOL WINAPI SetConsoleMode( HANDLE,DWORD);
382 WINBASEAPI BOOL WINAPI SetConsoleOutputCP(UINT);
383 WINBASEAPI BOOL WINAPI SetConsoleScreenBufferInfoEx(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFOEX);
384 WINBASEAPI BOOL WINAPI SetConsoleScreenBufferSize(HANDLE,COORD);
385 WINBASEAPI BOOL WINAPI SetConsoleTextAttribute( HANDLE,WORD);
386 WINBASEAPI BOOL WINAPI SetConsoleTitleA(LPCSTR);
387 WINBASEAPI BOOL WINAPI SetConsoleTitleW(LPCWSTR);
388 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
389 WINBASEAPI BOOL WINAPI SetConsoleWindowInfo( HANDLE,BOOL,LPSMALL_RECT);
390 WINBASEAPI BOOL WINAPI WriteConsoleA(HANDLE,const void *,DWORD,LPDWORD,void *);
391 WINBASEAPI BOOL WINAPI WriteConsoleW(HANDLE,const void *,DWORD,LPDWORD,void *);
392 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
393 WINBASEAPI BOOL WINAPI WriteConsoleInputA(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
394 WINBASEAPI BOOL WINAPI WriteConsoleInputW(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
395 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
396 WINBASEAPI BOOL WINAPI WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
397 WINBASEAPI BOOL WINAPI WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
398 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
399 WINBASEAPI BOOL WINAPI WriteConsoleOutputAttribute(HANDLE,const WORD *,DWORD,COORD,LPDWORD);
400 WINBASEAPI BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD);
401 WINBASEAPI BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD);
402 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
404 #ifdef __cplusplus
406 #endif
408 #endif /* __WINE_WINCON_H */