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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __WINE_WINCON_H
20 #define __WINE_WINCON_H
26 #define CTRL_C_EVENT 0
27 #define CTRL_BREAK_EVENT 1
28 #define CTRL_CLOSE_EVENT 2
29 #define CTRL_LOGOFF_EVENT 5
30 #define CTRL_SHUTDOWN_EVENT 6
32 /* Console Mode flags */
33 #define ENABLE_PROCESSED_INPUT 0x01
34 #define ENABLE_LINE_INPUT 0x02
35 #define ENABLE_ECHO_INPUT 0x04
36 #define ENABLE_WINDOW_INPUT 0x08
37 #define ENABLE_MOUSE_INPUT 0x10
39 #define ENABLE_PROCESSED_OUTPUT 0x01
40 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
43 typedef BOOL (WINAPI
*PHANDLER_ROUTINE
)(DWORD dwCtrlType
);
45 /* Attributes flags: */
47 #define FOREGROUND_BLUE 0x0001 /* text color contains blue. */
48 #define FOREGROUND_GREEN 0x0002 /* text color contains green. */
49 #define FOREGROUND_RED 0x0004 /* text color contains red. */
50 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
51 #define BACKGROUND_BLUE 0x0010 /* background color contains blue. */
52 #define BACKGROUND_GREEN 0x0020 /* background color contains green. */
53 #define BACKGROUND_RED 0x0040 /* background color contains red. */
54 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
56 typedef struct _CONSOLE_CURSOR_INFO
{
57 DWORD dwSize
; /* Between 1 & 100 for percentage of cell filled */
58 BOOL bVisible
; /* Visibility of cursor */
59 } CONSOLE_CURSOR_INFO
, *LPCONSOLE_CURSOR_INFO
;
61 typedef struct tagCOORD
67 typedef struct tagSMALL_RECT
73 } SMALL_RECT
,*LPSMALL_RECT
;
75 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
78 COORD dwCursorPosition
;
81 COORD dwMaximumWindowSize
;
82 } CONSOLE_SCREEN_BUFFER_INFO
,*LPCONSOLE_SCREEN_BUFFER_INFO
;
84 typedef struct tagCHAR_INFO
92 } CHAR_INFO
,*LPCHAR_INFO
;
94 typedef struct tagKEY_EVENT_RECORD
96 BOOL bKeyDown
; /* 04 */
97 WORD wRepeatCount
; /* 08 */
98 WORD wVirtualKeyCode
; /* 0A */
99 WORD wVirtualScanCode
; /* 0C */
102 WCHAR UnicodeChar
; /* 0E */
103 CHAR AsciiChar
; /* 0E */
105 DWORD dwControlKeyState
; /* 10 */
106 } KEY_EVENT_RECORD
,*LPKEY_EVENT_RECORD
;
108 /* dwControlKeyState bitmask */
109 #define RIGHT_ALT_PRESSED 0x0001
110 #define LEFT_ALT_PRESSED 0x0002
111 #define RIGHT_CTRL_PRESSED 0x0004
112 #define LEFT_CTRL_PRESSED 0x0008
113 #define SHIFT_PRESSED 0x0010
114 #define NUMLOCK_ON 0x0020
115 #define SCROLLLOCK_ON 0x0040
116 #define CAPSLOCK_ON 0x0080
117 #define ENHANCED_KEY 0x0100
119 typedef struct tagMOUSE_EVENT_RECORD
121 COORD dwMousePosition
;
123 DWORD dwControlKeyState
;
125 } MOUSE_EVENT_RECORD
,*LPMOUSE_EVENT_RECORD
;
127 #define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
128 #define RIGHTMOST_BUTTON_PRESSED 0x0002
129 #define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
130 #define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
131 #define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
133 #define MOUSE_MOVED 0x0001
134 #define DOUBLE_CLICK 0x0002
135 #define MOUSE_WHEELED 0x0004
137 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
140 } WINDOW_BUFFER_SIZE_RECORD
,*LPWINDOW_BUFFER_SIZE_RECORD
;
142 typedef struct tagMENU_EVENT_RECORD
144 UINT dwCommandId
; /* perhaps UINT16 ??? */
145 } MENU_EVENT_RECORD
,*LPMENU_EVENT_RECORD
;
147 typedef struct tagFOCUS_EVENT_RECORD
149 BOOL bSetFocus
; /* perhaps BOOL16 ??? */
150 } FOCUS_EVENT_RECORD
,*LPFOCUS_EVENT_RECORD
;
152 typedef struct tagINPUT_RECORD
154 WORD EventType
; /* 00 */
157 KEY_EVENT_RECORD KeyEvent
;
158 MOUSE_EVENT_RECORD MouseEvent
;
159 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
;
160 MENU_EVENT_RECORD MenuEvent
;
161 FOCUS_EVENT_RECORD FocusEvent
;
163 } INPUT_RECORD
,*PINPUT_RECORD
;
165 /* INPUT_RECORD.wEventType */
166 #define KEY_EVENT 0x01
167 #define MOUSE_EVENT 0x02
168 #define WINDOW_BUFFER_SIZE_EVENT 0x04
169 #define MENU_EVENT 0x08
170 #define FOCUS_EVENT 0x10
172 #define CONSOLE_TEXTMODE_BUFFER 1
175 /* Note: this should return a COORD, but calling convention for returning
176 * structures is different between Windows and gcc on i386. */
177 DWORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
179 inline static COORD
__wine_GetLargestConsoleWindowSize_wrapper(HANDLE h
)
185 u
.dw
= GetLargestConsoleWindowSize(h
);
188 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
191 COORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
192 #endif /* __i386__ */
194 BOOL WINAPI
AllocConsole(VOID
);
195 HANDLE WINAPI
CreateConsoleScreenBuffer( DWORD dwDesiredAccess
, DWORD dwShareMode
,
196 LPSECURITY_ATTRIBUTES sa
, DWORD dwFlags
,
197 LPVOID lpScreenBufferData
);
198 BOOL WINAPI
FillConsoleOutputAttribute( HANDLE hConsoleOutput
, WORD wAttribute
, DWORD nLength
,
199 COORD dwCoord
, LPDWORD lpNumAttrsWritten
);
200 BOOL WINAPI
FillConsoleOutputCharacterA(HANDLE
,CHAR
,DWORD
,COORD
,LPDWORD
);
201 BOOL WINAPI
FillConsoleOutputCharacterW(HANDLE
,WCHAR
,DWORD
,COORD
,LPDWORD
);
202 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
203 BOOL WINAPI
FlushConsoleInputBuffer( HANDLE handle
);
204 BOOL WINAPI
FreeConsole(VOID
);
205 BOOL WINAPI
GenerateConsoleCtrlEvent( DWORD dwCtrlEvent
, DWORD dwProcessGroupID
);
206 UINT WINAPI
GetConsoleCP(VOID
);
207 BOOL WINAPI
GetConsoleCursorInfo( HANDLE hcon
, LPCONSOLE_CURSOR_INFO cinfo
);
208 BOOL WINAPI
GetConsoleMode( HANDLE hcon
,LPDWORD mode
);
209 UINT WINAPI
GetConsoleOutputCP(VOID
);
210 BOOL WINAPI
GetConsoleScreenBufferInfo(HANDLE hConsoleOutput
,
211 LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
);
212 DWORD WINAPI
GetConsoleTitleA(LPSTR title
,DWORD size
);
213 DWORD WINAPI
GetConsoleTitleW(LPWSTR title
, DWORD size
);
214 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
215 HWND WINAPI
GetConsoleWindow(void);
216 BOOL WINAPI
GetNumberOfConsoleInputEvents( HANDLE hcon
,LPDWORD nrofevents
);
217 BOOL WINAPI
GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons
);
218 BOOL WINAPI
PeekConsoleInputA( HANDLE handle
, PINPUT_RECORD buffer
, DWORD count
, LPDWORD read
);
219 BOOL WINAPI
PeekConsoleInputW( HANDLE handle
, PINPUT_RECORD buffer
, DWORD count
, LPDWORD read
);
220 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
221 BOOL WINAPI
ReadConsoleA(HANDLE hConsoleInput
, LPVOID lpBuffer
, DWORD nNumberOfCharsToRead
,
222 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
223 BOOL WINAPI
ReadConsoleW(HANDLE hConsoleInput
, LPVOID lpBuffer
, DWORD nNumberOfCharsToRead
,
224 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
225 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
226 BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput
, PINPUT_RECORD lpBuffer
, DWORD nLength
,
227 LPDWORD lpNumberOfEventsRead
);
228 BOOL WINAPI
ReadConsoleInputW(HANDLE hConsoleInput
, PINPUT_RECORD lpBuffer
, DWORD nLength
,
229 LPDWORD lpNumberOfEventsRead
);
230 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
231 BOOL WINAPI
ReadConsoleOutputA( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
,
232 COORD dwBufferCoord
, LPSMALL_RECT lpReadRegion
);
233 BOOL WINAPI
ReadConsoleOutputW( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
,
234 COORD dwBufferCoord
, LPSMALL_RECT lpReadRegion
);
235 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
236 BOOL WINAPI
ReadConsoleOutputAttribute( HANDLE hConsoleOutput
, LPWORD lpAttribute
, DWORD nLength
,
237 COORD dwReadCoord
, LPDWORD lpNumberOfAttrsRead
);
238 BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE
,LPSTR
,DWORD
,COORD
,LPDWORD
);
239 BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE
,LPWSTR
,DWORD
,COORD
,LPDWORD
);
240 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
241 BOOL WINAPI
ScrollConsoleScreenBufferA( HANDLE hConsoleOutput
, LPSMALL_RECT lpScrollRect
,
242 LPSMALL_RECT lpClipRect
, COORD dwDestOrigin
,
244 BOOL WINAPI
ScrollConsoleScreenBufferW( HANDLE hConsoleOutput
, LPSMALL_RECT lpScrollRect
,
245 LPSMALL_RECT lpClipRect
, COORD dwDestOrigin
,
247 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
248 BOOL WINAPI
SetConsoleActiveScreenBuffer( HANDLE hConsoleOutput
);
249 BOOL WINAPI
SetConsoleCP(UINT cp
);
250 BOOL WINAPI
SetConsoleCtrlHandler( PHANDLER_ROUTINE func
, BOOL add
);
251 BOOL WINAPI
SetConsoleCursorInfo( HANDLE hcon
, LPCONSOLE_CURSOR_INFO cinfo
);
252 BOOL WINAPI
SetConsoleCursorPosition(HANDLE
,COORD
);
253 BOOL WINAPI
SetConsoleMode( HANDLE hcon
, DWORD mode
);
254 BOOL WINAPI
SetConsoleOutputCP(UINT cp
);
255 BOOL WINAPI
SetConsoleScreenBufferSize(HANDLE hConsoleOutput
, COORD dwSize
);
256 BOOL WINAPI
SetConsoleTextAttribute( HANDLE hConsoleOutput
,WORD wAttr
);
257 BOOL WINAPI
SetConsoleTitleA(LPCSTR title
);
258 BOOL WINAPI
SetConsoleTitleW(LPCWSTR title
);
259 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
260 BOOL WINAPI
SetConsoleWindowInfo( HANDLE hcon
, BOOL bAbsolute
, LPSMALL_RECT window
);
261 BOOL WINAPI
WriteConsoleA(HANDLE
,CONST VOID
*,DWORD
,LPDWORD
,LPVOID
);
262 BOOL WINAPI
WriteConsoleW(HANDLE
, CONST VOID
*lpBuffer
, DWORD
,LPDWORD
,LPVOID
);
263 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
264 BOOL WINAPI
WriteConsoleInputA(HANDLE
,const INPUT_RECORD
*,DWORD
,LPDWORD
);
265 BOOL WINAPI
WriteConsoleInputW(HANDLE
,const INPUT_RECORD
*,DWORD
,LPDWORD
);
266 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
267 BOOL WINAPI
WriteConsoleOutputA(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,LPSMALL_RECT
);
268 BOOL WINAPI
WriteConsoleOutputW(HANDLE
,const CHAR_INFO
*,COORD
,COORD
,LPSMALL_RECT
);
269 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
270 BOOL WINAPI
WriteConsoleOutputAttribute(HANDLE
,CONST WORD
*,DWORD
,COORD
,LPDWORD
);
271 BOOL WINAPI
WriteConsoleOutputCharacterA(HANDLE
,LPCSTR
,DWORD
,COORD
,LPDWORD
);
272 BOOL WINAPI
WriteConsoleOutputCharacterW(HANDLE
,LPCWSTR
,DWORD
,COORD
,LPDWORD
);
273 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
279 #endif /* __WINE_WINCON_H */