7b62e2f42f9fe58cf9e0cce1acde24e117af2975
[reactos.git] / reactos / include / psdk / wincon.h
1 #ifndef _WINCON_H
2 #define _WINCON_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #if (_WIN32_WINNT >= 0x0600) && !defined(NOGDI)
9 # include "wingdi.h"
10 #endif
11
12 #ifdef _MSC_VER
13 #pragma warning(push)
14 #pragma warning(disable:4820)
15 #endif
16
17 #define FOREGROUND_BLUE 1
18 #define FOREGROUND_GREEN 2
19 #define FOREGROUND_RED 4
20 #define FOREGROUND_INTENSITY 8
21 #define BACKGROUND_BLUE 16
22 #define BACKGROUND_GREEN 32
23 #define BACKGROUND_RED 64
24 #define BACKGROUND_INTENSITY 128
25 #define CTRL_C_EVENT 0
26 #define CTRL_BREAK_EVENT 1
27 #define CTRL_CLOSE_EVENT 2
28 #define CTRL_LOGOFF_EVENT 5
29 #define CTRL_SHUTDOWN_EVENT 6
30 #define ENABLE_LINE_INPUT 2
31 #define ENABLE_ECHO_INPUT 4
32 #define ENABLE_PROCESSED_INPUT 1
33 #define ENABLE_WINDOW_INPUT 8
34 #define ENABLE_MOUSE_INPUT 16
35 #define ENABLE_PROCESSED_OUTPUT 1
36 #define ENABLE_WRAP_AT_EOL_OUTPUT 2
37 #define KEY_EVENT 1
38 #define MOUSE_EVENT 2
39 #define WINDOW_BUFFER_SIZE_EVENT 4
40 #define MENU_EVENT 8
41 #define FOCUS_EVENT 16
42 #define CAPSLOCK_ON 128
43 #define ENHANCED_KEY 256
44 #define RIGHT_ALT_PRESSED 1
45 #define LEFT_ALT_PRESSED 2
46 #define RIGHT_CTRL_PRESSED 4
47 #define LEFT_CTRL_PRESSED 8
48 #define SHIFT_PRESSED 16
49 #define NUMLOCK_ON 32
50 #define SCROLLLOCK_ON 64
51 #define FROM_LEFT_1ST_BUTTON_PRESSED 1
52 #define RIGHTMOST_BUTTON_PRESSED 2
53 #define FROM_LEFT_2ND_BUTTON_PRESSED 4
54 #define FROM_LEFT_3RD_BUTTON_PRESSED 8
55 #define FROM_LEFT_4TH_BUTTON_PRESSED 16
56 #define MOUSE_MOVED 1
57 #define DOUBLE_CLICK 2
58 #define MOUSE_WHEELED 4
59
60 typedef struct _CONSOLE_READCONSOLE_CONTROL {
61 ULONG nLength;
62 ULONG nInitialChars;
63 ULONG dwCtrlWakeupMask;
64 ULONG dwControlKeyState;
65 } CONSOLE_READCONSOLE_CONTROL, *PCONSOLE_READCONSOLE_CONTROL;
66
67 typedef struct _CHAR_INFO {
68 union {
69 WCHAR UnicodeChar;
70 CHAR AsciiChar;
71 } Char;
72 WORD Attributes;
73 } CHAR_INFO,*PCHAR_INFO;
74 typedef struct _SMALL_RECT {
75 SHORT Left;
76 SHORT Top;
77 SHORT Right;
78 SHORT Bottom;
79 } SMALL_RECT,*PSMALL_RECT;
80 typedef struct _CONSOLE_CURSOR_INFO {
81 DWORD dwSize;
82 BOOL bVisible;
83 } CONSOLE_CURSOR_INFO,*PCONSOLE_CURSOR_INFO;
84 typedef struct _COORD {
85 SHORT X;
86 SHORT Y;
87 } COORD, *PCOORD;
88 typedef struct _CONSOLE_SELECTION_INFO {
89 DWORD dwFlags;
90 COORD dwSelectionAnchor;
91 SMALL_RECT srSelection;
92 } CONSOLE_SELECTION_INFO, *PCONSOLE_SELECTION_INFO;
93 typedef struct _CONSOLE_FONT_INFO {
94 DWORD nFont;
95 COORD dwFontSize;
96 } CONSOLE_FONT_INFO, *PCONSOLE_FONT_INFO;
97 typedef struct _CONSOLE_SCREEN_BUFFER_INFO {
98 COORD dwSize;
99 COORD dwCursorPosition;
100 WORD wAttributes;
101 SMALL_RECT srWindow;
102 COORD dwMaximumWindowSize;
103 } CONSOLE_SCREEN_BUFFER_INFO,*PCONSOLE_SCREEN_BUFFER_INFO;
104 typedef BOOL(CALLBACK *PHANDLER_ROUTINE)(DWORD);
105 typedef struct _KEY_EVENT_RECORD {
106 BOOL bKeyDown;
107 WORD wRepeatCount;
108 WORD wVirtualKeyCode;
109 WORD wVirtualScanCode;
110 union {
111 WCHAR UnicodeChar;
112 CHAR AsciiChar;
113 } uChar;
114 DWORD dwControlKeyState;
115 }
116 #ifdef __GNUC__
117 /* gcc's alignment is not what win32 expects */
118 PACKED
119 #endif
120 KEY_EVENT_RECORD;
121 typedef struct _MOUSE_EVENT_RECORD {
122 COORD dwMousePosition;
123 DWORD dwButtonState;
124 DWORD dwControlKeyState;
125 DWORD dwEventFlags;
126 } MOUSE_EVENT_RECORD;
127 typedef struct _WINDOW_BUFFER_SIZE_RECORD { COORD dwSize; } WINDOW_BUFFER_SIZE_RECORD;
128 typedef struct _MENU_EVENT_RECORD { UINT dwCommandId; } MENU_EVENT_RECORD,*PMENU_EVENT_RECORD;
129 typedef struct _FOCUS_EVENT_RECORD { BOOL bSetFocus; } FOCUS_EVENT_RECORD;
130 typedef struct _INPUT_RECORD {
131 WORD EventType;
132 union {
133 KEY_EVENT_RECORD KeyEvent;
134 MOUSE_EVENT_RECORD MouseEvent;
135 WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
136 MENU_EVENT_RECORD MenuEvent;
137 FOCUS_EVENT_RECORD FocusEvent;
138 } Event;
139 } INPUT_RECORD,*PINPUT_RECORD;
140
141 #if (_WIN32_WINNT >= 0x0600)
142 #define HISTORY_NO_DUP_FLAG 0x1
143 #define CONSOLE_OVERSTRIKE 0x1
144 #ifndef NOGDI
145 typedef struct _CONSOLE_HISTORY_INFO {
146 UINT cbSize;
147 UINT HistoryBufferSize;
148 UINT NumberOfHistoryBuffers;
149 DWORD dwFlags;
150 } CONSOLE_HISTORY_INFO, *PCONSOLE_HISTORY_INFO;
151 #endif
152
153 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX {
154 ULONG cbSize;
155 COORD dwSize;
156 COORD dwCursorPosition;
157 WORD wAttributes;
158 SMALL_RECT srWindow;
159 COORD dwMaximumWindowSize;
160 WORD wPopupAttributes;
161 COLORREF ColorTable[16];
162 } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX;
163
164 typedef struct _CONSOLE_FONT_INFOEX {
165 ULONG cbSize;
166 DWORD nFont;
167 COORD dwFontSize;
168 UINT FontFamily;
169 UINT FontWeight;
170 WCHAR FaceName[LF_FACESIZE];
171 } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
172 #endif
173
174 BOOL WINAPI AllocConsole(void);
175 #if (_WIN32_WINNT >= 0x0501)
176 #define ATTACH_PARENT_PROCESS (DWORD)-1
177 BOOL WINAPI AttachConsole(DWORD);
178 BOOL WINAPI AddConsoleAliasA(LPCSTR,LPCSTR,LPCSTR);
179 BOOL WINAPI AddConsoleAliasW(LPCWSTR,LPCWSTR,LPCWSTR);
180 DWORD WINAPI GetConsoleAliasA(LPSTR,LPSTR,DWORD,LPSTR);
181 DWORD WINAPI GetConsoleAliasW(LPWSTR,LPWSTR,DWORD,LPWSTR);
182 DWORD WINAPI GetConsoleAliasesA(LPSTR,DWORD,LPSTR);
183 DWORD WINAPI GetConsoleAliasesW(LPWSTR,DWORD,LPWSTR);
184 DWORD WINAPI GetConsoleAliasesLengthA(LPSTR);
185 DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR);
186 #endif
187 HANDLE WINAPI CreateConsoleScreenBuffer(DWORD,DWORD,CONST SECURITY_ATTRIBUTES*,DWORD,LPVOID);
188 BOOL WINAPI FillConsoleOutputAttribute(HANDLE,WORD,DWORD,COORD,PDWORD);
189 BOOL WINAPI FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,PDWORD);
190 BOOL WINAPI FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,PDWORD);
191 BOOL WINAPI FlushConsoleInputBuffer(HANDLE);
192 BOOL WINAPI FreeConsole(void);
193 BOOL WINAPI GenerateConsoleCtrlEvent(DWORD,DWORD);
194 UINT WINAPI GetConsoleCP(void);
195 BOOL WINAPI GetConsoleCursorInfo(HANDLE,PCONSOLE_CURSOR_INFO);
196 BOOL WINAPI GetConsoleMode(HANDLE,PDWORD);
197 UINT WINAPI GetConsoleOutputCP(void);
198 BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE,PCONSOLE_SCREEN_BUFFER_INFO);
199 DWORD WINAPI GetConsoleTitleA(LPSTR,DWORD);
200 DWORD WINAPI GetConsoleTitleW(LPWSTR,DWORD);
201 #if (_WIN32_WINNT >= 0x0500)
202 HWND WINAPI GetConsoleWindow(void);
203 #endif
204 COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
205 BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE,PDWORD);
206 BOOL WINAPI GetNumberOfConsoleMouseButtons(PDWORD);
207 BOOL WINAPI PeekConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
208 BOOL WINAPI PeekConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
209 BOOL WINAPI ReadConsoleA(HANDLE,PVOID,DWORD,PDWORD,PCONSOLE_READCONSOLE_CONTROL);
210 BOOL WINAPI ReadConsoleW(HANDLE,PVOID,DWORD,PDWORD,PCONSOLE_READCONSOLE_CONTROL);
211 BOOL WINAPI ReadConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
212 BOOL WINAPI ReadConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
213 BOOL WINAPI ReadConsoleOutputAttribute(HANDLE,LPWORD,DWORD,COORD,LPDWORD);
214 BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,PDWORD);
215 BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,PDWORD);
216 BOOL WINAPI ReadConsoleOutputA(HANDLE,PCHAR_INFO,COORD,COORD,PSMALL_RECT);
217 BOOL WINAPI ReadConsoleOutputW(HANDLE,PCHAR_INFO,COORD,COORD,PSMALL_RECT);
218 BOOL WINAPI ScrollConsoleScreenBufferA(HANDLE,const SMALL_RECT*,const SMALL_RECT*,COORD,const CHAR_INFO*);
219 BOOL WINAPI ScrollConsoleScreenBufferW(HANDLE,const SMALL_RECT*,const SMALL_RECT*,COORD,const CHAR_INFO*);
220 BOOL WINAPI SetConsoleActiveScreenBuffer(HANDLE);
221 BOOL WINAPI SetConsoleCP(UINT);
222 BOOL WINAPI SetConsoleCtrlHandler(PHANDLER_ROUTINE,BOOL);
223 BOOL WINAPI SetConsoleCursorInfo(HANDLE,const CONSOLE_CURSOR_INFO*);
224 BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
225 BOOL WINAPI SetConsoleMode(HANDLE,DWORD);
226 BOOL WINAPI SetConsoleOutputCP(UINT);
227 BOOL WINAPI SetConsoleScreenBufferSize(HANDLE,COORD);
228 BOOL WINAPI SetConsoleTextAttribute(HANDLE,WORD);
229 BOOL WINAPI SetConsoleTitleA(LPCSTR);
230 BOOL WINAPI SetConsoleTitleW(LPCWSTR);
231 BOOL WINAPI SetConsoleWindowInfo(HANDLE,BOOL,const SMALL_RECT*);
232 BOOL WINAPI WriteConsoleA(HANDLE,CONST VOID*,DWORD,LPDWORD,LPVOID);
233 BOOL WINAPI WriteConsoleW(HANDLE,CONST VOID*,DWORD,LPDWORD,LPVOID);
234 BOOL WINAPI WriteConsoleInputA(HANDLE,const INPUT_RECORD*,DWORD,PDWORD);
235 BOOL WINAPI WriteConsoleInputW(HANDLE,const INPUT_RECORD*,DWORD,PDWORD);
236 BOOL WINAPI WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,PSMALL_RECT);
237 BOOL WINAPI WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,PSMALL_RECT);
238 BOOL WINAPI WriteConsoleOutputAttribute(HANDLE,const WORD*,DWORD,COORD,PDWORD);
239 BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,PDWORD);
240 BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,PDWORD);
241
242 #ifdef UNICODE
243 #define FillConsoleOutputCharacter FillConsoleOutputCharacterW
244 #define AddConsoleAlias AddConsoleAliasW
245 #define GetConsoleAlias GetConsoleAliasW
246 #define GetConsoleAliases GetConsoleAliasesW
247 #define GetConsoleAliasesLength GetConsoleAliasesLengthW
248 #define GetConsoleTitle GetConsoleTitleW
249 #define PeekConsoleInput PeekConsoleInputW
250 #define ReadConsole ReadConsoleW
251 #define ReadConsoleInput ReadConsoleInputW
252 #define ReadConsoleOutput ReadConsoleOutputW
253 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW
254 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW
255 #define SetConsoleTitle SetConsoleTitleW
256 #define WriteConsole WriteConsoleW
257 #define WriteConsoleInput WriteConsoleInputW
258 #define WriteConsoleOutput WriteConsoleOutputW
259 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW
260 #else
261 #define AddConsoleAlias AddConsoleAliasA
262 #define FillConsoleOutputCharacter FillConsoleOutputCharacterA
263 #define GetConsoleAlias GetConsoleAliasA
264 #define GetConsoleAliases GetConsoleAliasesA
265 #define GetConsoleAliasesLength GetConsoleAliasesLengthA
266 #define GetConsoleTitle GetConsoleTitleA
267 #define PeekConsoleInput PeekConsoleInputA
268 #define ReadConsole ReadConsoleA
269 #define ReadConsoleInput ReadConsoleInputA
270 #define ReadConsoleOutput ReadConsoleOutputA
271 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA
272 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA
273 #define SetConsoleTitle SetConsoleTitleA
274 #define WriteConsole WriteConsoleA
275 #define WriteConsoleInput WriteConsoleInputA
276 #define WriteConsoleOutput WriteConsoleOutputA
277 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
278 #endif
279
280 #ifdef _MSC_VER
281 #pragma warning(pop)
282 #endif
283
284 #ifdef __cplusplus
285 }
286 #endif
287 #endif