xref: /reactos/base/system/smss/smss.h (revision 5c7ce447)
1 /*
2  * PROJECT:         ReactOS Windows-Compatible Session Manager
3  * LICENSE:         BSD 2-Clause License
4  * FILE:            base/system/smss/smss.h
5  * PURPOSE:         Main SMSS Header
6  * PROGRAMMERS:     Alex Ionescu
7  */
8 
9 /* DEPENDENCIES ***************************************************************/
10 #ifndef _SM_
11 #define _SM_
12 
13 #include <stdio.h>
14 
15 /* Native Headers */
16 #define WIN32_NO_STATUS
17 #include <windef.h>
18 #include <winbase.h>
19 #include <winreg.h>
20 
21 #define NTOS_MODE_USER
22 #include <ndk/iofuncs.h>
23 #include <ndk/obfuncs.h>
24 #include <ndk/rtlfuncs.h>
25 #include <ndk/cmfuncs.h>
26 #include <ndk/exfuncs.h>
27 #include <ndk/mmfuncs.h>
28 #include <ndk/psfuncs.h>
29 #include <ndk/lpcfuncs.h>
30 #include <ndk/setypes.h>
31 #include <ndk/umfuncs.h>
32 #include <ndk/kefuncs.h>
33 
34 #include <ntstrsafe.h>
35 
36 /* SM Protocol Header */
37 #include <sm/smmsg.h>
38 
39 /* DEFINES ********************************************************************/
40 
41 #define SMP_DEBUG_FLAG      0x01
42 #define SMP_ASYNC_FLAG      0x02
43 #define SMP_AUTOCHK_FLAG    0x04
44 #define SMP_SUBSYSTEM_FLAG  0x08
45 #define SMP_INVALID_PATH    0x10
46 #define SMP_DEFERRED_FLAG   0x20
47 #define SMP_POSIX_FLAG      0x100
48 #define SMP_OS2_FLAG        0x200
49 
50 /* STRUCTURES *****************************************************************/
51 
52 typedef struct _SMP_REGISTRY_VALUE
53 {
54     LIST_ENTRY Entry;
55     UNICODE_STRING Name;
56     UNICODE_STRING Value;
57     PCHAR AnsiValue;
58 } SMP_REGISTRY_VALUE, *PSMP_REGISTRY_VALUE;
59 
60 typedef struct _SMP_SUBSYSTEM
61 {
62     LIST_ENTRY Entry;
63     HANDLE Event;
64     HANDLE ProcessHandle;
65     ULONG ImageType;
66     HANDLE PortHandle;
67     HANDLE SbApiPort;
68     CLIENT_ID ClientId;
69     ULONG MuSessionId;
70     BOOLEAN Terminating;
71     ULONG ReferenceCount;
72 } SMP_SUBSYSTEM, *PSMP_SUBSYSTEM;
73 
74 /* EXTERNALS ******************************************************************/
75 
76 extern RTL_CRITICAL_SECTION SmpKnownSubSysLock;
77 extern LIST_ENTRY SmpKnownSubSysHead;
78 extern RTL_CRITICAL_SECTION SmpSessionListLock;
79 extern LIST_ENTRY SmpSessionListHead;
80 extern ULONG SmpNextSessionId;
81 extern ULONG SmpNextSessionIdScanMode;
82 extern BOOLEAN SmpDbgSsLoaded;
83 extern HANDLE SmpWindowsSubSysProcess;
84 extern HANDLE SmpSessionsObjectDirectory;
85 extern HANDLE SmpWindowsSubSysProcessId;
86 extern BOOLEAN RegPosixSingleInstance;
87 extern UNICODE_STRING SmpDebugKeyword, SmpASyncKeyword, SmpAutoChkKeyword;
88 extern PVOID SmpHeap;
89 extern ULONG SmBaseTag;
90 extern UNICODE_STRING SmpSystemRoot;
91 extern PWCHAR SmpDefaultEnvironment;
92 extern UNICODE_STRING SmpDefaultLibPath;
93 extern LIST_ENTRY SmpSetupExecuteList;
94 extern LIST_ENTRY SmpSubSystemsToLoad;
95 extern LIST_ENTRY SmpExecuteList;
96 extern LIST_ENTRY SmpSubSystemList;
97 extern ULONG AttachedSessionId;
98 extern BOOLEAN SmpDebug;
99 
100 /* FUNCTIONS ******************************************************************/
101 
102 NTSTATUS
103 NTAPI
104 SmpTerminate(
105     IN PULONG_PTR Parameters,
106     IN ULONG ParameterMask,
107     IN ULONG ParameterCount
108 );
109 
110 NTSTATUS
111 NTAPI
112 SmpCreateSecurityDescriptors(
113     IN BOOLEAN InitialCall
114 );
115 
116 NTSTATUS
117 NTAPI
118 SmpInit(
119     IN PUNICODE_STRING InitialCommand,
120     OUT PHANDLE ProcessHandle
121 );
122 
123 NTSTATUS
124 NTAPI
125 SmpAcquirePrivilege(
126     IN ULONG Privilege,
127     OUT PVOID *PrivilegeStat
128 );
129 
130 VOID
131 NTAPI
132 SmpReleasePrivilege(
133     IN PVOID State
134 );
135 
136 ULONG
137 NTAPI
138 SmpApiLoop(
139     IN PVOID Parameter
140 );
141 
142 NTSTATUS
143 NTAPI
144 SmpExecuteCommand(
145     IN PUNICODE_STRING CommandLine,
146     IN ULONG MuSessionId,
147     OUT PHANDLE ProcessId,
148     IN ULONG Flags
149 );
150 
151 NTSTATUS
152 NTAPI
153 SmpLoadSubSystemsForMuSession(
154     IN PULONG MuSessionId,
155     OUT PHANDLE ProcessId,
156     IN PUNICODE_STRING InitialCommand
157 );
158 
159 VOID
160 NTAPI
161 SmpPagingFileInitialize(
162     VOID
163 );
164 
165 NTSTATUS
166 NTAPI
167 SmpCreatePagingFileDescriptor(
168     IN PUNICODE_STRING PageFileToken
169 );
170 
171 NTSTATUS
172 NTAPI
173 SmpCreatePagingFiles(
174     VOID
175 );
176 
177 NTSTATUS
178 NTAPI
179 SmpParseCommandLine(
180     IN PUNICODE_STRING CommandLine,
181     OUT PULONG Flags,
182     OUT PUNICODE_STRING FileName,
183     OUT PUNICODE_STRING Directory,
184     OUT PUNICODE_STRING Arguments
185 );
186 
187 NTSTATUS
188 NTAPI
189 SmpLoadSubSystem(
190     IN PUNICODE_STRING FileName,
191     IN PUNICODE_STRING Directory,
192     IN PUNICODE_STRING CommandLine,
193     IN ULONG MuSessionId,
194     OUT PHANDLE ProcessId,
195     IN ULONG Flags
196 );
197 
198 NTSTATUS
199 NTAPI
200 SmpSetProcessMuSessionId(
201     IN HANDLE ProcessHandle,
202     IN ULONG SessionId
203 );
204 
205 BOOLEAN
206 NTAPI
207 SmpQueryRegistrySosOption(
208     VOID
209 );
210 
211 BOOLEAN
212 NTAPI
213 SmpSaveAndClearBootStatusData(
214     OUT PBOOLEAN BootOkay,
215     OUT PBOOLEAN ShutdownOkay
216 );
217 
218 VOID
219 NTAPI
220 SmpRestoreBootStatusData(
221     IN BOOLEAN BootOkay,
222     IN BOOLEAN ShutdownOkay
223 );
224 
225 BOOLEAN
226 NTAPI
227 SmpCheckForCrashDump(
228     IN PUNICODE_STRING FileName
229 );
230 
231 VOID
232 NTAPI
233 SmpTranslateSystemPartitionInformation(
234     VOID
235 );
236 
237 PSMP_SUBSYSTEM
238 NTAPI
239 SmpLocateKnownSubSysByCid(
240     IN PCLIENT_ID ClientId
241 );
242 
243 PSMP_SUBSYSTEM
244 NTAPI
245 SmpLocateKnownSubSysByType(
246     IN ULONG MuSessionId,
247     IN ULONG ImageType
248 );
249 
250 NTSTATUS
251 NTAPI
252 SmpGetProcessMuSessionId(
253     IN HANDLE ProcessHandle,
254     OUT PULONG SessionId
255 );
256 
257 VOID
258 NTAPI
259 SmpDereferenceSubsystem(
260     IN PSMP_SUBSYSTEM SubSystem
261 );
262 
263 NTSTATUS
264 NTAPI
265 SmpSbCreateSession(
266     IN PVOID Reserved,
267     IN PSMP_SUBSYSTEM OtherSubsystem,
268     IN PRTL_USER_PROCESS_INFORMATION ProcessInformation,
269     IN ULONG MuSessionId,
270     IN PCLIENT_ID DbgClientId
271 );
272 
273 ULONG
274 NTAPI
275 SmpAllocateSessionId(
276     IN PSMP_SUBSYSTEM Subsystem,
277     IN PSMP_SUBSYSTEM OtherSubsystem
278 );
279 
280 VOID
281 NTAPI
282 SmpDeleteSession(
283     IN ULONG SessionId
284 );
285 
286 BOOLEAN
287 NTAPI
288 SmpCheckDuplicateMuSessionId(
289     IN ULONG MuSessionId
290 );
291 
292 NTSTATUS
293 NTAPI
294 SmpExecuteImage(
295     IN PUNICODE_STRING FileName,
296     IN PUNICODE_STRING Directory,
297     IN PUNICODE_STRING CommandLine,
298     IN ULONG MuSessionId,
299     IN ULONG Flags,
300     IN PRTL_USER_PROCESS_INFORMATION ProcessInformation
301 );
302 
303 #endif /* _SM_ */
304