2 * --------------------------------------------------------------------
4 * This software is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this software; see the file COPYING.LIB. If not, write
16 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19 * --------------------------------------------------------------------
22 * COPYRIGHT: See COPYING in the top level directory
23 * PROJECT: ReactOS CSR Sub System
24 * FILE: subsys/csr/csrss.c
25 * PURPOSE: CSR Executable
26 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
29 /* INCLUDES ******************************************************************/
31 #define WIN32_NO_STATUS
33 #define NTOS_MODE_USER
34 #include <ndk/ntndk.h>
35 #include <csr/server.h>
40 /* PRIVATE FUNCTIONS *********************************************************/
44 CsrpSetDefaultProcessHardErrorMode (VOID
)
46 ULONG DefaultHardErrorMode
= 0;
48 /* Disable hard errors */
49 NtSetInformationProcess(NtCurrentProcess(),
50 ProcessDefaultHardErrorMode
,
51 &DefaultHardErrorMode
,
52 sizeof(DefaultHardErrorMode
));
56 * Note: Standard entrypoint for Native C Programs.
57 * The OS backend (NtProcessStartup) which calls this routine is
58 * implemented in a CRT-like static library (much like mainCRTStartup).
59 * Do NOT manually add the NtProcessStartup entrypoint or anything else.
68 KPRIORITY BasePriority
= (8 + 1) + 4;
71 UNREFERENCED_PARAMETER(envp
);
72 UNREFERENCED_PARAMETER(DebugFlag
);
75 /* Set the Priority */
76 NtSetInformationProcess(NtCurrentProcess(),
81 /* Give us IOPL so that we can access the VGA registers */
82 Status
= NtSetInformationProcess(NtCurrentProcess(),
86 if (!NT_SUCCESS(Status
))
88 /* Raise a hard error */
89 DPRINT1("CSRSS: Could not raise IOPL: %x\n", Status
);
90 Status
= NtRaiseHardError(STATUS_IO_PRIVILEGE_FAILED
,
98 /* Initialize CSR through CSRSRV */
99 Status
= CsrServerInitialization(argc
, argv
);
100 if (!NT_SUCCESS(Status
))
103 DPRINT1("CSRSS: CsrServerInitialization failed:% lx\n", Status
);
104 NtTerminateProcess (NtCurrentProcess(), Status
);
108 CsrpSetDefaultProcessHardErrorMode();
110 /* If this is Session 0, make sure killing us bugchecks the system */
111 if (!NtCurrentPeb()->SessionId
) RtlSetProcessIsCritical(TRUE
, NULL
, FALSE
);
113 /* Kill this thread. CSRSRV keeps us going */
114 NtTerminateThread (NtCurrentThread(), Status
);