On FAT16 partitions smaller than 128MB, the cluster size is 2048, which is
[reactos.git] / reactos / subsys / smss / smss.c
1 /* $Id$
2 *
3 * smss.c - Session Manager
4 *
5 * ReactOS Operating System
6 *
7 * --------------------------------------------------------------------
8 *
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.
13 *
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.
18 *
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,
22 * MA 02139, USA.
23 *
24 * --------------------------------------------------------------------
25 */
26 #include "smss.h"
27 #include <reactos/buildno.h>
28
29 #define NDEBUG
30 #include <debug.h>
31
32 ULONG SmSsProcessId = 0;
33
34 /* Native image's entry point */
35
36 NTSTATUS __cdecl _main(int argc,
37 char *argv[],
38 char *envp[],
39 ULONG DebugFlag)
40 {
41 NTSTATUS Status = STATUS_SUCCESS;
42 PROCESS_BASIC_INFORMATION PBI = {0};
43
44 /* Lookup yourself */
45 Status = NtQueryInformationProcess (NtCurrentProcess(),
46 ProcessBasicInformation,
47 & PBI,
48 sizeof PBI,
49 NULL);
50 if(NT_SUCCESS(Status))
51 {
52 SmSsProcessId = (ULONG) PBI.UniqueProcessId;
53 }
54 /* Initialize the system */
55 Status = InitSessionManager();
56 /* Watch required subsystems TODO */
57 #if 0
58 if (!NT_SUCCESS(Status))
59 {
60 int i;
61 for (i=0; i < (sizeof Children / sizeof Children[0]); i++)
62 {
63 if (Children[i])
64 {
65 NtTerminateProcess(Children[i],0);
66 }
67 }
68 DPRINT1("SM: Initialization failed!\n");
69 goto ByeBye;
70 }
71
72 Status = NtWaitForMultipleObjects(((LONG) sizeof(Children) / sizeof(HANDLE)),
73 Children,
74 WaitAny,
75 TRUE, /* alertable */
76 NULL); /* NULL for infinite */
77 if (!NT_SUCCESS(Status))
78 {
79 DPRINT1("SM: NtWaitForMultipleObjects failed! (Status=0x%08lx)\n", Status);
80 }
81 else
82 {
83 DPRINT1("SM: Process terminated!\n");
84 }
85
86 ByeBye:
87 /* Raise a hard error (crash the system/BSOD) */
88 NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED,
89 0,0,0,0,0);
90
91 // NtTerminateProcess(NtCurrentProcess(), 0);
92 #endif
93 return NtTerminateThread(NtCurrentThread(), Status);
94 }
95
96 /* EOF */