3 * smss.c - Session Manager
5 * ReactOS Operating System
7 * --------------------------------------------------------------------
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
14 * This software is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this software; see the file COPYING.LIB. If not, write
21 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
24 * --------------------------------------------------------------------
27 #include <rosrtl/string.h>
28 #include <reactos/buildno.h>
33 HANDLE SmSsProcessId
= 0;
35 /* Native image's entry point */
38 NtProcessStartup(PPEB Peb
)
41 PROCESS_BASIC_INFORMATION PBI
= {0};
43 PrintString("ReactOS Session Manager %s (Build %s)\n",
45 KERNEL_VERSION_BUILD_STR
);
48 Status
= NtQueryInformationProcess (NtCurrentProcess(),
49 ProcessBasicInformation
,
53 if(NT_SUCCESS(Status
))
55 SmSsProcessId
= PBI
.UniqueProcessId
;
57 /* Initialize the system */
58 Status
= InitSessionManager();
60 if (!NT_SUCCESS(Status
))
63 for (i
=0; i
< (sizeof Children
/ sizeof Children
[0]); i
++)
67 NtTerminateProcess(Children
[i
],0);
70 DPRINT1("SM: Initialization failed!\n");
74 Status
= NtWaitForMultipleObjects(((LONG
) sizeof(Children
) / sizeof(HANDLE
)),
78 NULL
); /* NULL for infinite */
79 if (!NT_SUCCESS(Status
))
81 DPRINT1("SM: NtWaitForMultipleObjects failed! (Status=0x%08lx)\n", Status
);
85 DPRINT1("SM: Process terminated!\n");
89 /* Raise a hard error (crash the system/BSOD) */
90 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED
,
93 // NtTerminateProcess(NtCurrentProcess(), 0);
95 NtTerminateThread(NtCurrentThread(), Status
);