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
38 /* Wine only code (extension) */
39 #define WINE_ENABLE_LINE_INPUT_EMACS 0x80
41 #define ENABLE_PROCESSED_OUTPUT 0x01
42 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
45 typedef BOOL (WINAPI *PHANDLER_ROUTINE)(DWORD dwCtrlType);
47 /* Attributes flags: */
49 #define FOREGROUND_BLUE 0x0001 /* text color contains blue. */
50 #define FOREGROUND_GREEN 0x0002 /* text color contains green. */
51 #define FOREGROUND_RED 0x0004 /* text color contains red. */
52 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
53 #define BACKGROUND_BLUE 0x0010 /* background color contains blue. */
54 #define BACKGROUND_GREEN 0x0020 /* background color contains green. */
55 #define BACKGROUND_RED 0x0040 /* background color contains red. */
56 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
58 typedef struct _CONSOLE_CURSOR_INFO {
59 DWORD dwSize; /* Between 1 & 100 for percentage of cell filled */
60 BOOL bVisible; /* Visibility of cursor */
61 } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
63 typedef struct tagCOORD
69 typedef struct tagSMALL_RECT
75 } SMALL_RECT,*LPSMALL_RECT;
77 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
80 COORD dwCursorPosition;
83 COORD dwMaximumWindowSize;
84 } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO;
86 typedef struct tagCHAR_INFO
94 } CHAR_INFO,*LPCHAR_INFO;
96 typedef struct tagKEY_EVENT_RECORD
98 BOOL bKeyDown; /* 04 */
99 WORD wRepeatCount; /* 08 */
100 WORD wVirtualKeyCode; /* 0A */
101 WORD wVirtualScanCode; /* 0C */
104 WCHAR UnicodeChar; /* 0E */
105 CHAR AsciiChar; /* 0E */
107 DWORD dwControlKeyState; /* 10 */
108 } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD;
110 /* dwControlKeyState bitmask */
111 #define RIGHT_ALT_PRESSED 0x0001
112 #define LEFT_ALT_PRESSED 0x0002
113 #define RIGHT_CTRL_PRESSED 0x0004
114 #define LEFT_CTRL_PRESSED 0x0008
115 #define SHIFT_PRESSED 0x0010
116 #define NUMLOCK_ON 0x0020
117 #define SCROLLLOCK_ON 0x0040
118 #define CAPSLOCK_ON 0x0080
119 #define ENHANCED_KEY 0x0100
121 typedef struct tagMOUSE_EVENT_RECORD
123 COORD dwMousePosition;
125 DWORD dwControlKeyState;
127 } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD;
129 #define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
130 #define RIGHTMOST_BUTTON_PRESSED 0x0002
131 #define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
132 #define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
133 #define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
135 #define MOUSE_MOVED 0x0001
136 #define DOUBLE_CLICK 0x0002
137 #define MOUSE_WHEELED 0x0004
139 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
142 } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD;
144 typedef struct tagMENU_EVENT_RECORD
146 UINT dwCommandId; /* perhaps UINT16 ??? */
147 } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD;
149 typedef struct tagFOCUS_EVENT_RECORD
151 BOOL bSetFocus; /* perhaps BOOL16 ??? */
152 } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD;
154 typedef struct tagINPUT_RECORD
156 WORD EventType; /* 00 */
159 KEY_EVENT_RECORD KeyEvent;
160 MOUSE_EVENT_RECORD MouseEvent;
161 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
162 MENU_EVENT_RECORD MenuEvent;
163 FOCUS_EVENT_RECORD FocusEvent;
165 } INPUT_RECORD,*LPINPUT_RECORD;
167 /* INPUT_RECORD.wEventType */
168 #define KEY_EVENT 0x01
169 #define MOUSE_EVENT 0x02
170 #define WINDOW_BUFFER_SIZE_EVENT 0x04
171 #define MENU_EVENT 0x08
172 #define FOCUS_EVENT 0x10
174 #define CONSOLE_TEXTMODE_BUFFER 1
177 /* Note: this should return a COORD, but calling convention for returning
178 * structures is different between Windows and gcc on i386. */
179 DWORD WINAPI GetLargestConsoleWindowSize(HANDLE);
181 inline static COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h)
187 u.dw = GetLargestConsoleWindowSize(h);
190 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
193 COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
194 #endif /* __i386__ */
196 BOOL WINAPI AllocConsole(VOID);
197 HANDLE WINAPI CreateConsoleScreenBuffer( DWORD dwDesiredAccess, DWORD dwShareMode,
198 LPSECURITY_ATTRIBUTES sa, DWORD dwFlags,
199 LPVOID lpScreenBufferData);
200 BOOL WINAPI FillConsoleOutputAttribute( HANDLE hConsoleOutput, WORD wAttribute, DWORD nLength,
201 COORD dwCoord, LPDWORD lpNumAttrsWritten);
202 BOOL WINAPI FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,LPDWORD);
203 BOOL WINAPI FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,LPDWORD);
204 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
205 BOOL WINAPI FlushConsoleInputBuffer( HANDLE handle);
206 BOOL WINAPI FreeConsole(VOID);
207 BOOL WINAPI GenerateConsoleCtrlEvent( DWORD dwCtrlEvent, DWORD dwProcessGroupID);
208 UINT WINAPI GetConsoleCP(VOID);
209 BOOL WINAPI GetConsoleCursorInfo( HANDLE hcon, LPCONSOLE_CURSOR_INFO cinfo);
210 BOOL WINAPI GetConsoleMode( HANDLE hcon,LPDWORD mode);
211 UINT WINAPI GetConsoleOutputCP(VOID);
212 BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,
213 LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
214 DWORD WINAPI GetConsoleTitleA(LPSTR title,DWORD size);
215 DWORD WINAPI GetConsoleTitleW(LPWSTR title, DWORD size);
216 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
217 BOOL WINAPI GetNumberOfConsoleInputEvents( HANDLE hcon,LPDWORD nrofevents);
218 BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons);
219 BOOL WINAPI PeekConsoleInputA( HANDLE handle, LPINPUT_RECORD buffer, DWORD count, LPDWORD read );
220 BOOL WINAPI PeekConsoleInputW( HANDLE handle, LPINPUT_RECORD buffer, DWORD count, LPDWORD read );
221 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
222 BOOL WINAPI ReadConsoleA(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead,
223 LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
224 BOOL WINAPI ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead,
225 LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
226 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
227 BOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput, LPINPUT_RECORD lpBuffer, DWORD nLength,
228 LPDWORD lpNumberOfEventsRead);
229 BOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput, LPINPUT_RECORD lpBuffer, DWORD nLength,
230 LPDWORD lpNumberOfEventsRead);
231 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
232 BOOL WINAPI ReadConsoleOutputA( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize,
233 COORD dwBufferCoord, LPSMALL_RECT lpReadRegion );
234 BOOL WINAPI ReadConsoleOutputW( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize,
235 COORD dwBufferCoord, LPSMALL_RECT lpReadRegion );
236 #define ReadConsoleOutput WINELIB_NAME_AW(ReadConsoleOutput)
237 BOOL WINAPI ReadConsoleOutputAttribute( HANDLE hConsoleOutput, LPWORD lpAttribute, DWORD nLength,
238 COORD dwReadCoord, LPDWORD lpNumberOfAttrsRead);
239 BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,LPDWORD);
240 BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,LPDWORD);
241 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
242 BOOL WINAPI ScrollConsoleScreenBufferA( HANDLE hConsoleOutput, LPSMALL_RECT lpScrollRect,
243 LPSMALL_RECT lpClipRect, COORD dwDestOrigin,
245 BOOL WINAPI ScrollConsoleScreenBufferW( HANDLE hConsoleOutput, LPSMALL_RECT lpScrollRect,
246 LPSMALL_RECT lpClipRect, COORD dwDestOrigin,
248 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
249 BOOL WINAPI SetConsoleActiveScreenBuffer( HANDLE hConsoleOutput);
250 BOOL WINAPI SetConsoleCP(UINT cp);
251 BOOL WINAPI SetConsoleCtrlHandler( PHANDLER_ROUTINE func, BOOL add);
252 BOOL WINAPI SetConsoleCursorInfo( HANDLE hcon, LPCONSOLE_CURSOR_INFO cinfo);
253 BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
254 BOOL WINAPI SetConsoleMode( HANDLE hcon, DWORD mode);
255 BOOL WINAPI SetConsoleOutputCP(UINT cp);
256 BOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize);
257 BOOL WINAPI SetConsoleTextAttribute( HANDLE hConsoleOutput,WORD wAttr);
258 BOOL WINAPI SetConsoleTitleA(LPCSTR title);
259 BOOL WINAPI SetConsoleTitleW(LPCWSTR title);
260 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
261 BOOL WINAPI SetConsoleWindowInfo( HANDLE hcon, BOOL bAbsolute, LPSMALL_RECT window);
262 BOOL WINAPI WriteConsoleA(HANDLE,CONST VOID *,DWORD,LPDWORD,LPVOID);
263 BOOL WINAPI WriteConsoleW(HANDLE, CONST VOID *lpBuffer, DWORD,LPDWORD,LPVOID);
264 #define WriteConsole WINELIB_NAME_AW(WriteConsole)
265 BOOL WINAPI WriteConsoleInputA(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
266 BOOL WINAPI WriteConsoleInputW(HANDLE,const INPUT_RECORD *,DWORD,LPDWORD);
267 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
268 BOOL WINAPI WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
269 BOOL WINAPI WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,LPSMALL_RECT);
270 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
271 BOOL WINAPI WriteConsoleOutputAttribute(HANDLE,CONST WORD *,DWORD,COORD,LPDWORD);
272 BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,LPDWORD);
273 BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD);
274 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
280 #endif /* __WINE_WINCON_H */