[CSRSS]: Split off CSRSS into a more Windows-friendly model. CSRSS.EXE is simply...
[reactos.git] / reactos / subsystems / win32 / csrss / csrss.c
1 /*
2 * PROJECT: ReactOS Client Server Runtime SubSystem (CSRSS)
3 * LICENSE: BSD - See COPYING.ARM in root directory
4 * FILE: subsystems/win32/csrss/csrss.c
5 * PURPOSE: Main Executable Code
6 * PROGRAMMERS: Alex Ionescu
7 * ReactOS Portable Systems Group
8 */
9
10 /* INCLUDES *******************************************************************/
11
12 #define WIN32_NO_STATUS
13 #include <windows.h>
14 #include <ndk/ntndk.h>
15 #include <api.h>
16 #define NDEBUG
17 #include <debug.h>
18
19 /* FUNCTIONS ******************************************************************/
20
21 VOID
22 NTAPI
23 CsrpSetDefaultProcessHardErrorMode(VOID)
24 {
25 ULONG DefaultHardErrorMode = 0;
26
27 /* Disable hard errors */
28 NtSetInformationProcess(NtCurrentProcess(),
29 ProcessDefaultHardErrorMode,
30 &DefaultHardErrorMode,
31 sizeof(DefaultHardErrorMode));
32 }
33
34 int
35 _cdecl
36 _main(int argc,
37 char *argv[],
38 char *envp[],
39 int DebugFlag)
40 {
41 KPRIORITY BasePriority = (8 + 1) + 4;
42 NTSTATUS Status;
43
44 /* Set the Priority */
45 NtSetInformationProcess(NtCurrentProcess(),
46 ProcessBasePriority,
47 &BasePriority,
48 sizeof(KPRIORITY));
49
50 /* Initialize CSR through CSRSRV */
51 Status = CsrServerInitialization(argc, argv);
52 if (!NT_SUCCESS(Status))
53 {
54 /* Kill us */
55 DPRINT1("CSRSS: CsrServerInitialization failed:% lx\n", Status);
56 NtTerminateProcess(NtCurrentProcess(), Status);
57 }
58
59 /* Disable errors */
60 CsrpSetDefaultProcessHardErrorMode();
61
62 /* If this is Session 0, make sure killing us bugchecks the system */
63 if (!NtCurrentPeb()->SessionId) RtlSetProcessIsCritical(TRUE, NULL, FALSE);
64
65 /* Kill this thread. CSRSRV keeps us going */
66 NtTerminateThread (NtCurrentThread(), Status);
67 return 0;
68 }
69
70 /* EOF */