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
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
104 typedef struct tagSMALL_RECT
110 } SMALL_RECT
,*LPSMALL_RECT
;
112 typedef struct _CONSOLE_FONT_INFO
116 } CONSOLE_FONT_INFO
,*LPCONSOLE_FONT_INFO
;
119 typedef struct _CONSOLE_FONT_INFOEX
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
);
133 typedef struct tagCONSOLE_HISTORY_INFO
136 UINT HistoryBufferSize
;
137 UINT NumberOfHistoryBuffers
;
139 } CONSOLE_HISTORY_INFO
,*LPCONSOLE_HISTORY_INFO
;
141 typedef struct _CONSOLE_READCONSOLE_CONTROL
145 ULONG dwCtrlWakeupMask
;
146 ULONG dwConsoleKeyState
;
147 } CONSOLE_READCONSOLE_CONTROL
,*LPCONSOLE_READCONSOLE_CONTROL
;
149 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
152 COORD dwCursorPosition
;
155 COORD dwMaximumWindowSize
;
156 } CONSOLE_SCREEN_BUFFER_INFO
,*LPCONSOLE_SCREEN_BUFFER_INFO
;
158 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX
162 COORD dwCursorPosition
;
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
174 COORD dwSelectionAnchor
;
175 SMALL_RECT srSelection
;
176 } CONSOLE_SELECTION_INFO
,*LPCONSOLE_SELECTION_INFO
;
178 typedef struct tagCHAR_INFO
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 */
196 WCHAR UnicodeChar
; /* 0E */
197 CHAR AsciiChar
; /* 0E */
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
;
217 DWORD dwControlKeyState
;
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
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 */
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
;
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 #if defined(__i386__) && !defined(__MINGW32__)
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
)
284 u
.dw
= GetConsoleFontSize(h
, d
);
287 #define GetConsoleFontSize(h, d) __wine_GetConsoleFontSize_wrapper(h, d)
289 static inline COORD
__wine_GetLargestConsoleWindowSize_wrapper(HANDLE h
)
295 u
.dw
= GetLargestConsoleWindowSize(h
);
298 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
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 BOOL WINAPI
CloseConsoleHandle(HANDLE
);
311 WINBASEAPI HANDLE WINAPI
CreateConsoleScreenBuffer(DWORD
,DWORD
,LPSECURITY_ATTRIBUTES
,DWORD
,LPVOID
);
312 WINBASEAPI HANDLE WINAPI
DuplicateConsoleHandle(HANDLE
,DWORD
,BOOL
,DWORD
);
313 WINBASEAPI BOOL WINAPI
FillConsoleOutputAttribute( HANDLE
,WORD
,DWORD
,COORD
,LPDWORD
);
314 WINBASEAPI BOOL WINAPI
FillConsoleOutputCharacterA(HANDLE
,CHAR
,DWORD
,COORD
,LPDWORD
);
315 WINBASEAPI BOOL WINAPI
FillConsoleOutputCharacterW(HANDLE
,WCHAR
,DWORD
,COORD
,LPDWORD
);
316 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
317 WINBASEAPI BOOL WINAPI
FlushConsoleInputBuffer( HANDLE
);
318 WINBASEAPI BOOL WINAPI
FreeConsole(VOID
);
319 WINBASEAPI BOOL WINAPI
GenerateConsoleCtrlEvent( DWORD
,DWORD
);
320 WINBASEAPI DWORD WINAPI
GetConsoleAliasA(LPSTR
,LPSTR
,DWORD
,LPSTR
);
321 WINBASEAPI DWORD WINAPI
GetConsoleAliasW(LPWSTR
,LPWSTR
,DWORD
,LPWSTR
);
322 #define GetConsoleAlias WINELIB_NAME_AW(GetConsoleAlias)
323 WINBASEAPI DWORD WINAPI
GetConsoleAliasesA(LPSTR
,DWORD
,LPSTR
);
324 WINBASEAPI DWORD WINAPI
GetConsoleAliasesW(LPWSTR
,DWORD
,LPWSTR
);
325 #define GetConsoleAliases WINELIB_NAME_AW(GetConsoleAliases)
326 WINBASEAPI DWORD WINAPI
GetConsoleAliasesLengthA(LPSTR
);
327 WINBASEAPI DWORD WINAPI
GetConsoleAliasesLengthW(LPWSTR
);
328 #define GetConsoleAliasesLength WINELIB_NAME_AW(GetConsoleAliasesLength)
329 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesA(LPSTR
,DWORD
);
330 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesW(LPWSTR
,DWORD
);
331 #define GetConsoleAliasExes WINELIB_NAME_AW(GetConsoleAliasExes)
332 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesLengthA(VOID
);
333 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesLengthW(VOID
);
334 #define GetConsoleAliasExesLength WINELIB_NAME_AW(GetConsoleAliasExesLength)
335 WINBASEAPI UINT WINAPI
GetConsoleCP(VOID
);
336 WINBASEAPI BOOL WINAPI
GetConsoleCursorInfo( HANDLE
,LPCONSOLE_CURSOR_INFO
);
337 WINBASEAPI BOOL WINAPI
GetConsoleDisplayMode(LPDWORD
);
338 WINBASEAPI BOOL WINAPI
GetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO
);
339 WINBASEAPI BOOL WINAPI
GetConsoleInputExeNameA(DWORD
,LPSTR
);
340 WINBASEAPI BOOL WINAPI
GetConsoleInputExeNameW(DWORD
,LPWSTR
);
341 #define GetConsoleInputExeName WINELIB_NAME_AW(GetConsoleInputExeName)
342 WINBASEAPI HANDLE WINAPI
GetConsoleInputWaitHandle(void);
343 WINBASEAPI BOOL WINAPI
GetConsoleMode( HANDLE
,LPDWORD
);
344 WINBASEAPI DWORD WINAPI
GetConsoleOriginalTitleA(LPSTR
,DWORD
);
345 WINBASEAPI DWORD WINAPI
GetConsoleOriginalTitleW(LPWSTR
,DWORD
);
346 #define GetConsoleOriginalTitle WINELIB_NAME_AW(GetConsoleOriginalTitle)
347 WINBASEAPI UINT WINAPI
GetConsoleOutputCP(VOID
);
348 WINBASEAPI DWORD WINAPI
GetConsoleProcessList(LPDWORD
,DWORD
);
349 WINBASEAPI BOOL WINAPI
GetConsoleScreenBufferInfo(HANDLE
,LPCONSOLE_SCREEN_BUFFER_INFO
);
350 WINBASEAPI BOOL WINAPI
GetConsoleScreenBufferInfoEx(HANDLE
,LPCONSOLE_SCREEN_BUFFER_INFOEX
);
351 WINBASEAPI DWORD WINAPI
GetConsoleTitleA(LPSTR
,DWORD
);
352 WINBASEAPI DWORD WINAPI
GetConsoleTitleW(LPWSTR
,DWORD
);
353 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
354 WINBASEAPI HWND WINAPI
GetConsoleWindow(void);
355 WINBASEAPI BOOL WINAPI
GetCurrentConsoleFont(HANDLE
,BOOL
,LPCONSOLE_FONT_INFO
);
356 WINBASEAPI BOOL WINAPI
GetNumberOfConsoleInputEvents( HANDLE
,LPDWORD
);
357 WINBASEAPI BOOL WINAPI
GetNumberOfConsoleMouseButtons(LPDWORD
);
358 WINBASEAPI HANDLE WINAPI
OpenConsoleA(LPCSTR
,DWORD
,BOOL
,DWORD
);
359 WINBASEAPI HANDLE WINAPI
OpenConsoleW(LPCWSTR
,DWORD
,BOOL
,DWORD
);
360 #define OpenConsole WINELIB_NAME_AW(OpenConsole)
361 WINBASEAPI BOOL WINAPI
PeekConsoleInputA( HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
362 WINBASEAPI BOOL WINAPI
PeekConsoleInputW( HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
363 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
364 WINBASEAPI BOOL WINAPI
ReadConsoleA(HANDLE
,LPVOID
,DWORD
,LPDWORD
,LPVOID
);
365 WINBASEAPI BOOL WINAPI
ReadConsoleW(HANDLE
,LPVOID
,DWORD
,LPDWORD
,LPVOID
);
366 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
367 WINBASEAPI BOOL WINAPI
ReadConsoleInputA(HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
368 WINBASEAPI BOOL WINAPI
ReadConsoleInputW(HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
369 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
370 WINBASEAPI BOOL WINAPI
ReadConsoleOutputA( HANDLE
,LPCHAR_INFO
,COORD
,COORD
,LPSMALL_RECT
);
371 WINBASEAPI BOOL WINAPI
ReadConsoleOutputW( HANDLE
,LPCHAR_INFO
,COORD
,COORD
,LPSMALL_RECT
);
372 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
373 WINBASEAPI BOOL WINAPI
ReadConsoleOutputAttribute( HANDLE
,LPWORD
,DWORD
,COORD
,LPDWORD
);
374 WINBASEAPI BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE
,LPSTR
,DWORD
,COORD
,LPDWORD
);
375 WINBASEAPI BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE
,LPWSTR
,DWORD
,COORD
,LPDWORD
);
376 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
377 WINBASEAPI BOOL WINAPI
ScrollConsoleScreenBufferA( HANDLE
,LPSMALL_RECT
,LPSMALL_RECT
,COORD
,LPCHAR_INFO
);
378 WINBASEAPI BOOL WINAPI
ScrollConsoleScreenBufferW( HANDLE
,LPSMALL_RECT
,LPSMALL_RECT
,COORD
,LPCHAR_INFO
);
379 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
380 WINBASEAPI BOOL WINAPI
SetConsoleActiveScreenBuffer( HANDLE
);
381 WINBASEAPI BOOL WINAPI
SetConsoleCP(UINT
);
382 WINBASEAPI BOOL WINAPI
SetConsoleCtrlHandler( PHANDLER_ROUTINE
,BOOL
);
383 WINBASEAPI BOOL WINAPI
SetConsoleCursorInfo( HANDLE
,LPCONSOLE_CURSOR_INFO
);
384 WINBASEAPI BOOL WINAPI
SetConsoleCursorPosition(HANDLE
,COORD
);
385 WINBASEAPI BOOL WINAPI
SetConsoleDisplayMode(HANDLE
,DWORD
,LPCOORD
);
386 WINBASEAPI BOOL WINAPI
SetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO
);
387 WINBASEAPI BOOL WINAPI
SetConsoleMode( HANDLE
,DWORD
);
388 WINBASEAPI BOOL WINAPI
SetConsoleOutputCP(UINT
);
389 WINBASEAPI BOOL WINAPI
SetConsoleScreenBufferInfoEx(HANDLE
,LPCONSOLE_SCREEN_BUFFER_INFOEX
);
390 WINBASEAPI BOOL WINAPI
SetConsoleScreenBufferSize(HANDLE
,COORD
);
391 WINBASEAPI BOOL WINAPI
SetConsoleTextAttribute( HANDLE
,WORD
);
392 WINBASEAPI BOOL WINAPI
SetConsoleTitleA(LPCSTR
);
393 WINBASEAPI BOOL WINAPI
SetConsoleTitleW(LPCWSTR
);
394 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
395 WINBASEAPI BOOL WINAPI
SetConsoleWindowInfo( HANDLE
,BOOL
,LPSMALL_RECT
);
396 WINBASEAPI BOOL WINAPI
VerifyConsoleIoHandle(HANDLE
);
397 WINBASEAPI BOOL WINAPI
WriteConsoleA(HANDLE
,const void *,DWORD
,LPDWORD
,void *);
398 WINBASEAPI BOOL WINAPI
WriteConsoleW(HANDLE
,const void *,DWORD
,LPDWORD
,void *);
399 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
400 WINBASEAPI BOOL WINAPI
WriteConsoleInputA(HANDLE
,const INPUT_RECORD
*,DWORD
,LPDWORD
);
401 WINBASEAPI BOOL WINAPI
WriteConsoleInputW(HANDLE
,const INPUT_RECORD
*,DWORD
,LPDWORD
);
402 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
403 WINBASEAPI BOOL WINAPI
WriteConsoleOutputA(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,LPSMALL_RECT
);
404 WINBASEAPI BOOL WINAPI
WriteConsoleOutputW(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,LPSMALL_RECT
);
405 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
406 WINBASEAPI BOOL WINAPI
WriteConsoleOutputAttribute(HANDLE
,const WORD
*,DWORD
,COORD
,LPDWORD
);
407 WINBASEAPI BOOL WINAPI
WriteConsoleOutputCharacterA(HANDLE
,LPCSTR
,DWORD
,COORD
,LPDWORD
);
408 WINBASEAPI BOOL WINAPI
WriteConsoleOutputCharacterW(HANDLE
,LPCWSTR
,DWORD
,COORD
,LPDWORD
);
409 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
415 #endif /* __WINE_WINCON_H */