1 #ifndef __WINE_WINCON_H
2 #define __WINE_WINCON_H
5 #define CTRL_BREAK_EVENT 1
6 #define CTRL_CLOSE_EVENT 2
7 #define CTRL_LOGOFF_EVENT 5
8 #define CTRL_SHUTDOWN_EVENT 6
10 /* Console Mode flags */
11 #define ENABLE_PROCESSED_INPUT 0x01
12 #define ENABLE_LINE_INPUT 0x02
13 #define ENABLE_ECHO_INPUT 0x04
14 #define ENABLE_WINDOW_INPUT 0x08
15 #define ENABLE_MOUSE_INPUT 0x10
17 #define ENABLE_PROCESSED_OUTPUT 0x01
18 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
21 typedef BOOL (WINAPI
*PHANDLER_ROUTINE
)(DWORD
);
23 /* Attributes flags: */
25 #define FOREGROUND_BLUE 0x0001 /* text color contains blue. */
26 #define FOREGROUND_GREEN 0x0002 /* text color contains green. */
27 #define FOREGROUND_RED 0x0004 /* text color contains red. */
28 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
29 #define BACKGROUND_BLUE 0x0010 /* background color contains blue. */
30 #define BACKGROUND_GREEN 0x0020 /* background color contains green. */
31 #define BACKGROUND_RED 0x0040 /* background color contains red. */
32 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
34 typedef struct _CONSOLE_CURSOR_INFO
{
35 DWORD dwSize
; /* Between 1 & 100 for percentage of cell filled */
36 BOOL bVisible
; /* Visibility of cursor */
37 } CONSOLE_CURSOR_INFO
, *LPCONSOLE_CURSOR_INFO
;
39 typedef struct tagCOORD
45 typedef struct tagSMALL_RECT
51 } SMALL_RECT
,*LPSMALL_RECT
;
53 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
56 COORD dwCursorPosition
;
59 COORD dwMaximumWindowSize
;
60 } CONSOLE_SCREEN_BUFFER_INFO
,*LPCONSOLE_SCREEN_BUFFER_INFO
;
62 typedef struct tagCHAR_INFO
70 } CHAR_INFO
,*LPCHAR_INFO
;
72 typedef struct tagKEY_EVENT_RECORD
74 BOOL bKeyDown
; /* 04 */
75 WORD wRepeatCount
; /* 08 */
76 WORD wVirtualKeyCode
; /* 0A */
77 WORD wVirtualScanCode
; /* 0C */
80 WCHAR UniCodeChar
; /* 0E */
81 CHAR AsciiChar
; /* 0E */
83 DWORD dwControlKeyState
; /* 10 */
84 } KEY_EVENT_RECORD
,*LPKEY_EVENT_RECORD
;
86 /* dwControlKeyState bitmask */
87 #define RIGHT_ALT_PRESSED 0x0001
88 #define LEFT_ALT_PRESSED 0x0002
89 #define RIGHT_CTRL_PRESSED 0x0004
90 #define LEFT_CTRL_PRESSED 0x0008
91 #define SHIFT_PRESSED 0x0010
92 #define NUMLOCK_ON 0x0020
93 #define SCROLLLOCK_ON 0x0040
94 #define CAPSLOCK_ON 0x0080
95 #define ENHANCED_KEY 0x0100
97 typedef struct tagMOUSE_EVENT_RECORD
99 COORD dwMousePosition
;
101 DWORD dwControlKeyState
;
103 } MOUSE_EVENT_RECORD
,*LPMOUSE_EVENT_RECORD
;
105 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
108 } WINDOW_BUFFER_SIZE_RECORD
,*LPWINDOW_BUFFER_SIZE_RECORD
;
110 typedef struct tagMENU_EVENT_RECORD
112 UINT dwCommandId
; /* perhaps UINT16 ??? */
113 } MENU_EVENT_RECORD
,*LPMENU_EVENT_RECORD
;
115 typedef struct tagFOCUS_EVENT_RECORD
117 BOOL bSetFocus
; /* perhaps BOOL16 ??? */
118 } FOCUS_EVENT_RECORD
,*LPFOCUS_EVENT_RECORD
;
120 typedef struct tagINPUT_RECORD
122 WORD EventType
; /* 00 */
125 KEY_EVENT_RECORD KeyEvent
;
126 MOUSE_EVENT_RECORD MouseEvent
;
127 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent
;
128 MENU_EVENT_RECORD MenuEvent
;
129 FOCUS_EVENT_RECORD FocusEvent
;
131 } INPUT_RECORD
,*LPINPUT_RECORD
;
133 /* INPUT_RECORD.wEventType */
134 #define KEY_EVENT 0x01
135 #define MOUSE_EVENT 0x02
136 #define WINDOW_BUFFER_SIZE_EVENT 0x04
137 #define MENU_EVENT 0x08
138 #define FOCUS_EVENT 0x10
141 /* Note: this should return a COORD, but calling convention for returning
142 * structures is different between Windows and gcc on i386. */
143 DWORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
145 inline static COORD
__wine_GetLargestConsoleWindowSize_wrapper(HANDLE h
)
147 DWORD dw
= GetLargestConsoleWindowSize(h
);
148 return *(COORD
*)&dw
;
150 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
153 COORD WINAPI
GetLargestConsoleWindowSize(HANDLE
);
154 #endif /* __i386__ */
156 BOOL WINAPI
ReadConsoleOutputCharacterA(HANDLE
,LPSTR
,DWORD
,COORD
,LPDWORD
);
157 BOOL WINAPI
ReadConsoleOutputCharacterW(HANDLE
,LPWSTR
,DWORD
,COORD
,LPDWORD
);
158 #define ReadConsoleOutputCharacter WINELIB_NAME_AW(ReadConsoleOutputCharacter)
159 BOOL WINAPI
SetConsoleCursorPosition(HANDLE
,COORD
);
161 BOOL WINAPI
WriteConsoleOutputA( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
, COORD dwBufferCoord
, LPSMALL_RECT lpWriteRegion
);
162 BOOL WINAPI
WriteConsoleOutputW( HANDLE hConsoleOutput
, LPCHAR_INFO lpBuffer
, COORD dwBufferSize
, COORD dwBufferCoord
, LPSMALL_RECT lpWriteRegion
);
163 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
164 BOOL WINAPI
WriteConsoleInputA( HANDLE handle
, INPUT_RECORD
*buffer
,
165 DWORD count
, LPDWORD written
);
166 BOOL WINAPI
WriteConsoleInputW( HANDLE handle
, INPUT_RECORD
*buffer
,
167 DWORD count
, LPDWORD written
);
168 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
169 BOOL WINAPI
PeekConsoleInputA( HANDLE handle
, LPINPUT_RECORD buffer
,
170 DWORD count
, LPDWORD read
);
171 BOOL WINAPI
PeekConsoleInputW( HANDLE handle
, LPINPUT_RECORD buffer
,
172 DWORD count
, LPDWORD read
);
173 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
174 BOOL WINAPI
ReadConsoleA( HANDLE hConsoleInput
, LPVOID lpBuffer
,
175 DWORD nNumberOfCharsToRead
,
176 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
177 BOOL WINAPI
ReadConsoleW( HANDLE hConsoleInput
, LPVOID lpBuffer
,
178 DWORD nNumberOfCharsToRead
,
179 LPDWORD lpNumberOfCharsRead
, LPVOID lpReserved
);
180 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
181 BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput
,
182 LPINPUT_RECORD lpBuffer
, DWORD nLength
,
183 LPDWORD lpNumberOfEventsRead
);
184 BOOL WINAPI
ReadConsoleInputW(HANDLE hConsoleInput
,
185 LPINPUT_RECORD lpBuffer
, DWORD nLength
,
186 LPDWORD lpNumberOfEventsRead
);
187 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
189 BOOL WINAPI
GetConsoleScreenBufferInfo(HANDLE hConsoleOutput
,
190 LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
);
191 BOOL WINAPI
SetConsoleScreenBufferSize(HANDLE hConsoleOutput
,
194 BOOL WINAPI
AllocConsole(VOID
);
195 HANDLE WINAPI
CreateConsoleScreenBuffer( DWORD dwDesiredAccess
, DWORD dwShareMode
,
196 LPSECURITY_ATTRIBUTES sa
, DWORD dwFlags
, LPVOID lpScreenBufferData
);
197 BOOL WINAPI
FillConsoleOutputAttribute( HANDLE hConsoleOutput
, WORD wAttribute
,
198 DWORD nLength
, COORD dwCoord
, LPDWORD lpNumAttrsWritten
);
199 BOOL WINAPI
FillConsoleOutputCharacterA( HANDLE hConsoleOutput
, BYTE cCharacter
,
200 DWORD nLength
, COORD dwCoord
, LPDWORD lpNumCharsWritten
);
201 BOOL WINAPI
FillConsoleOutputCharacterW( HANDLE hConsoleOutput
, WCHAR cCharacter
,
202 DWORD nLength
, COORD dwCoord
, LPDWORD lpNumCharsWritten
);
203 #define FillConsoleOutputCharacter WINELIB_NAME_AW(FillConsoleOutputCharacter)
204 BOOL WINAPI
FlushConsoleInputBuffer( HANDLE handle
);
205 BOOL WINAPI
FreeConsole(VOID
);
206 BOOL WINAPI
GenerateConsoleCtrlEvent( DWORD dwCtrlEvent
, DWORD dwProcessGroupID
);
207 UINT WINAPI
GetConsoleCP(VOID
);
208 BOOL WINAPI
GetConsoleCursorInfo( HANDLE hcon
, LPCONSOLE_CURSOR_INFO cinfo
);
209 BOOL WINAPI
GetConsoleMode( HANDLE hcon
,LPDWORD mode
);
210 UINT WINAPI
GetConsoleOutputCP(VOID
);
211 DWORD WINAPI
GetConsoleTitleA(LPSTR title
,DWORD size
);
212 DWORD WINAPI
GetConsoleTitleW( LPWSTR title
, DWORD size
);
213 #define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
214 BOOL WINAPI
GetNumberOfConsoleInputEvents( HANDLE hcon
,LPDWORD nrofevents
);
215 BOOL WINAPI
GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons
);
216 BOOL WINAPI
ReadConsoleOutputAttribute( HANDLE hConsoleOutput
, LPWORD lpAttribute
,
217 DWORD nLength
, COORD dwReadCoord
, LPDWORD lpNumberOfAttrsRead
);
218 BOOL WINAPI
ScrollConsoleScreenBufferA( HANDLE hConsoleOutput
, LPSMALL_RECT lpScrollRect
,
219 LPSMALL_RECT lpClipRect
, COORD dwDestOrigin
, LPCHAR_INFO lpFill
);
220 BOOL WINAPI
ScrollConsoleScreenBufferW( HANDLE hConsoleOutput
, LPSMALL_RECT lpScrollRect
,
221 LPSMALL_RECT lpClipRect
, COORD dwDestOrigin
, LPCHAR_INFO lpFill
);
222 #define ScrollConsoleScreenBuffer WINELIB_NAME_AW(ScrollConsoleScreenBuffer)
223 BOOL WINAPI
SetConsoleActiveScreenBuffer( HANDLE hConsoleOutput
);
224 BOOL WINAPI
SetConsoleCP(UINT cp
);
225 BOOL WINAPI
SetConsoleCtrlHandler( PHANDLER_ROUTINE func
, BOOL add
);
226 BOOL WINAPI
SetConsoleCursorInfo( HANDLE hcon
, LPCONSOLE_CURSOR_INFO cinfo
);
227 BOOL WINAPI
SetConsoleMode( HANDLE hcon
, DWORD mode
);
228 BOOL WINAPI
SetConsoleOutputCP(UINT cp
);
229 BOOL WINAPI
SetConsoleTextAttribute( HANDLE hConsoleOutput
,WORD wAttr
);
230 BOOL WINAPI
SetConsoleTitleA(LPCSTR title
);
231 BOOL WINAPI
SetConsoleTitleW(LPCWSTR title
);
232 #define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
233 BOOL WINAPI
SetConsoleWindowInfo( HANDLE hcon
, BOOL bAbsolute
, LPSMALL_RECT window
);
235 BOOL WINAPI
WriteConsoleOutputAttribute( HANDLE hConsoleOutput
, CONST WORD
*lpAttribute
,
236 DWORD nLength
, COORD dwCoord
, LPDWORD lpNumAttrsWritten
);
238 BOOL WINAPI
WriteConsoleOutputCharacterA( HANDLE hConsoleOutput
, LPCSTR lpCharacter
,
239 DWORD nLength
, COORD dwCoord
, LPDWORD lpNumCharsWritten
);
240 BOOL WINAPI
WriteConsoleOutputCharacterW( HANDLE hConsoleOutput
, LPCWSTR lpCharacter
,
241 DWORD nLength
, COORD dwCoord
, LPDWORD lpNumCharsWritten
);
242 #define WriteConsoleOutputCharacter WINELIB_NAME_AW(WriteConsoleOutputCharacter)
244 #endif /* __WINE_WINCON_H */