[USER.EXE]: Add a *stub* user.exe to make the DirectX 9.0 installer happy (it searche...
[reactos.git] / reactos / subsystems / win32 / csrss / csrss.c
1 /*
2 * LICENSE: BSD - See COPYING.ARM in root directory
3 * PROJECT: ReactOS Client/Server Runtime SubSystem
4 * FILE: subsystems/win32/csrss/csrss.c
5 * PURPOSE: CSRSS Process Main Executable Code
6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
7 * ReactOS Portable Systems Group
8 */
9
10 /* INCLUDES *******************************************************************/
11
12 #define NTOS_MODE_USER
13 #include <ndk/psfuncs.h>
14 #include <ndk/rtlfuncs.h>
15
16 #include <csr/csrsrv.h>
17
18 #define NDEBUG
19 #include <debug.h>
20
21 /* FUNCTIONS ******************************************************************/
22
23 VOID
24 NTAPI
25 CsrpSetDefaultProcessHardErrorMode(VOID)
26 {
27 ULONG DefaultHardErrorMode = 0;
28
29 /* Disable hard errors */
30 NtSetInformationProcess(NtCurrentProcess(),
31 ProcessDefaultHardErrorMode,
32 &DefaultHardErrorMode,
33 sizeof(DefaultHardErrorMode));
34 }
35
36 int
37 _cdecl
38 _main(int argc,
39 char *argv[],
40 char *envp[],
41 int DebugFlag)
42 {
43 KPRIORITY BasePriority = (8 + 1) + 4;
44 NTSTATUS Status;
45 //ULONG Response; // see the #if 0
46 UNREFERENCED_PARAMETER(envp);
47 UNREFERENCED_PARAMETER(DebugFlag);
48
49 /* Set the Priority */
50 NtSetInformationProcess(NtCurrentProcess(),
51 ProcessBasePriority,
52 &BasePriority,
53 sizeof(KPRIORITY));
54
55 /* Give us IOPL so that we can access the VGA registers */
56 Status = NtSetInformationProcess(NtCurrentProcess(),
57 ProcessUserModeIOPL,
58 NULL,
59 0);
60 if (!NT_SUCCESS(Status))
61 {
62 /* Raise a hard error */
63 DPRINT1("CSRSS: Could not raise IOPL, Status: 0x%08lx\n", Status);
64 #if 0
65 Status = NtRaiseHardError(STATUS_IO_PRIVILEGE_FAILED,
66 0,
67 0,
68 NULL,
69 OptionOk,
70 &Response);
71 #endif
72 }
73
74 /* Initialize CSR through CSRSRV */
75 Status = CsrServerInitialization(argc, argv);
76 if (!NT_SUCCESS(Status))
77 {
78 /* Kill us */
79 DPRINT1("CSRSS: Unable to initialize server, Status: 0x%08lx\n", Status);
80 NtTerminateProcess(NtCurrentProcess(), Status);
81 }
82
83 /* Disable errors */
84 CsrpSetDefaultProcessHardErrorMode();
85
86 /* If this is Session 0, make sure killing us bugchecks the system */
87 if (NtCurrentPeb()->SessionId == 0) RtlSetProcessIsCritical(TRUE, NULL, FALSE);
88
89 /* Kill this thread. CSRSRV keeps us going */
90 NtTerminateThread(NtCurrentThread(), Status);
91 return 0;
92 }
93
94 /* EOF */