[PSDK]
[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
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
152 typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX {
153 ULONG cbSize;
154 COORD dwSize;
155 COORD dwCursorPosition;
156 WORD wAttributes;
157 SMALL_RECT srWindow;
158 COORD dwMaximumWindowSize;
159 WORD wPopupAttributes;
160 COLORREF ColorTable[16];
161 } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX;
162
163 #ifndef NOGDI
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 #endif
174
175 BOOL WINAPI AllocConsole(void);
176 #if (_WIN32_WINNT >= 0x0501)
177 #define ATTACH_PARENT_PROCESS (DWORD)-1
178 BOOL WINAPI AttachConsole(DWORD);
179 BOOL WINAPI AddConsoleAliasA(LPCSTR,LPCSTR,LPCSTR);
180 BOOL WINAPI AddConsoleAliasW(LPCWSTR,LPCWSTR,LPCWSTR);
181 DWORD WINAPI GetConsoleAliasA(LPSTR,LPSTR,DWORD,LPSTR);
182 DWORD WINAPI GetConsoleAliasW(LPWSTR,LPWSTR,DWORD,LPWSTR);
183 DWORD WINAPI GetConsoleAliasesA(LPSTR,DWORD,LPSTR);
184 DWORD WINAPI GetConsoleAliasesW(LPWSTR,DWORD,LPWSTR);
185 DWORD WINAPI GetConsoleAliasesLengthA(LPSTR);
186 DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR);
187 #endif
188 HANDLE WINAPI CreateConsoleScreenBuffer(DWORD,DWORD,CONST SECURITY_ATTRIBUTES*,DWORD,LPVOID);
189 BOOL WINAPI FillConsoleOutputAttribute(HANDLE,WORD,DWORD,COORD,PDWORD);
190 BOOL WINAPI FillConsoleOutputCharacterA(HANDLE,CHAR,DWORD,COORD,PDWORD);
191 BOOL WINAPI FillConsoleOutputCharacterW(HANDLE,WCHAR,DWORD,COORD,PDWORD);
192 BOOL WINAPI FlushConsoleInputBuffer(HANDLE);
193 BOOL WINAPI FreeConsole(void);
194 BOOL WINAPI GenerateConsoleCtrlEvent(DWORD,DWORD);
195 UINT WINAPI GetConsoleCP(void);
196 BOOL WINAPI GetConsoleCursorInfo(HANDLE,PCONSOLE_CURSOR_INFO);
197 BOOL WINAPI GetConsoleMode(HANDLE,PDWORD);
198 UINT WINAPI GetConsoleOutputCP(void);
199 BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE,PCONSOLE_SCREEN_BUFFER_INFO);
200 DWORD WINAPI GetConsoleTitleA(LPSTR,DWORD);
201 DWORD WINAPI GetConsoleTitleW(LPWSTR,DWORD);
202 #if (_WIN32_WINNT >= 0x0500)
203 HWND WINAPI GetConsoleWindow(void);
204 #endif
205 COORD WINAPI GetLargestConsoleWindowSize(HANDLE);
206 BOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE,PDWORD);
207 BOOL WINAPI GetNumberOfConsoleMouseButtons(PDWORD);
208 BOOL WINAPI PeekConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
209 BOOL WINAPI PeekConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
210 BOOL WINAPI ReadConsoleA(HANDLE,PVOID,DWORD,PDWORD,PCONSOLE_READCONSOLE_CONTROL);
211 BOOL WINAPI ReadConsoleW(HANDLE,PVOID,DWORD,PDWORD,PCONSOLE_READCONSOLE_CONTROL);
212 BOOL WINAPI ReadConsoleInputA(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
213 BOOL WINAPI ReadConsoleInputW(HANDLE,PINPUT_RECORD,DWORD,PDWORD);
214 BOOL WINAPI ReadConsoleOutputAttribute(HANDLE,LPWORD,DWORD,COORD,LPDWORD);
215 BOOL WINAPI ReadConsoleOutputCharacterA(HANDLE,LPSTR,DWORD,COORD,PDWORD);
216 BOOL WINAPI ReadConsoleOutputCharacterW(HANDLE,LPWSTR,DWORD,COORD,PDWORD);
217 BOOL WINAPI ReadConsoleOutputA(HANDLE,PCHAR_INFO,COORD,COORD,PSMALL_RECT);
218 BOOL WINAPI ReadConsoleOutputW(HANDLE,PCHAR_INFO,COORD,COORD,PSMALL_RECT);
219 BOOL WINAPI ScrollConsoleScreenBufferA(HANDLE,const SMALL_RECT*,const SMALL_RECT*,COORD,const CHAR_INFO*);
220 BOOL WINAPI ScrollConsoleScreenBufferW(HANDLE,const SMALL_RECT*,const SMALL_RECT*,COORD,const CHAR_INFO*);
221 BOOL WINAPI SetConsoleActiveScreenBuffer(HANDLE);
222 BOOL WINAPI SetConsoleCP(UINT);
223 BOOL WINAPI SetConsoleCtrlHandler(PHANDLER_ROUTINE,BOOL);
224 BOOL WINAPI SetConsoleCursorInfo(HANDLE,const CONSOLE_CURSOR_INFO*);
225 BOOL WINAPI SetConsoleCursorPosition(HANDLE,COORD);
226 BOOL WINAPI SetConsoleMode(HANDLE,DWORD);
227 BOOL WINAPI SetConsoleOutputCP(UINT);
228 BOOL WINAPI SetConsoleScreenBufferSize(HANDLE,COORD);
229 BOOL WINAPI SetConsoleTextAttribute(HANDLE,WORD);
230 BOOL WINAPI SetConsoleTitleA(LPCSTR);
231 BOOL WINAPI SetConsoleTitleW(LPCWSTR);
232 BOOL WINAPI SetConsoleWindowInfo(HANDLE,BOOL,const SMALL_RECT*);
233 BOOL WINAPI WriteConsoleA(HANDLE,CONST VOID*,DWORD,LPDWORD,LPVOID);
234 BOOL WINAPI WriteConsoleW(HANDLE,CONST VOID*,DWORD,LPDWORD,LPVOID);
235 BOOL WINAPI WriteConsoleInputA(HANDLE,const INPUT_RECORD*,DWORD,PDWORD);
236 BOOL WINAPI WriteConsoleInputW(HANDLE,const INPUT_RECORD*,DWORD,PDWORD);
237 BOOL WINAPI WriteConsoleOutputA(HANDLE,const CHAR_INFO*,COORD,COORD,PSMALL_RECT);
238 BOOL WINAPI WriteConsoleOutputW(HANDLE,const CHAR_INFO*,COORD,COORD,PSMALL_RECT);
239 BOOL WINAPI WriteConsoleOutputAttribute(HANDLE,const WORD*,DWORD,COORD,PDWORD);
240 BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE,LPCSTR,DWORD,COORD,PDWORD);
241 BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,PDWORD);
242
243 #ifdef UNICODE
244 #define FillConsoleOutputCharacter FillConsoleOutputCharacterW
245 #define AddConsoleAlias AddConsoleAliasW
246 #define GetConsoleAlias GetConsoleAliasW
247 #define GetConsoleAliases GetConsoleAliasesW
248 #define GetConsoleAliasesLength GetConsoleAliasesLengthW
249 #define GetConsoleTitle GetConsoleTitleW
250 #define PeekConsoleInput PeekConsoleInputW
251 #define ReadConsole ReadConsoleW
252 #define ReadConsoleInput ReadConsoleInputW
253 #define ReadConsoleOutput ReadConsoleOutputW
254 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW
255 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW
256 #define SetConsoleTitle SetConsoleTitleW
257 #define WriteConsole WriteConsoleW
258 #define WriteConsoleInput WriteConsoleInputW
259 #define WriteConsoleOutput WriteConsoleOutputW
260 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW
261 #else
262 #define AddConsoleAlias AddConsoleAliasA
263 #define FillConsoleOutputCharacter FillConsoleOutputCharacterA
264 #define GetConsoleAlias GetConsoleAliasA
265 #define GetConsoleAliases GetConsoleAliasesA
266 #define GetConsoleAliasesLength GetConsoleAliasesLengthA
267 #define GetConsoleTitle GetConsoleTitleA
268 #define PeekConsoleInput PeekConsoleInputA
269 #define ReadConsole ReadConsoleA
270 #define ReadConsoleInput ReadConsoleInputA
271 #define ReadConsoleOutput ReadConsoleOutputA
272 #define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA
273 #define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA
274 #define SetConsoleTitle SetConsoleTitleA
275 #define WriteConsole WriteConsoleA
276 #define WriteConsoleInput WriteConsoleInputA
277 #define WriteConsoleOutput WriteConsoleOutputA
278 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
279 #endif
280
281 #ifdef _MSC_VER
282 #pragma warning(pop)
283 #endif
284
285 #ifdef __cplusplus
286 }
287 #endif
288 #endif