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 ******************************************************************/
32 #define NTOS_MODE_USER
33 #include <ndk/ntndk.h>
34 #include <csr/server.h>
39 /* PRIVATE FUNCTIONS *********************************************************/
43 CsrpSetDefaultProcessHardErrorMode (VOID
)
45 ULONG DefaultHardErrorMode
= 0;
47 /* Disable hard errors */
48 NtSetInformationProcess(NtCurrentProcess(),
49 ProcessDefaultHardErrorMode
,
50 &DefaultHardErrorMode
,
51 sizeof(DefaultHardErrorMode
));
55 * Note: Standard entrypoint for Native C Programs.
56 * The OS backend (NtProcessStartup) which calls this routine is
57 * implemented in a CRT-like static library (much like mainCRTStartup).
58 * Do NOT manually add the NtProcessStartup entrypoint or anything else.
67 KPRIORITY BasePriority
= (8 + 1) + 4;
71 /* Set the Priority */
72 NtSetInformationProcess(NtCurrentProcess(),
77 /* Give us IOPL so that we can access the VGA registers */
78 Status
= NtSetInformationProcess(NtCurrentProcess(),
82 if (NT_SUCCESS(Status
))
84 /* Raise a hard error */
85 DPRINT1("CSRSS: Could not raise IOPL: %x\n", Status
);
86 Status
= NtRaiseHardError(STATUS_IO_PRIVILEGE_FAILED
,
94 /* Initialize CSR through CSRSRV */
95 Status
= CsrServerInitialization(argc
, argv
);
96 if (!NT_SUCCESS(Status
))
99 DPRINT1("CSRSS: CsrServerInitialization failed:% lx\n", Status
);
100 NtTerminateProcess (NtCurrentProcess(), Status
);
104 CsrpSetDefaultProcessHardErrorMode();
106 /* If this is Session 0, make sure killing us bugchecks the system */
107 if (!NtCurrentPeb()->SessionId
) RtlSetProcessIsCritical(TRUE
, NULL
, FALSE
);
109 /* Kill this thread. CSRSRV keeps us going */
110 NtTerminateThread (NtCurrentThread(), Status
);