6bb57852a94861cd6c000f4e0224047a7de64321
[reactos.git] / include / reactos / subsys / win / console.h
1 /*
2 * CSRSS Console management structures.
3 */
4
5 #ifndef __CSRCONS_H__
6 #define __CSRCONS_H__
7
8 #include <drivers/blue/ntddblue.h>
9
10
11
12 #define CSRSS_MAX_WRITE_CONSOLE (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE))
13 #define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR))
14 #define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB))
15 #define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR))
16 #define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB))
17
18 #define WRITE_CONSOLE (0x2)
19 #define READ_CONSOLE (0x3)
20 #define ALLOC_CONSOLE (0x4)
21 #define FREE_CONSOLE (0x5)
22 #define SCREEN_BUFFER_INFO (0x7)
23 #define SET_CURSOR (0x8)
24 #define FILL_OUTPUT (0x9)
25 #define READ_INPUT (0xA)
26 #define WRITE_CONSOLE_OUTPUT_CHAR (0xB)
27 #define WRITE_CONSOLE_OUTPUT_ATTRIB (0xC)
28 #define FILL_OUTPUT_ATTRIB (0xD)
29 #define GET_CURSOR_INFO (0xE)
30 #define SET_CURSOR_INFO (0xF)
31 #define SET_ATTRIB (0x10)
32 #define GET_CONSOLE_MODE (0x11)
33 #define SET_CONSOLE_MODE (0x12)
34 #define CREATE_SCREEN_BUFFER (0x13)
35 #define SET_SCREEN_BUFFER (0x14)
36 #define SET_TITLE (0x15)
37 #define GET_TITLE (0x16)
38 #define WRITE_CONSOLE_OUTPUT (0x17)
39 #define FLUSH_INPUT_BUFFER (0x18)
40 #define SCROLL_CONSOLE_SCREEN_BUFFER (0x19)
41 #define READ_CONSOLE_OUTPUT_CHAR (0x1A)
42 #define READ_CONSOLE_OUTPUT_ATTRIB (0x1B)
43 #define GET_NUM_INPUT_EVENTS (0x1C)
44 #define PEEK_CONSOLE_INPUT (0x21)
45 #define READ_CONSOLE_OUTPUT (0x22)
46 #define WRITE_CONSOLE_INPUT (0x23)
47 #define GET_INPUT_HANDLE (0x24)
48 #define GET_OUTPUT_HANDLE (0x25)
49 #define SETGET_CONSOLE_HW_STATE (0x29)
50 #define GET_CONSOLE_WINDOW (0x2A)
51 #define SET_CONSOLE_ICON (0x2E)
52 #define GET_CONSOLE_CP (0x31)
53 #define SET_CONSOLE_CP (0x32)
54 #define GET_CONSOLE_OUTPUT_CP (0x33)
55 #define SET_CONSOLE_OUTPUT_CP (0x34)
56 #define ADD_CONSOLE_ALIAS (0x38)
57 #define GET_CONSOLE_ALIAS (0x39)
58 #define GET_ALL_CONSOLE_ALIASES (0x3A)
59 #define GET_ALL_CONSOLE_ALIASES_LENGTH (0x3B)
60 #define GET_CONSOLE_ALIASES_EXES (0x3C)
61 #define GET_CONSOLE_ALIASES_EXES_LENGTH (0x3D)
62 #define GENERATE_CTRL_EVENT (0x3E)
63 #define SET_SCREEN_BUFFER_SIZE (0x40)
64 #define GET_CONSOLE_SELECTION_INFO (0x41)
65 #define GET_COMMAND_HISTORY_LENGTH (0x42)
66 #define GET_COMMAND_HISTORY (0x43)
67 #define EXPUNGE_COMMAND_HISTORY (0x44)
68 #define SET_HISTORY_NUMBER_COMMANDS (0x45)
69 #define GET_HISTORY_INFO (0x46)
70 #define SET_HISTORY_INFO (0x47)
71
72
73
74
75
76 typedef struct
77 {
78 HANDLE ConsoleHandle;
79 BOOL Unicode;
80 ULONG NrCharactersToWrite;
81 ULONG NrCharactersWritten;
82 HANDLE UnpauseEvent;
83 BYTE Buffer[0];
84 } CSRSS_WRITE_CONSOLE, *PCSRSS_WRITE_CONSOLE;
85
86 typedef struct
87 {
88 HANDLE ConsoleHandle;
89 BOOL Unicode;
90 WORD NrCharactersToRead;
91 WORD NrCharactersRead;
92 HANDLE EventHandle;
93 PVOID Buffer;
94 UNICODE_STRING ExeName;
95 DWORD CtrlWakeupMask;
96 DWORD ControlKeyState;
97 } CSRSS_READ_CONSOLE, *PCSRSS_READ_CONSOLE;
98
99 typedef struct
100 {
101 PCONTROLDISPATCHER CtrlDispatcher;
102 BOOLEAN ConsoleNeeded;
103 INT ShowCmd;
104 HANDLE Console;
105 HANDLE InputHandle;
106 HANDLE OutputHandle;
107 } CSRSS_ALLOC_CONSOLE, *PCSRSS_ALLOC_CONSOLE;
108
109 typedef struct
110 {
111 ULONG Dummy;
112 } CSRSS_FREE_CONSOLE, *PCSRSS_FREE_CONSOLE;
113
114 typedef struct
115 {
116 HANDLE ConsoleHandle;
117 CONSOLE_SCREEN_BUFFER_INFO Info;
118 } CSRSS_SCREEN_BUFFER_INFO, *PCSRSS_SCREEN_BUFFER_INFO;
119
120 typedef struct
121 {
122 HANDLE ConsoleHandle;
123 COORD Position;
124 } CSRSS_SET_CURSOR, *PCSRSS_SET_CURSOR;
125
126 typedef struct
127 {
128 HANDLE ConsoleHandle;
129 BOOL Unicode;
130 union
131 {
132 CHAR AsciiChar;
133 WCHAR UnicodeChar;
134 } Char;
135 COORD Position;
136 WORD Length;
137 ULONG NrCharactersWritten;
138 } CSRSS_FILL_OUTPUT, *PCSRSS_FILL_OUTPUT;
139
140 typedef struct
141 {
142 HANDLE ConsoleHandle;
143 CHAR Attribute;
144 COORD Coord;
145 WORD Length;
146 } CSRSS_FILL_OUTPUT_ATTRIB, *PCSRSS_FILL_OUTPUT_ATTRIB;
147
148 typedef struct
149 {
150 HANDLE ConsoleHandle;
151 BOOL Unicode;
152 INPUT_RECORD Input;
153 BOOL MoreEvents;
154 HANDLE Event;
155 } CSRSS_READ_INPUT, *PCSRSS_READ_INPUT;
156
157 typedef struct
158 {
159 HANDLE ConsoleHandle;
160 BOOL Unicode;
161 WORD Length;
162 COORD Coord;
163 COORD EndCoord;
164 ULONG NrCharactersWritten;
165 CHAR String[0];
166 } CSRSS_WRITE_CONSOLE_OUTPUT_CHAR, *PCSRSS_WRITE_CONSOLE_OUTPUT_CHAR;
167
168 typedef struct
169 {
170 HANDLE ConsoleHandle;
171 WORD Length;
172 COORD Coord;
173 COORD EndCoord;
174 WORD Attribute[0];
175 } CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB, *PCSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB;
176
177 typedef struct
178 {
179 HANDLE ConsoleHandle;
180 CONSOLE_CURSOR_INFO Info;
181 } CSRSS_GET_CURSOR_INFO, *PCSRSS_GET_CURSOR_INFO;
182
183 typedef struct
184 {
185 HANDLE ConsoleHandle;
186 CONSOLE_CURSOR_INFO Info;
187 } CSRSS_SET_CURSOR_INFO, *PCSRSS_SET_CURSOR_INFO;
188
189 typedef struct
190 {
191 HANDLE ConsoleHandle;
192 WORD Attrib;
193 } CSRSS_SET_ATTRIB, *PCSRSS_SET_ATTRIB;
194
195 typedef struct
196 {
197 HANDLE ConsoleHandle;
198 DWORD Mode;
199 } CSRSS_SET_CONSOLE_MODE, *PCSRSS_SET_CONSOLE_MODE;
200
201 typedef struct
202 {
203 HANDLE ConsoleHandle;
204 DWORD ConsoleMode;
205 } CSRSS_GET_CONSOLE_MODE, *PCSRSS_GET_CONSOLE_MODE;
206
207 typedef struct
208 {
209 DWORD Access;
210 DWORD ShareMode;
211 BOOL Inheritable;
212 HANDLE OutputHandle; /* handle to newly created screen buffer */
213 } CSRSS_CREATE_SCREEN_BUFFER, *PCSRSS_CREATE_SCREEN_BUFFER;
214
215 typedef struct
216 {
217 HANDLE OutputHandle; /* handle to screen buffer to switch to */
218 } CSRSS_SET_SCREEN_BUFFER, *PCSRSS_SET_SCREEN_BUFFER;
219
220 typedef struct
221 {
222 DWORD Length;
223 PWCHAR Title;
224 } CSRSS_SET_TITLE, *PCSRSS_SET_TITLE;
225
226 typedef struct
227 {
228 DWORD Length;
229 PWCHAR Title;
230 } CSRSS_GET_TITLE, *PCSRSS_GET_TITLE;
231
232 typedef struct
233 {
234 HANDLE ConsoleHandle;
235 BOOL Unicode;
236 COORD BufferSize;
237 COORD BufferCoord;
238 SMALL_RECT WriteRegion;
239 CHAR_INFO* CharInfo;
240 } CSRSS_WRITE_CONSOLE_OUTPUT, *PCSRSS_WRITE_CONSOLE_OUTPUT;
241
242 typedef struct
243 {
244 HANDLE ConsoleInput;
245 } CSRSS_FLUSH_INPUT_BUFFER, *PCSRSS_FLUSH_INPUT_BUFFER;
246
247 typedef struct
248 {
249 HANDLE ConsoleHandle;
250 BOOL Unicode;
251 SMALL_RECT ScrollRectangle;
252 BOOLEAN UseClipRectangle;
253 SMALL_RECT ClipRectangle;
254 COORD DestinationOrigin;
255 CHAR_INFO Fill;
256 } CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER, *PCSRSS_SCROLL_CONSOLE_SCREEN_BUFFER;
257
258 typedef struct
259 {
260 HANDLE ConsoleHandle;
261 BOOL Unicode;
262 DWORD NumCharsToRead;
263 COORD ReadCoord;
264 COORD EndCoord;
265 DWORD CharsRead;
266 CHAR String[0];
267 } CSRSS_READ_CONSOLE_OUTPUT_CHAR, *PCSRSS_READ_CONSOLE_OUTPUT_CHAR;
268
269 typedef struct
270 {
271 HANDLE ConsoleHandle;
272 DWORD NumAttrsToRead;
273 COORD ReadCoord;
274 COORD EndCoord;
275 WORD Attribute[0];
276 } CSRSS_READ_CONSOLE_OUTPUT_ATTRIB, *PCSRSS_READ_CONSOLE_OUTPUT_ATTRIB;
277
278
279 typedef struct
280 {
281 HANDLE ConsoleHandle;
282 BOOL Unicode;
283 DWORD Length;
284 INPUT_RECORD* InputRecord;
285 } CSRSS_PEEK_CONSOLE_INPUT, *PCSRSS_PEEK_CONSOLE_INPUT;
286
287 typedef struct
288 {
289 HANDLE ConsoleHandle;
290 BOOL Unicode;
291 COORD BufferSize;
292 COORD BufferCoord;
293 SMALL_RECT ReadRegion;
294 CHAR_INFO* CharInfo;
295 } CSRSS_READ_CONSOLE_OUTPUT, *PCSRSS_READ_CONSOLE_OUTPUT;
296
297 typedef struct
298 {
299 HANDLE ConsoleHandle;
300 BOOL Unicode;
301 DWORD Length;
302 INPUT_RECORD* InputRecord;
303 } CSRSS_WRITE_CONSOLE_INPUT, *PCSRSS_WRITE_CONSOLE_INPUT;
304
305 typedef struct
306 {
307 DWORD Access;
308 BOOL Inheritable;
309 HANDLE Handle;
310 DWORD ShareMode;
311 } CSRSS_GET_INPUT_HANDLE, *PCSRSS_GET_INPUT_HANDLE,
312 CSRSS_GET_OUTPUT_HANDLE, *PCSRSS_GET_OUTPUT_HANDLE;
313
314
315 #define CONSOLE_HARDWARE_STATE_GET 0
316 #define CONSOLE_HARDWARE_STATE_SET 1
317
318 #define CONSOLE_HARDWARE_STATE_GDI_MANAGED 0
319 #define CONSOLE_HARDWARE_STATE_DIRECT 1
320
321 typedef struct
322 {
323 HANDLE ConsoleHandle;
324 DWORD SetGet; /* 0=get; 1=set */
325 DWORD State;
326 } CSRSS_SETGET_CONSOLE_HW_STATE, *PCSRSS_SETGET_CONSOLE_HW_STATE;
327
328 typedef struct
329 {
330 HWND WindowHandle;
331 } CSRSS_GET_CONSOLE_WINDOW, *PCSRSS_GET_CONSOLE_WINDOW;
332
333 typedef struct
334 {
335 HICON WindowIcon;
336 } CSRSS_SET_CONSOLE_ICON, *PCSRSS_SET_CONSOLE_ICON;
337
338 typedef struct
339 {
340 ULONG SourceLength;
341 ULONG ExeLength;
342 ULONG TargetLength;
343 } CSRSS_ADD_CONSOLE_ALIAS, *PCSRSS_ADD_CONSOLE_ALIAS;
344
345 typedef struct
346 {
347 ULONG SourceLength;
348 ULONG ExeLength;
349 ULONG BytesWritten;
350 ULONG TargetBufferLength;
351 PVOID TargetBuffer;
352 } CSRSS_GET_CONSOLE_ALIAS, *PCSRSS_GET_CONSOLE_ALIAS;
353
354 typedef struct
355 {
356 LPWSTR lpExeName;
357 DWORD BytesWritten;
358 DWORD AliasBufferLength;
359 LPWSTR AliasBuffer;
360 } CSRSS_GET_ALL_CONSOLE_ALIASES, *PCSRSS_GET_ALL_CONSOLE_ALIAS;
361
362 typedef struct
363 {
364 LPWSTR lpExeName;
365 DWORD Length;
366 } CSRSS_GET_ALL_CONSOLE_ALIASES_LENGTH, *PCSRSS_GET_ALL_CONSOLE_ALIASES_LENGTH;
367
368 typedef struct
369 {
370 DWORD BytesWritten;
371 DWORD Length;
372 LPWSTR ExeNames;
373 } CSRSS_GET_CONSOLE_ALIASES_EXES, *PCSRSS_GET_CONSOLE_ALIASES_EXES;
374
375 typedef struct
376 {
377 DWORD Length;
378 } CSRSS_GET_CONSOLE_ALIASES_EXES_LENGTH, *PCSRSS_GET_CONSOLE_ALIASES_EXES_LENGTH;
379
380 typedef struct
381 {
382 DWORD Event;
383 DWORD ProcessGroup;
384 } CSRSS_GENERATE_CTRL_EVENT, *PCSRSS_GENERATE_CTRL_EVENT;
385
386 typedef struct
387 {
388 HANDLE ConsoleHandle;
389 DWORD NumInputEvents;
390 } CSRSS_GET_NUM_INPUT_EVENTS, *PCSRSS_GET_NUM_INPUT_EVENTS;
391
392 typedef struct
393 {
394 HANDLE OutputHandle;
395 COORD Size;
396 } CSRSS_SET_SCREEN_BUFFER_SIZE, *PCSRSS_SET_SCREEN_BUFFER_SIZE;
397
398 typedef struct
399 {
400 CONSOLE_SELECTION_INFO Info;
401 } CSRSS_GET_CONSOLE_SELECTION_INFO, *PCSRSS_GET_CONSOLE_SELECTION_INFO;
402
403 typedef struct
404 {
405 UNICODE_STRING ExeName;
406 DWORD Length;
407 } CSRSS_GET_COMMAND_HISTORY_LENGTH, *PCSRSS_GET_COMMAND_HISTORY_LENGTH;
408
409 typedef struct
410 {
411 UNICODE_STRING ExeName;
412 PWCHAR History;
413 DWORD Length;
414 } CSRSS_GET_COMMAND_HISTORY, *PCSRSS_GET_COMMAND_HISTORY;
415
416 typedef struct
417 {
418 UNICODE_STRING ExeName;
419 } CSRSS_EXPUNGE_COMMAND_HISTORY, *PCSRSS_EXPUNGE_COMMAND_HISTORY;
420
421 typedef struct
422 {
423 UNICODE_STRING ExeName;
424 DWORD NumCommands;
425 } CSRSS_SET_HISTORY_NUMBER_COMMANDS, *PCSRSS_SET_HISTORY_NUMBER_COMMANDS;
426
427 typedef struct
428 {
429 DWORD HistoryBufferSize;
430 DWORD NumberOfHistoryBuffers;
431 DWORD dwFlags;
432 } CSRSS_GET_HISTORY_INFO, *PCSRSS_GET_HISTORY_INFO,
433 CSRSS_SET_HISTORY_INFO, *PCSRSS_SET_HISTORY_INFO;;
434
435
436 typedef struct
437 {
438 UINT CodePage;
439 } CSRSS_GET_CONSOLE_CP, *PCSRSS_GET_CONSOLE_CP;
440
441 typedef struct
442 {
443 UINT CodePage;
444 } CSRSS_SET_CONSOLE_CP, *PCSRSS_SET_CONSOLE_CP;
445
446 typedef struct
447 {
448 UINT CodePage;
449 } CSRSS_GET_CONSOLE_OUTPUT_CP, *PCSRSS_GET_CONSOLE_OUTPUT_CP;
450
451 typedef struct
452 {
453 UINT CodePage;
454 } CSRSS_SET_CONSOLE_OUTPUT_CP, *PCSRSS_SET_CONSOLE_OUTPUT_CP;
455
456
457
458
459
460
461
462
463
464
465
466
467 #if 0
468
469 CSRSS_WRITE_CONSOLE WriteConsoleRequest;
470 CSRSS_READ_CONSOLE ReadConsoleRequest;
471 CSRSS_ALLOC_CONSOLE AllocConsoleRequest;
472 CSRSS_FREE_CONSOLE FreeConsoleRequest;
473 CSRSS_SCREEN_BUFFER_INFO ScreenBufferInfoRequest;
474 CSRSS_SET_CURSOR SetCursorRequest;
475 CSRSS_FILL_OUTPUT FillOutputRequest;
476 CSRSS_FILL_OUTPUT_ATTRIB FillOutputAttribRequest;
477 CSRSS_READ_INPUT ReadInputRequest;
478 CSRSS_WRITE_CONSOLE_OUTPUT_CHAR WriteConsoleOutputCharRequest;
479 CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB WriteConsoleOutputAttribRequest;
480 CSRSS_GET_CURSOR_INFO GetCursorInfoRequest;
481 CSRSS_SET_CURSOR_INFO SetCursorInfoRequest;
482 CSRSS_SET_ATTRIB SetAttribRequest;
483 CSRSS_SET_CONSOLE_MODE SetConsoleModeRequest;
484 CSRSS_GET_CONSOLE_MODE GetConsoleModeRequest;
485 CSRSS_CREATE_SCREEN_BUFFER CreateScreenBufferRequest;
486 CSRSS_SET_SCREEN_BUFFER SetScreenBufferRequest;
487 CSRSS_SET_TITLE SetTitleRequest;
488 CSRSS_GET_TITLE GetTitleRequest;
489 CSRSS_WRITE_CONSOLE_OUTPUT WriteConsoleOutputRequest;
490 CSRSS_FLUSH_INPUT_BUFFER FlushInputBufferRequest;
491 CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER ScrollConsoleScreenBufferRequest;
492 CSRSS_READ_CONSOLE_OUTPUT_CHAR ReadConsoleOutputCharRequest;
493 CSRSS_READ_CONSOLE_OUTPUT_ATTRIB ReadConsoleOutputAttribRequest;
494 CSRSS_PEEK_CONSOLE_INPUT PeekConsoleInputRequest;
495 CSRSS_READ_CONSOLE_OUTPUT ReadConsoleOutputRequest;
496 CSRSS_WRITE_CONSOLE_INPUT WriteConsoleInputRequest;
497 CSRSS_GET_INPUT_HANDLE GetInputHandleRequest;
498 CSRSS_GET_OUTPUT_HANDLE GetOutputHandleRequest;
499 CSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest;
500 CSRSS_GET_CONSOLE_WINDOW GetConsoleWindowRequest;
501 CSRSS_SET_CONSOLE_ICON SetConsoleIconRequest;
502 CSRSS_ADD_CONSOLE_ALIAS AddConsoleAlias;
503 CSRSS_GET_CONSOLE_ALIAS GetConsoleAlias;
504 CSRSS_GET_ALL_CONSOLE_ALIASES GetAllConsoleAlias;
505 CSRSS_GET_ALL_CONSOLE_ALIASES_LENGTH GetAllConsoleAliasesLength;
506 CSRSS_GET_CONSOLE_ALIASES_EXES GetConsoleAliasesExes;
507 CSRSS_GET_CONSOLE_ALIASES_EXES_LENGTH GetConsoleAliasesExesLength;
508 CSRSS_GENERATE_CTRL_EVENT GenerateCtrlEvent;
509 CSRSS_GET_NUM_INPUT_EVENTS GetNumInputEventsRequest;
510 CSRSS_SET_SCREEN_BUFFER_SIZE SetScreenBufferSize;
511 CSRSS_GET_CONSOLE_SELECTION_INFO GetConsoleSelectionInfo;
512 CSRSS_GET_COMMAND_HISTORY_LENGTH GetCommandHistoryLength;
513 CSRSS_GET_COMMAND_HISTORY GetCommandHistory;
514 CSRSS_EXPUNGE_COMMAND_HISTORY ExpungeCommandHistory;
515 CSRSS_SET_HISTORY_NUMBER_COMMANDS SetHistoryNumberCommands;
516 CSRSS_GET_HISTORY_INFO GetHistoryInfo;
517 CSRSS_SET_HISTORY_INFO SetHistoryInfo;
518 CSRSS_GET_CONSOLE_CP GetConsoleCodePage;
519 CSRSS_SET_CONSOLE_CP SetConsoleCodePage;
520 CSRSS_GET_CONSOLE_OUTPUT_CP GetConsoleOutputCodePage;
521 CSRSS_SET_CONSOLE_OUTPUT_CP SetConsoleOutputCodePage;
522
523 #endif
524
525
526
527 #endif // __CSRCONS_H__
528
529 /* EOF */