ReactOS 0.4.17-dev-650-gd0e71de
smss.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Windows-Compatible Session Manager
3 * LICENSE: BSD 2-Clause License
4 * FILE: base/system/smss/smss.c
5 * PURPOSE: Main SMSS Code
6 * PROGRAMMERS: Alex Ionescu
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "smss.h"
12
13#include <pseh/pseh2.h>
14
15#define NDEBUG
16#include <debug.h>
17
18/* GLOBALS ********************************************************************/
19
25
26/* FUNCTIONS ******************************************************************/
27
32 IN PUNICODE_STRING CommandLine,
33 IN ULONG MuSessionId,
35 IN PRTL_USER_PROCESS_INFORMATION ProcessInformation)
36{
39 RTL_USER_PROCESS_INFORMATION LocalProcessInfo;
40 PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
41
42 /* Use the input process information if we have it, otherwise use local */
43 ProcessInfo = ProcessInformation;
44 if (!ProcessInfo) ProcessInfo = &LocalProcessInfo;
45
46 /* Create parameters for the target process */
47 Status = RtlCreateProcessParameters(&ProcessParameters,
52 CommandLine,
54 NULL,
55 NULL,
56 NULL,
57 0);
58 if (!NT_SUCCESS(Status))
59 {
60 /* This is a pretty bad failure. ASSERT on checked builds and exit */
61 ASSERTMSG("RtlCreateProcessParameters failed.\n", NT_SUCCESS(Status));
62 DPRINT1("SMSS: RtlCreateProcessParameters failed for %wZ - Status == %lx\n",
64 return Status;
65 }
66
67 /* Set the size field as required */
68 ProcessInfo->Size = sizeof(*ProcessInfo);
69
70 /* Check if the debug flag was requested */
72 {
73 /* Write it in the process parameters */
74 ProcessParameters->DebugFlags = 1;
75 }
76 else
77 {
78 /* Otherwise inherit the flag that was passed to SMSS itself */
79 ProcessParameters->DebugFlags = SmpDebug;
80 }
81
82 /* Subsystems get the first 1MB of memory reserved for DOS/IVT purposes */
84 {
86 }
87
88 /* And always force NX for anything that SMSS launches */
89 ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_NX;
90
91 /* Now create the process in suspended state */
94 ProcessParameters,
95 NULL,
96 NULL,
97 NULL,
98 FALSE,
99 NULL,
100 NULL,
101 ProcessInfo);
102 RtlDestroyProcessParameters(ProcessParameters);
103 if (!NT_SUCCESS(Status))
104 {
105 /* If we couldn't create it, fail back to the caller */
106 DPRINT1("SMSS: Failed load of %wZ - Status == %lx\n",
108 return Status;
109 }
110
111 /* Associate a session with this process */
112 Status = SmpSetProcessMuSessionId(ProcessInfo->ProcessHandle, MuSessionId);
113
114 /* If the application is deferred (suspended), there's nothing to do */
115 if (Flags & SMP_DEFERRED_FLAG) return Status;
116
117 /* Otherwise, get ready to start it, but make sure it's a native app */
119 {
120 /* Resume it */
121 NtResumeThread(ProcessInfo->ThreadHandle, NULL);
122 if (!(Flags & SMP_ASYNC_FLAG))
123 {
124 /* Block on it unless Async was requested */
126 }
127
128 /* It's up and running now, close our handles */
129 NtClose(ProcessInfo->ThreadHandle);
130 NtClose(ProcessInfo->ProcessHandle);
131 }
132 else
133 {
134 /* This image is invalid, so kill it, close our handles, and fail */
138 NtClose(ProcessInfo->ThreadHandle);
139 NtClose(ProcessInfo->ProcessHandle);
140 DPRINT1("SMSS: Not an NT image - %wZ\n", FileName);
141 }
142
143 /* Return the outcome of the process create */
144 return Status;
145}
146
148NTAPI
151 IN PUNICODE_STRING Arguments,
152 IN ULONG Flags)
153{
154 ANSI_STRING MessageString;
155 CHAR MessageBuffer[256];
157 WCHAR Buffer[1024];
158 BOOLEAN BootState, BootOkay, ShutdownOkay;
159
160 /* Make sure autochk was actually found */
162 {
163 /* It wasn't, so create an error message to print on the screen */
164 RtlStringCbPrintfA(MessageBuffer,
165 sizeof(MessageBuffer),
166 "%wZ program not found - skipping AUTOCHECK\r\n",
167 FileName);
168 RtlInitAnsiString(&MessageString, MessageBuffer);
170 &MessageString,
171 TRUE)))
172 {
173 /* And show it */
176 }
177 }
178 else
179 {
180 /* Autochk is there, so record the BSD state */
181 BootState = SmpSaveAndClearBootStatusData(&BootOkay, &ShutdownOkay);
182
183 /* Build the path to autochk and place its arguments */
184 RtlInitEmptyUnicodeString(&Destination, Buffer, sizeof(Buffer));
188
189 /* Execute it */
191 Directory,
193 0,
195 NULL);
196
197 /* Restore the BSD state */
198 if (BootState) SmpRestoreBootStatusData(BootOkay, ShutdownOkay);
199 }
200
201 /* We're all done! */
202 return STATUS_SUCCESS;
203}
204
206NTAPI
208 IN ULONG MuSessionId,
210 IN ULONG Flags)
211{
214
215 /* There's no longer a debugging subsystem */
216 if (Flags & SMP_DEBUG_FLAG) return STATUS_SUCCESS;
217
218 /* Parse the command line to see what execution flags are requested */
219 Status = SmpParseCommandLine(CommandLine,
220 &Flags,
221 &FileName,
222 &Directory,
223 &Arguments);
224 if (!NT_SUCCESS(Status))
225 {
226 /* Fail if we couldn't do that */
227 DPRINT1("SMSS: SmpParseCommandLine(%wZ) failed - Status == %lx\n",
228 CommandLine, Status);
229 return Status;
230 }
231
232 /* Check if autochk is requested */
234 {
235 /* Run it */
237 }
238 else if (Flags & SMP_SUBSYSTEM_FLAG)
239 {
241 &Directory,
242 CommandLine,
243 MuSessionId,
244 ProcessId,
245 Flags);
246 }
247 else if (Flags & SMP_INVALID_PATH)
248 {
249 /* An invalid image was specified, fail */
250 DPRINT1("SMSS: Image file (%wZ) not found\n", &FileName);
252 }
253 else
254 {
255 /* An actual image name was present, execute it */
257 &Directory,
258 CommandLine,
259 MuSessionId,
260 Flags,
261 NULL);
262 }
263
264 /* Free all the token parameters */
265 if (FileName.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
266 if (Directory.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Directory.Buffer);
267 if (Arguments.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Arguments.Buffer);
268
269 /* Return to the caller */
270 if (!NT_SUCCESS(Status))
271 {
272 DPRINT1("SMSS: Command '%wZ' failed - Status == %x\n",
273 CommandLine, Status);
274 }
275 return Status;
276}
277
279NTAPI
281 IN PUNICODE_STRING InitialCommand,
282 IN HANDLE InitialCommandProcess,
283 OUT PHANDLE ReturnPid)
284{
288 ULONG Flags = 0;
289
290 /* Check if we haven't yet connected to ourselves */
291 if (!SmApiPort)
292 {
293 /* Connect to ourselves, as a client */
295 if (!NT_SUCCESS(Status))
296 {
297 DPRINT1("SMSS: Unable to connect to SM - Status == %lx\n", Status);
298 return Status;
299 }
300 }
301
302 /* Parse the initial command line */
303 Status = SmpParseCommandLine(InitialCommand,
304 &Flags,
305 &FileName,
306 &Directory,
307 &Arguments);
309 {
310 /* Fail if it doesn't exist */
311 DPRINT1("SMSS: Initial command image (%wZ) not found\n", &FileName);
312 if (FileName.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
314 }
315
316 /* And fail if any other reason is also true */
317 if (!NT_SUCCESS(Status))
318 {
319 DPRINT1("SMSS: SmpParseCommandLine(%wZ) failed - Status == %lx\n",
320 InitialCommand, Status);
321 return Status;
322 }
323
324 /* Execute the initial command, but defer its full execution */
326 &Directory,
327 InitialCommand,
328 MuSessionId,
330 &ProcessInfo);
331
332 /* Free all the token parameters */
333 if (FileName.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, FileName.Buffer);
334 if (Directory.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Directory.Buffer);
335 if (Arguments.Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Arguments.Buffer);
336
337 /* Bail out if we couldn't execute the initial command */
338 if (!NT_SUCCESS(Status)) return Status;
339
340 /* Now duplicate the handle to this process */
342 ProcessInfo.ProcessHandle,
344 InitialCommandProcess,
346 0,
347 0);
348 if (!NT_SUCCESS(Status))
349 {
350 /* Kill it utterly if duplication failed */
351 DPRINT1("SMSS: DupObject Failed. Status == %lx\n", Status);
353 NtResumeThread(ProcessInfo.ThreadHandle, NULL);
354 NtClose(ProcessInfo.ThreadHandle);
355 NtClose(ProcessInfo.ProcessHandle);
356 return Status;
357 }
358
359 /* Return PID to the caller, and set this as the initial command PID */
360 if (ReturnPid) *ReturnPid = ProcessInfo.ClientId.UniqueProcess;
361 if (!MuSessionId) SmpInitialCommandProcessId = ProcessInfo.ClientId.UniqueProcess;
362
363 /* Now call our server execution function to wrap up its initialization */
364 Status = SmExecPgm(SmApiPort, &ProcessInfo, FALSE);
365 if (!NT_SUCCESS(Status)) DPRINT1("SMSS: SmExecPgm Failed. Status == %lx\n", Status);
366 return Status;
367}
368
370NTAPI
372 IN ULONG ParameterMask,
373 IN ULONG ParameterCount)
374{
376 BOOLEAN Old;
378
379 /* Give the shutdown privilege to the thread */
382 {
383 /* Thread doesn't have a token, give it to the entire process */
385 }
386
387 /* Take down the process/machine with a hard error */
389 ParameterCount,
390 ParameterMask,
393 &Response);
394
395 /* Terminate the process if the hard error didn't already */
397}
398
399LONG
401{
402 PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord;
404 UNICODE_STRING ErrorString;
405
406#if DBG
407 /* Print the message and break into the debugger */
408 DbgPrint("SMSS: Unhandled exception - Status == %x IP == %p\n",
409 ExceptionRecord->ExceptionCode,
410 ExceptionRecord->ExceptionAddress);
411 if ((ExceptionRecord->ExceptionCode == STATUS_IN_PAGE_ERROR) &&
412 (ExceptionRecord->NumberParameters >= 3))
413 {
414 DbgPrint(" Memory Address: %x Read/Write: %x I/O Error: %x\n",
415 ExceptionRecord->ExceptionInformation[1],
416 ExceptionRecord->ExceptionInformation[0],
417 ExceptionRecord->ExceptionInformation[2]);
418 }
419 else
420 if ((ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION ||
421 ExceptionRecord->ExceptionCode == STATUS_GUARD_PAGE_VIOLATION ||
422 ExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW ||
423 ExceptionRecord->ExceptionCode == STATUS_IN_PAGE_ERROR) &&
424 (ExceptionRecord->NumberParameters >= 2))
425 {
426 DbgPrint(" Memory Address: %x Read/Write: %x\n",
427 ExceptionRecord->ExceptionInformation[1],
428 ExceptionRecord->ExceptionInformation[0]);
429 }
430 if (NtCurrentPeb()->BeingDebugged) DbgBreakPoint();
431#endif
432
433 /* Build the hard error and terminate */
434 RtlInitUnicodeString(&ErrorString, L"Unhandled Exception in Session Manager");
435 Parameters[0] = (ULONG_PTR)&ErrorString;
436 Parameters[1] = ExceptionRecord->ExceptionCode;
437 Parameters[2] = (ULONG_PTR)ExceptionRecord->ExceptionAddress;
438 Parameters[3] = (ULONG_PTR)ExceptionInfo->ContextRecord;
440
441 /* We should never get here */
442 ASSERT(FALSE);
444}
445
449 IN PCHAR argv[],
450 IN PCHAR envp[],
452{
454 KPRIORITY SetBasePriority;
456 HANDLE Handles[2];
457 PVOID State;
458 ULONG Flags;
459 PROCESS_BASIC_INFORMATION ProcessInfo;
460 UNICODE_STRING DbgString, InitialCommand;
461
462 /* Make us critical */
465
466 /* Raise our priority */
467 SetBasePriority = 11;
470 (PVOID)&SetBasePriority,
471 sizeof(SetBasePriority));
473
474 /* Save the debug flag if it was passed */
475 if (DebugFlag) SmpDebug = DebugFlag != 0;
476
477 /* Build the hard error parameters */
478 Parameters[0] = (ULONG_PTR)&DbgString;
479 Parameters[1] = Parameters[2] = Parameters[3] = 0;
480
481 /* Enter SEH so we can terminate correctly if anything goes wrong */
483 {
484 /* Initialize SMSS */
485 Status = SmpInit(&InitialCommand, &Handles[0]);
486 if (!NT_SUCCESS(Status))
487 {
488 DPRINT1("SMSS: SmpInit return failure - Status == %x\n", Status);
489 RtlInitUnicodeString(&DbgString, L"Session Manager Initialization");
490 Parameters[1] = Status;
492 }
493
494 /* Get the global flags */
496 &Flags,
497 sizeof(Flags),
498 NULL);
500
501 /* Before executing the initial command check if the debug flag is on */
503 {
504 /* SMSS should launch ntsd with a few parameters at this point */
505 DPRINT1("Global Flags Set to SMSS Debugging: Not yet supported\n");
506 }
507
508 /* Execute the initial command (Winlogon.exe) */
509 Status = SmpExecuteInitialCommand(0, &InitialCommand, &Handles[1], NULL);
510 if (!NT_SUCCESS(Status))
511 {
512 /* Fail and raise a hard error */
513 DPRINT1("SMSS: Execute Initial Command failed\n");
514 RtlInitUnicodeString(&DbgString,
515 L"Session Manager ExecuteInitialCommand");
516 Parameters[1] = Status;
518 }
519
520 /* Check if we're already attached to a session */
522 if (AttachedSessionId != -1)
523 {
524 /* Detach from it, we should be in no session right now */
527 sizeof(AttachedSessionId));
530 }
532
533 /* Wait on either CSRSS or Winlogon to die */
535 Handles,
536 WaitAny,
537 FALSE,
538 NULL);
539 if (Status == STATUS_WAIT_0)
540 {
541 /* CSRSS is dead, get exit code and prepare for the hard error */
542 RtlInitUnicodeString(&DbgString, L"Windows SubSystem");
545 &ProcessInfo,
546 sizeof(ProcessInfo),
547 NULL);
548 DPRINT1("SMSS: Windows subsystem terminated when it wasn't supposed to.\n");
549 }
550 else
551 {
552 /* The initial command is dead or we have another failure */
553 RtlInitUnicodeString(&DbgString, L"Windows Logon Process");
554 if (Status == STATUS_WAIT_1)
555 {
556 /* Winlogon.exe got terminated, get its exit code */
559 &ProcessInfo,
560 sizeof(ProcessInfo),
561 NULL);
562 }
563 else
564 {
565 /* Something else satisfied our wait, so set the wait status */
566 ProcessInfo.ExitStatus = Status;
568 }
569 DPRINT1("SMSS: Initial command '%wZ' terminated when it wasn't supposed to.\n",
570 &InitialCommand);
571 }
572
573 /* Check if NtQueryInformationProcess was successful */
574 if (NT_SUCCESS(Status))
575 {
576 /* Then we must have a valid exit status in the structure, use it */
577 Parameters[1] = ProcessInfo.ExitStatus;
578 }
579 else
580 {
581 /* We really don't know what happened, so set a generic error */
583 }
584 }
586 {
587 /* The filter should never return here */
588 ASSERT(FALSE);
589 }
590 _SEH2_END;
591
592 /* Something in the init loop failed, terminate SMSS */
594}
595
596/* EOF */
NTSYSAPI NTSTATUS NTAPI NtSetSystemInformation(IN INT SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
#define NtCurrentPeb()
Definition: FLS.c:22
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
@ ProcessBasicInformation
Definition: cicbase.cpp:63
Definition: bufpool.h:45
ULONG DebugFlag
Definition: fxobject.cpp:44
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
LONG KPRIORITY
Definition: compat.h:803
MonoAssembly int argc
Definition: metahost.c:107
#define __cdecl
Definition: corecrt.h:121
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2712
struct _FileName FileName
Definition: fatprocs.h:897
@ SystemFlagsInformation
Definition: ntddk_ex.h:20
#define STATUS_ACCESS_VIOLATION
Status
Definition: gdiplustypes.h:24
#define DbgPrint
Definition: hal.h:12
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:551
#define FLG_DEBUG_INITIAL_COMMAND
Definition: pstypes.h:53
#define FLG_DEBUG_INITIAL_COMMAND_EX
Definition: pstypes.h:80
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define ASSERT(a)
Definition: mode.c:44
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:573
#define SE_LOAD_DRIVER_PRIVILEGE
Definition: security.c:564
#define argv
Definition: mplay32.c:18
@ OptionShutdownSystem
Definition: extypes.h:192
@ SystemSessionDetach
Definition: extypes.h:265
NTSYSAPI NTSTATUS NTAPI RtlDestroyProcessParameters(_In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
NTSYSAPI NTSTATUS NTAPI RtlCreateProcessParameters(_Out_ PRTL_USER_PROCESS_PARAMETERS *ProcessParameters, _In_ PUNICODE_STRING ImagePathName, _In_opt_ PUNICODE_STRING DllPath, _In_opt_ PUNICODE_STRING CurrentDirectory, _In_opt_ PUNICODE_STRING CommandLine, _In_opt_ PWSTR Environment, _In_opt_ PUNICODE_STRING WindowTitle, _In_opt_ PUNICODE_STRING DesktopInfo, _In_opt_ PUNICODE_STRING ShellInfo, _In_opt_ PUNICODE_STRING RuntimeInfo)
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3051
NTSYSAPI NTSTATUS NTAPI RtlCreateUserProcess(_In_ PUNICODE_STRING ImageFileName, _In_ ULONG Attributes, _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters, _In_opt_ PSECURITY_DESCRIPTOR ProcessSecutityDescriptor, _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor, _In_opt_ HANDLE ParentProcess, _In_ BOOLEAN CurrentDirectory, _In_opt_ HANDLE DebugPort, _In_opt_ HANDLE ExceptionPort, _Out_ PRTL_USER_PROCESS_INFORMATION ProcessInfo)
NTSYSAPI NTSTATUS __cdecl RtlSetThreadIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3962
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
NTSYSAPI NTSTATUS __cdecl RtlSetProcessIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
#define RTL_USER_PROCESS_PARAMETERS_NX
Definition: rtltypes.h:55
#define RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB
Definition: rtltypes.h:46
NTSTATUS NTAPI NtDisplayString(PUNICODE_STRING String)
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1327
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtTerminateProcess(HANDLE ProcessHandle, LONG ExitStatus)
#define NtCurrentProcess()
Definition: nt_native.h:1660
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3419
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
@ WaitAny
#define IMAGE_SUBSYSTEM_NATIVE
Definition: ntimage.h:436
NTSTATUS NTAPI NtSetInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _In_reads_bytes_(ProcessInformationLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength)
Definition: query.c:1422
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_writes_bytes_to_opt_(ProcessInformationLength, *ReturnLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:211
NTSTATUS NTAPI NtResumeThread(IN HANDLE ThreadHandle, OUT PULONG SuspendCount OPTIONAL)
Definition: state.c:290
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_NO_TOKEN
Definition: ntstatus.h:454
#define STATUS_WAIT_0
Definition: ntstatus.h:330
#define STATUS_WAIT_1
Definition: ntstatus.h:123
#define STATUS_INVALID_IMAGE_FORMAT
Definition: ntstatus.h:453
#define STATUS_STACK_OVERFLOW
Definition: ntstatus.h:583
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:792
#define STATUS_IN_PAGE_ERROR
Definition: ntstatus.h:336
#define STATUS_GUARD_PAGE_VIOLATION
Definition: ntstatus.h:262
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
NTSTATUS NTAPI NtDuplicateObject(IN HANDLE SourceProcessHandle, IN HANDLE SourceHandle, IN HANDLE TargetProcessHandle OPTIONAL, OUT PHANDLE TargetHandle OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG HandleAttributes, IN ULONG Options)
Definition: obhandle.c:3427
NTSTATUS NTAPI NtWaitForMultipleObjects(IN ULONG ObjectCount, IN PHANDLE HandleArray, IN WAIT_TYPE WaitType, IN BOOLEAN Alertable, IN PLARGE_INTEGER TimeOut OPTIONAL)
Definition: obwait.c:46
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:203
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define _SEH2_LEAVE
Definition: pseh2_64.h:206
#define STATUS_SUCCESS
Definition: shellext.h:65
UNICODE_STRING SmpDefaultLibPath
Definition: sminit.c:29
PWCHAR SmpDefaultEnvironment
Definition: sminit.c:28
NTSTATUS NTAPI SmpInit(IN PUNICODE_STRING InitialCommand, OUT PHANDLE ProcessHandle)
Definition: sminit.c:2473
NTSTATUS NTAPI SmConnectToSm(_In_opt_ PUNICODE_STRING SbApiPortName, _In_opt_ HANDLE SbApiPort, _In_opt_ ULONG ImageType, _Out_ PHANDLE SmApiPort)
Connects to the SM API port for registering a session callback port (Sb) associated to a subsystem,...
Definition: smclient.c:57
NTSTATUS NTAPI SmExecPgm(_In_ HANDLE SmApiPort, _In_ PRTL_USER_PROCESS_INFORMATION ProcessInformation, _In_ BOOLEAN DebugFlag)
Requests the SM to start a process under a new environment session.
Definition: smclient.c:265
NTSTATUS NTAPI SmpSetProcessMuSessionId(IN HANDLE ProcessHandle, IN ULONG SessionId)
Definition: smsessn.c:199
BOOLEAN SmpDebug
Definition: smss.c:22
NTSTATUS NTAPI SmpTerminate(IN PULONG_PTR Parameters, IN ULONG ParameterMask, IN ULONG ParameterCount)
Definition: smss.c:371
NTSTATUS NTAPI SmpExecuteInitialCommand(IN ULONG MuSessionId, IN PUNICODE_STRING InitialCommand, IN HANDLE InitialCommandProcess, OUT PHANDLE ReturnPid)
Definition: smss.c:280
HANDLE SmpInitialCommandProcessId
Definition: smss.c:24
ULONG AttachedSessionId
Definition: smss.c:21
LONG SmpUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
Definition: smss.c:400
NTSTATUS __cdecl _main(IN INT argc, IN PCHAR argv[], IN PCHAR envp[], IN ULONG DebugFlag)
Definition: smss.c:448
NTSTATUS NTAPI SmpExecuteCommand(IN PUNICODE_STRING CommandLine, IN ULONG MuSessionId, OUT PHANDLE ProcessId, IN ULONG Flags)
Definition: smss.c:207
NTSTATUS NTAPI SmpExecuteImage(IN PUNICODE_STRING FileName, IN PUNICODE_STRING Directory, IN PUNICODE_STRING CommandLine, IN ULONG MuSessionId, IN ULONG Flags, IN PRTL_USER_PROCESS_INFORMATION ProcessInformation)
Definition: smss.c:30
NTSTATUS NTAPI SmpInvokeAutoChk(IN PUNICODE_STRING FileName, IN PUNICODE_STRING Directory, IN PUNICODE_STRING Arguments, IN ULONG Flags)
Definition: smss.c:149
UNICODE_STRING SmpSystemRoot
Definition: smss.c:20
HANDLE SmApiPort
Definition: smss.c:23
VOID NTAPI SmpReleasePrivilege(IN PVOID State)
Definition: smutil.c:124
#define SMP_AUTOCHK_FLAG
Definition: smss.h:46
NTSTATUS NTAPI SmpParseCommandLine(IN PUNICODE_STRING CommandLine, OUT PULONG Flags, OUT PUNICODE_STRING FileName, OUT PUNICODE_STRING Directory, OUT PUNICODE_STRING Arguments)
Definition: smutil.c:228
#define SMP_DEFERRED_FLAG
Definition: smss.h:49
NTSTATUS NTAPI SmpLoadSubSystem(IN PUNICODE_STRING FileName, IN PUNICODE_STRING Directory, IN PUNICODE_STRING CommandLine, IN ULONG MuSessionId, OUT PHANDLE ProcessId, IN ULONG Flags)
Definition: smsubsys.c:138
NTSTATUS NTAPI SmpAcquirePrivilege(IN ULONG Privilege, OUT PVOID *PrivilegeStat)
Definition: smutil.c:35
#define SMP_DEBUG_FLAG
Definition: smss.h:44
#define SMP_INVALID_PATH
Definition: smss.h:48
BOOLEAN NTAPI SmpSaveAndClearBootStatusData(OUT PBOOLEAN BootOkay, OUT PBOOLEAN ShutdownOkay)
Definition: smutil.c:419
#define SMP_SUBSYSTEM_FLAG
Definition: smss.h:47
#define SMP_ASYNC_FLAG
Definition: smss.h:45
VOID NTAPI SmpRestoreBootStatusData(IN BOOLEAN BootOkay, IN BOOLEAN ShutdownOkay)
Definition: smutil.c:469
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
Definition: ncftp.h:89
HANDLE UniqueProcess
Definition: compat.h:825
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213
PVOID ExceptionAddress
Definition: compat.h:211
SECTION_IMAGE_INFORMATION ImageInformation
Definition: rtltypes.h:1600
uint32_t * PULONG_PTR
Definition: typedefs.h:65
#define NTAPI
Definition: typedefs.h:36
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
NTSYSAPI void WINAPI DbgBreakPoint(void)
@ ProcessBasePriority
Definition: winternl.h:1887
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170