ReactOS 0.4.15-dev-8419-g7f0e8a3
api.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: win32ss/user/winsrv/consrv/api.h
5 * PURPOSE: Public server APIs definitions
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7 */
8
9#pragma once
10
11/*
12 * Helper macros to define the CSR_API_ROUTINE-s defined in CONSRV,
13 * factoring out the common prologue and epilogue code, and including
14 * the necessary local variables.
15 */
16
17#define CON_API_NOCONSOLE_IMPL(Name, TYPE, RequestName) \
18 NTSTATUS \
19 Name##Impl( \
20 IN PCONSOLE_PROCESS_DATA ProcessData, \
21 IN OUT PCSR_API_MESSAGE ApiMessage, \
22 IN TYPE* RequestName, /* Request */ \
23 IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
24
25// NTSTATUS NTAPI
26// Name(
27 // IN OUT PCSR_API_MESSAGE ApiMessage,
28 // IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
29#define CON_API_NOCONSOLE_ENTRY(Name, TYPE, RequestName) \
30 CON_API_NOCONSOLE_IMPL(Name, TYPE, RequestName); \
31 CSR_API(Name) \
32 { \
33 TYPE* RequestName = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.RequestName; \
34 PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); \
35 \
36 return Name##Impl(ProcessData, ApiMessage, RequestName, ReplyCode); \
37 }
38
39#define CON_API_NOCONSOLE(Name, TYPE, RequestName) \
40 CON_API_NOCONSOLE_ENTRY(Name, TYPE, RequestName); \
41 CON_API_NOCONSOLE_IMPL(Name, TYPE, RequestName)
42
43
44
45#define CON_API_IMPL(Name, TYPE, RequestName) \
46 NTSTATUS \
47 Name##Impl( \
48 IN PCONSOLE_PROCESS_DATA ProcessData, \
49 IN PCONSRV_CONSOLE Console, \
50 IN OUT PCSR_API_MESSAGE ApiMessage, \
51 IN TYPE* RequestName, /* Request */ \
52 IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
53
54// NTSTATUS NTAPI
55// Name(
56 // IN OUT PCSR_API_MESSAGE ApiMessage,
57 // IN OUT PCSR_REPLY_CODE ReplyCode OPTIONAL)
58#define CON_API_ENTRY(Name, TYPE, RequestName) \
59 CON_API_IMPL(Name, TYPE, RequestName); \
60 CSR_API(Name) \
61 { \
62 NTSTATUS Status; \
63 TYPE* RequestName = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.RequestName; \
64 PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process); \
65 PCONSRV_CONSOLE Console; \
66 \
67 Status = ConSrvGetConsole(ProcessData, \
68 /* RequestName->ConsoleHandle, */ \
69 &Console, TRUE); \
70 if (!NT_SUCCESS(Status)) \
71 return Status; \
72 \
73 Status = Name##Impl(ProcessData, Console, \
74 ApiMessage, RequestName, ReplyCode); \
75 \
76 ConSrvReleaseConsole(Console, TRUE); \
77 return Status; \
78 }
79
80#define CON_API(Name, TYPE, RequestName) \
81 CON_API_ENTRY(Name, TYPE, RequestName); \
82 CON_API_IMPL(Name, TYPE, RequestName)
83
84
85/*
86 * List of CSR_API_ROUTINE-s defined in this module.
87 */
88
89/* alias.c */
90CSR_API(SrvAddConsoleAlias);
91CSR_API(SrvGetConsoleAlias);
92CSR_API(SrvGetConsoleAliases);
93CSR_API(SrvGetConsoleAliasesLength);
94CSR_API(SrvGetConsoleAliasExes);
95CSR_API(SrvGetConsoleAliasExesLength);
96
97/* coninput.c */
98CSR_API(SrvReadConsole);
99CSR_API(SrvGetConsoleInput);
100CSR_API(SrvWriteConsoleInput);
101CSR_API(SrvFlushConsoleInputBuffer);
102CSR_API(SrvGetConsoleNumberOfInputEvents);
103
104/* conoutput.c */
105CSR_API(SrvInvalidateBitMapRect);
106CSR_API(SrvSetConsolePalette);
107CSR_API(SrvReadConsoleOutput);
108CSR_API(SrvWriteConsole);
109CSR_API(SrvWriteConsoleOutput);
110CSR_API(SrvReadConsoleOutputString);
111CSR_API(SrvWriteConsoleOutputString);
112CSR_API(SrvFillConsoleOutput);
113CSR_API(SrvGetConsoleCursorInfo);
114CSR_API(SrvSetConsoleCursorInfo);
115CSR_API(SrvSetConsoleCursorPosition);
116CSR_API(SrvSetConsoleTextAttribute);
117CSR_API(SrvCreateConsoleScreenBuffer);
118CSR_API(SrvGetConsoleScreenBufferInfo);
119CSR_API(SrvSetConsoleActiveScreenBuffer);
120CSR_API(SrvSetConsoleScreenBufferSize);
121CSR_API(SrvScrollConsoleScreenBuffer);
122CSR_API(SrvSetConsoleWindowInfo);
123
124/* console.c */
125CSR_API(SrvAllocConsole);
126CSR_API(SrvAttachConsole);
127CSR_API(SrvFreeConsole);
128CSR_API(SrvGetConsoleMode);
129CSR_API(SrvSetConsoleMode);
130CSR_API(SrvGetConsoleTitle);
131CSR_API(SrvSetConsoleTitle);
132CSR_API(SrvGetConsoleCP);
133CSR_API(SrvSetConsoleCP);
134CSR_API(SrvGetConsoleProcessList);
135CSR_API(SrvGenerateConsoleCtrlEvent);
136CSR_API(SrvConsoleNotifyLastClose);
137
138CSR_API(SrvGetConsoleMouseInfo);
139CSR_API(SrvSetConsoleKeyShortcuts);
140CSR_API(SrvGetConsoleKeyboardLayoutName);
141CSR_API(SrvGetConsoleCharType);
142CSR_API(SrvSetConsoleLocalEUDC);
143CSR_API(SrvSetConsoleCursorMode);
144CSR_API(SrvGetConsoleCursorMode);
145CSR_API(SrvGetConsoleNlsMode);
146CSR_API(SrvSetConsoleNlsMode);
147CSR_API(SrvGetConsoleLangId);
148
149/* frontendctl.c */
150CSR_API(SrvGetConsoleHardwareState);
151CSR_API(SrvSetConsoleHardwareState);
152CSR_API(SrvGetConsoleDisplayMode);
153CSR_API(SrvSetConsoleDisplayMode);
154CSR_API(SrvGetLargestConsoleWindowSize);
155CSR_API(SrvShowConsoleCursor);
156CSR_API(SrvSetConsoleCursor);
157CSR_API(SrvConsoleMenuControl);
158CSR_API(SrvSetConsoleMenuClose);
159
160/* Used by USERSRV!SrvGetThreadConsoleDesktop() */
162NTAPI
164 IN ULONG_PTR ThreadId,
165 OUT HDESK* ConsoleDesktop);
166
167CSR_API(SrvGetConsoleWindow);
168CSR_API(SrvSetConsoleIcon);
169CSR_API(SrvGetConsoleSelectionInfo);
170
171CSR_API(SrvGetConsoleNumberOfFonts);
172CSR_API(SrvGetConsoleFontInfo);
173CSR_API(SrvGetConsoleFontSize);
174CSR_API(SrvGetConsoleCurrentFont);
175CSR_API(SrvSetConsoleFont);
176
177/* handle.c */
178CSR_API(SrvOpenConsole);
179CSR_API(SrvDuplicateHandle);
180CSR_API(SrvGetHandleInformation);
181CSR_API(SrvSetHandleInformation);
182CSR_API(SrvCloseHandle);
183CSR_API(SrvVerifyConsoleIoHandle);
184
185/* history.c */
186CSR_API(SrvGetConsoleCommandHistory);
187CSR_API(SrvGetConsoleCommandHistoryLength);
188CSR_API(SrvExpungeConsoleCommandHistory);
189CSR_API(SrvSetConsoleNumberOfCommands);
190CSR_API(SrvGetConsoleHistory);
191CSR_API(SrvSetConsoleHistory);
192CSR_API(SrvSetConsoleCommandHistoryMode);
193
194/* subsysreg.c */
195CSR_API(SrvRegisterConsoleVDM);
196CSR_API(SrvVDMConsoleOperation);
197CSR_API(SrvRegisterConsoleOS2);
198CSR_API(SrvSetConsoleOS2OemFormat);
199CSR_API(SrvRegisterConsoleIME);
200CSR_API(SrvUnregisterConsoleIME);
201
202/* EOF */
LONG NTSTATUS
Definition: precomp.h:26
#define CSR_API(n)
Definition: csrsrv.h:176
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
NTSTATUS NTAPI GetThreadConsoleDesktop(IN ULONG_PTR ThreadId, OUT HDESK *ConsoleDesktop)
Definition: frontendctl.c:265