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
;
130 typedef struct tagCONSOLE_HISTORY_INFO
133 UINT HistoryBufferSize
;
134 UINT NumberOfHistoryBuffers
;
136 } CONSOLE_HISTORY_INFO
,*LPCONSOLE_HISTORY_INFO
;
138 typedef struct _CONSOLE_READCONSOLE_CONTROL
142 ULONG dwCtrlWakeupMask
;
143 ULONG dwConsoleKeyState
;
144 } CONSOLE_READCONSOLE_CONTROL
,*LPCONSOLE_READCONSOLE_CONTROL
;
146 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
149 COORD dwCursorPosition
;
152 COORD dwMaximumWindowSize
;
153 } CONSOLE_SCREEN_BUFFER_INFO
,*LPCONSOLE_SCREEN_BUFFER_INFO
;
155 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX
159 COORD dwCursorPosition
;
162 COORD dwMaximumWindowSize
;
163 WORD wPopupAttributes
;
164 BOOL bFullscreenSupported
;
165 COLORREF ColorTable
[16];
166 } CONSOLE_SCREEN_BUFFER_INFOEX
,*LPCONSOLE_SCREEN_BUFFER_INFOEX
;
168 typedef struct _CONSOLE_SELECTION_INFO
171 COORD dwSelectionAnchor
;
172 SMALL_RECT srSelection
;
173 } CONSOLE_SELECTION_INFO
,*LPCONSOLE_SELECTION_INFO
;
175 typedef struct tagCHAR_INFO
183 } CHAR_INFO
,*LPCHAR_INFO
;
185 typedef struct tagKEY_EVENT_RECORD
187 BOOL bKeyDown
; /* 04 */
188 WORD wRepeatCount
; /* 08 */
189 WORD wVirtualKeyCode
; /* 0A */
190 WORD wVirtualScanCode
; /* 0C */
193 WCHAR UnicodeChar
; /* 0E */
194 CHAR AsciiChar
; /* 0E */
196 DWORD dwControlKeyState
; /* 10 */
197 } KEY_EVENT_RECORD
,*LPKEY_EVENT_RECORD
;
199 /* dwControlKeyState bitmask */
200 #define RIGHT_ALT_PRESSED 0x0001
201 #define LEFT_ALT_PRESSED 0x0002
202 #define RIGHT_CTRL_PRESSED 0x0004
203 #define LEFT_CTRL_PRESSED 0x0008
204 #define SHIFT_PRESSED 0x0010
205 #define NUMLOCK_ON 0x0020
206 #define SCROLLLOCK_ON 0x0040
207 #define CAPSLOCK_ON 0x0080
208 #define ENHANCED_KEY 0x0100
210 typedef struct tagMOUSE_EVENT_RECORD
212 COORD dwMousePosition
;
214 DWORD dwControlKeyState
;
216 } MOUSE_EVENT_RECORD
,*LPMOUSE_EVENT_RECORD
;
218 /* MOUSE_EVENT_RECORD.dwButtonState */
219 #define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
220 #define RIGHTMOST_BUTTON_PRESSED 0x0002
221 #define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
222 #define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
223 #define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
225 /* MOUSE_EVENT_RECORD.dwEventFlags */
226 #define MOUSE_MOVED 0x0001
227 #define DOUBLE_CLICK 0x0002
228 #define MOUSE_WHEELED 0x0004
229 #define MOUSE_HWHEELED 0x0008
231 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
234 } WINDOW_BUFFER_SIZE_RECORD
,*LPWINDOW_BUFFER_SIZE_RECORD
;
236 typedef struct tagMENU_EVENT_RECORD
238 UINT dwCommandId
; /* perhaps UINT16 ??? */
239 } MENU_EVENT_RECORD
,*LPMENU_EVENT_RECORD
;
241 typedef struct tagFOCUS_EVENT_RECORD
243 BOOL bSetFocus
; /* perhaps BOOL16 ??? */
244 } FOCUS_EVENT_RECORD
,*LPFOCUS_EVENT_RECORD
;
246 typedef struct tagINPUT_RECORD
248 WORD EventType
; /* 00 */
251 KEY_EVENT_RECORD KeyEvent
;
252 MOUSE_EVENT_RECORD MouseEvent
;
253 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
;
254 MENU_EVENT_RECORD MenuEvent
;
255 FOCUS_EVENT_RECORD FocusEvent
;
257 } INPUT_RECORD
,*PINPUT_RECORD
;
259 /* INPUT_RECORD.wEventType */
260 #define KEY_EVENT 0x01
261 #define MOUSE_EVENT 0x02
262 #define WINDOW_BUFFER_SIZE_EVENT 0x04
263 #define MENU_EVENT 0x08
264 #define FOCUS_EVENT 0x10
266 #define CONSOLE_TEXTMODE_BUFFER 1
269 /* Note: this should return a COORD, but calling convention for returning
270 * structures is different between Windows and gcc on i386. */
272 WINBASEAPI DWORD WINAPI
GetConsoleFontSize(HANDLE
, DWORD
);
273 WINBASEAPI DWORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
275 static inline COORD
__wine_GetConsoleFontSize_wrapper(HANDLE h
, DWORD d
)
281 u
.dw
= GetConsoleFontSize(h
, d
);
284 #define GetConsoleFontSize(h, d) __wine_GetConsoleFontSize_wrapper(h, d)
286 static inline COORD
__wine_GetLargestConsoleWindowSize_wrapper(HANDLE h
)
292 u
.dw
= GetLargestConsoleWindowSize(h
);
295 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
298 WINBASEAPI COORD WINAPI
GetConsoleFontSize(HANDLE
, DWORD
);
299 WINBASEAPI COORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
300 #endif /* __i386__ */
302 WINBASEAPI BOOL WINAPI
AddConsoleAliasA(LPSTR
,LPSTR
,LPSTR
);
303 WINBASEAPI BOOL WINAPI
AddConsoleAliasW(LPWSTR
,LPWSTR
,LPWSTR
);
304 #define AddConsoleAlias WINELIB_NAME_AW(AddConsoleAlias)
305 WINBASEAPI BOOL WINAPI
AllocConsole(VOID
);
306 WINBASEAPI BOOL WINAPI
AttachConsole(DWORD
);
307 WINBASEAPI HANDLE WINAPI
CreateConsoleScreenBuffer( DWORD
,DWORD
,LPSECURITY_ATTRIBUTES
,DWORD
,LPVOID
);
308 WINBASEAPI BOOL WINAPI
FillConsoleOutputAttribute( HANDLE
,WORD
,DWORD
,COORD
,LPDWORD
);
309 WINBASEAPI BOOL WINAPI
FillConsoleOutputCharacterA(HANDLE
,CHAR
,DWORD
,COORD
,LPDWORD
);
310 WINBASEAPI BOOL WINAPI
FillConsoleOutputCharacterW(HANDLE
,WCHAR
,DWORD
,COORD
,LPDWORD
);
311 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
312 WINBASEAPI BOOL WINAPI
FlushConsoleInputBuffer( HANDLE
);
313 WINBASEAPI BOOL WINAPI
FreeConsole(VOID
);
314 WINBASEAPI BOOL WINAPI
GenerateConsoleCtrlEvent( DWORD
,DWORD
);
315 WINBASEAPI DWORD WINAPI
GetConsoleAliasA(LPSTR
,LPSTR
,DWORD
,LPSTR
);
316 WINBASEAPI DWORD WINAPI
GetConsoleAliasW(LPWSTR
,LPWSTR
,DWORD
,LPWSTR
);
317 #define GetConsoleAlias WINELIB_NAME_AW(GetConsoleAlias)
318 WINBASEAPI DWORD WINAPI
GetConsoleAliasesA(LPSTR
,DWORD
,LPSTR
);
319 WINBASEAPI DWORD WINAPI
GetConsoleAliasesW(LPWSTR
,DWORD
,LPWSTR
);
320 #define GetConsoleAliases WINELIB_NAME_AW(GetConsoleAliases)
321 WINBASEAPI DWORD WINAPI
GetConsoleAliasesLengthA(LPSTR
);
322 WINBASEAPI DWORD WINAPI
GetConsoleAliasesLengthW(LPWSTR
);
323 #define GetConsoleAliasesLength WINELIB_NAME_AW(GetConsoleAliasesLength)
324 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesA(LPSTR
,DWORD
);
325 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesW(LPWSTR
,DWORD
);
326 #define GetConsoleAliasExes WINELIB_NAME_AW(GetConsoleAliasExes)
327 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesLengthA(VOID
);
328 WINBASEAPI DWORD WINAPI
GetConsoleAliasExesLengthW(VOID
);
329 #define GetConsoleAliasExesLength WINELIB_NAME_AW(GetConsoleAliasExesLength)
330 WINBASEAPI UINT WINAPI
GetConsoleCP(VOID
);
331 WINBASEAPI BOOL WINAPI
GetConsoleCursorInfo( HANDLE
,LPCONSOLE_CURSOR_INFO
);
332 WINBASEAPI BOOL WINAPI
GetConsoleDisplayMode(LPDWORD
);
333 WINBASEAPI BOOL WINAPI
GetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO
);
334 WINBASEAPI BOOL WINAPI
GetConsoleInputExeNameA(DWORD
,LPSTR
);
335 WINBASEAPI BOOL WINAPI
GetConsoleInputExeNameW(DWORD
,LPWSTR
);
336 #define GetConsoleInputExeName WINELIB_NAME_AW(GetConsoleInputExeName)
337 WINBASEAPI BOOL WINAPI
GetConsoleMode( HANDLE
,LPDWORD
);
338 WINBASEAPI DWORD WINAPI
GetConsoleOriginalTitleA(LPSTR
,DWORD
);
339 WINBASEAPI DWORD WINAPI
GetConsoleOriginalTitleW(LPWSTR
,DWORD
);
340 #define GetConsoleOriginalTitle WINELIB_NAME_AW(GetConsoleOriginalTitle)
341 WINBASEAPI UINT WINAPI
GetConsoleOutputCP(VOID
);
342 WINBASEAPI DWORD WINAPI
GetConsoleProcessList(LPDWORD
,DWORD
);
343 WINBASEAPI BOOL WINAPI
GetConsoleScreenBufferInfo(HANDLE
,LPCONSOLE_SCREEN_BUFFER_INFO
);
344 WINBASEAPI BOOL WINAPI
GetConsoleScreenBufferInfoEx(HANDLE
,LPCONSOLE_SCREEN_BUFFER_INFOEX
);
345 WINBASEAPI DWORD WINAPI
GetConsoleTitleA(LPSTR
,DWORD
);
346 WINBASEAPI DWORD WINAPI
GetConsoleTitleW(LPWSTR
,DWORD
);
347 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
348 WINBASEAPI HWND WINAPI
GetConsoleWindow(void);
349 WINBASEAPI BOOL WINAPI
GetCurrentConsoleFont(HANDLE
,BOOL
,LPCONSOLE_FONT_INFO
);
350 WINBASEAPI BOOL WINAPI
GetCurrentConsoleFontEx(HANDLE
,BOOL
,LPCONSOLE_FONT_INFOEX
);
351 WINBASEAPI BOOL WINAPI
GetNumberOfConsoleInputEvents( HANDLE
,LPDWORD
);
352 WINBASEAPI BOOL WINAPI
GetNumberOfConsoleMouseButtons(LPDWORD
);
353 WINBASEAPI BOOL WINAPI
PeekConsoleInputA( HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
354 WINBASEAPI BOOL WINAPI
PeekConsoleInputW( HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
355 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
356 WINBASEAPI BOOL WINAPI
ReadConsoleA(HANDLE
,LPVOID
,DWORD
,LPDWORD
,LPVOID
);
357 WINBASEAPI BOOL WINAPI
ReadConsoleW(HANDLE
,LPVOID
,DWORD
,LPDWORD
,LPVOID
);
358 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
359 WINBASEAPI BOOL WINAPI
ReadConsoleInputA(HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
360 WINBASEAPI BOOL WINAPI
ReadConsoleInputW(HANDLE
,PINPUT_RECORD
,DWORD
,LPDWORD
);
361 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
362 WINBASEAPI BOOL WINAPI
ReadConsoleOutputA( HANDLE
,LPCHAR_INFO
,COORD
,COORD
,LPSMALL_RECT
);
363 WINBASEAPI BOOL WINAPI
ReadConsoleOutputW( HANDLE
,LPCHAR_INFO
,COORD
,COORD
,LPSMALL_RECT
);
364 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
365 WINBASEAPI BOOL WINAPI
ReadConsoleOutputAttribute( HANDLE
,LPWORD
,DWORD
,COORD
,LPDWORD
);
366 WINBASEAPI BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE
,LPSTR
,DWORD
,COORD
,LPDWORD
);
367 WINBASEAPI BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE
,LPWSTR
,DWORD
,COORD
,LPDWORD
);
368 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
369 WINBASEAPI BOOL WINAPI
ScrollConsoleScreenBufferA( HANDLE
,LPSMALL_RECT
,LPSMALL_RECT
,COORD
,LPCHAR_INFO
);
370 WINBASEAPI BOOL WINAPI
ScrollConsoleScreenBufferW( HANDLE
,LPSMALL_RECT
,LPSMALL_RECT
,COORD
,LPCHAR_INFO
);
371 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
372 WINBASEAPI BOOL WINAPI
SetConsoleActiveScreenBuffer( HANDLE
);
373 WINBASEAPI BOOL WINAPI
SetConsoleCP(UINT
);
374 WINBASEAPI BOOL WINAPI
SetConsoleCtrlHandler( PHANDLER_ROUTINE
,BOOL
);
375 WINBASEAPI BOOL WINAPI
SetConsoleCursorInfo( HANDLE
,LPCONSOLE_CURSOR_INFO
);
376 WINBASEAPI BOOL WINAPI
SetConsoleCursorPosition(HANDLE
,COORD
);
377 WINBASEAPI BOOL WINAPI
SetConsoleDisplayMode(HANDLE
,DWORD
,LPCOORD
);
378 WINBASEAPI BOOL WINAPI
SetConsoleHistoryInfo(LPCONSOLE_HISTORY_INFO
);
379 WINBASEAPI BOOL WINAPI
SetConsoleMode( HANDLE
,DWORD
);
380 WINBASEAPI BOOL WINAPI
SetConsoleOutputCP(UINT
);
381 WINBASEAPI BOOL WINAPI
SetConsoleScreenBufferInfoEx(HANDLE
,LPCONSOLE_SCREEN_BUFFER_INFOEX
);
382 WINBASEAPI BOOL WINAPI
SetConsoleScreenBufferSize(HANDLE
,COORD
);
383 WINBASEAPI BOOL WINAPI
SetConsoleTextAttribute( HANDLE
,WORD
);
384 WINBASEAPI BOOL WINAPI
SetConsoleTitleA(LPCSTR
);
385 WINBASEAPI BOOL WINAPI
SetConsoleTitleW(LPCWSTR
);
386 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
387 WINBASEAPI BOOL WINAPI
SetConsoleWindowInfo( HANDLE
,BOOL
,LPSMALL_RECT
);
388 WINBASEAPI BOOL WINAPI
SetCurrentConsoleFontEx(HANDLE
,BOOL
,LPCONSOLE_FONT_INFOEX
);
389 WINBASEAPI BOOL WINAPI
WriteConsoleA(HANDLE
,const void *,DWORD
,LPDWORD
,void *);
390 WINBASEAPI BOOL WINAPI
WriteConsoleW(HANDLE
,const void *,DWORD
,LPDWORD
,void *);
391 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
392 WINBASEAPI BOOL WINAPI
WriteConsoleInputA(HANDLE
,const INPUT_RECORD
*,DWORD
,LPDWORD
);
393 WINBASEAPI BOOL WINAPI
WriteConsoleInputW(HANDLE
,const INPUT_RECORD
*,DWORD
,LPDWORD
);
394 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
395 WINBASEAPI BOOL WINAPI
WriteConsoleOutputA(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,LPSMALL_RECT
);
396 WINBASEAPI BOOL WINAPI
WriteConsoleOutputW(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,LPSMALL_RECT
);
397 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
398 WINBASEAPI BOOL WINAPI
WriteConsoleOutputAttribute(HANDLE
,const WORD
*,DWORD
,COORD
,LPDWORD
);
399 WINBASEAPI BOOL WINAPI
WriteConsoleOutputCharacterA(HANDLE
,LPCSTR
,DWORD
,COORD
,LPDWORD
);
400 WINBASEAPI BOOL WINAPI
WriteConsoleOutputCharacterW(HANDLE
,LPCWSTR
,DWORD
,COORD
,LPDWORD
);
401 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
407 #endif /* __WINE_WINCON_H */