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