2010-03-10 04:59:39 +00:00
|
|
|
/*
|
|
|
|
* LICENSE: BSD - See COPYING.ARM in root directory
|
2012-10-25 20:40:41 +00:00
|
|
|
* PROJECT: ReactOS Client/Server Runtime SubSystem
|
2010-03-10 04:59:39 +00:00
|
|
|
* FILE: subsystems/win32/csrss/csrss.c
|
2012-10-25 20:40:41 +00:00
|
|
|
* PURPOSE: CSRSS Process Main Executable Code
|
2012-10-20 13:00:41 +00:00
|
|
|
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
2010-03-10 04:59:39 +00:00
|
|
|
* ReactOS Portable Systems Group
|
1999-06-08 22:50:59 +00:00
|
|
|
*/
|
2005-06-20 11:56:10 +00:00
|
|
|
|
2010-03-10 04:59:39 +00:00
|
|
|
/* INCLUDES *******************************************************************/
|
2000-03-22 18:36:00 +00:00
|
|
|
|
2012-02-15 16:11:12 +00:00
|
|
|
#define NTOS_MODE_USER
|
2021-06-25 09:55:35 +00:00
|
|
|
#include <ndk/exfuncs.h>
|
2013-01-28 22:45:53 +00:00
|
|
|
#include <ndk/psfuncs.h>
|
|
|
|
#include <ndk/rtlfuncs.h>
|
2012-10-22 00:09:51 +00:00
|
|
|
|
|
|
|
#include <csr/csrsrv.h>
|
2012-10-20 13:00:41 +00:00
|
|
|
|
2005-02-26 15:06:19 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
1999-06-08 22:50:59 +00:00
|
|
|
|
2010-03-10 04:59:39 +00:00
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
CsrpSetDefaultProcessHardErrorMode(VOID)
|
|
|
|
{
|
|
|
|
ULONG DefaultHardErrorMode = 0;
|
|
|
|
|
|
|
|
/* Disable hard errors */
|
|
|
|
NtSetInformationProcess(NtCurrentProcess(),
|
|
|
|
ProcessDefaultHardErrorMode,
|
|
|
|
&DefaultHardErrorMode,
|
|
|
|
sizeof(DefaultHardErrorMode));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_cdecl
|
|
|
|
_main(int argc,
|
|
|
|
char *argv[],
|
|
|
|
char *envp[],
|
|
|
|
int DebugFlag)
|
2005-02-26 15:06:19 +00:00
|
|
|
{
|
2010-03-10 04:59:39 +00:00
|
|
|
KPRIORITY BasePriority = (8 + 1) + 4;
|
|
|
|
NTSTATUS Status;
|
2021-06-25 10:42:02 +00:00
|
|
|
#if defined (_X86_)
|
2021-06-25 09:55:35 +00:00
|
|
|
ULONG Response;
|
2021-06-25 10:42:02 +00:00
|
|
|
#endif
|
2012-02-15 16:11:12 +00:00
|
|
|
UNREFERENCED_PARAMETER(envp);
|
|
|
|
UNREFERENCED_PARAMETER(DebugFlag);
|
2010-03-10 04:59:39 +00:00
|
|
|
|
|
|
|
/* Set the Priority */
|
|
|
|
NtSetInformationProcess(NtCurrentProcess(),
|
|
|
|
ProcessBasePriority,
|
|
|
|
&BasePriority,
|
|
|
|
sizeof(KPRIORITY));
|
|
|
|
|
2021-06-20 13:49:55 +00:00
|
|
|
#if defined (_X86_)
|
2012-02-15 16:11:12 +00:00
|
|
|
/* Give us IOPL so that we can access the VGA registers */
|
|
|
|
Status = NtSetInformationProcess(NtCurrentProcess(),
|
|
|
|
ProcessUserModeIOPL,
|
|
|
|
NULL,
|
|
|
|
0);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Raise a hard error */
|
2013-09-21 18:38:30 +00:00
|
|
|
DPRINT1("CSRSS: Could not raise IOPL, Status: 0x%08lx\n", Status);
|
2012-02-15 16:11:12 +00:00
|
|
|
Status = NtRaiseHardError(STATUS_IO_PRIVILEGE_FAILED,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
OptionOk,
|
|
|
|
&Response);
|
|
|
|
}
|
2021-06-20 13:49:55 +00:00
|
|
|
#endif
|
2012-02-15 16:11:12 +00:00
|
|
|
|
2010-03-10 04:59:39 +00:00
|
|
|
/* Initialize CSR through CSRSRV */
|
|
|
|
Status = CsrServerInitialization(argc, argv);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Kill us */
|
2013-09-21 18:38:30 +00:00
|
|
|
DPRINT1("CSRSS: Unable to initialize server, Status: 0x%08lx\n", Status);
|
2010-03-10 04:59:39 +00:00
|
|
|
NtTerminateProcess(NtCurrentProcess(), Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable errors */
|
|
|
|
CsrpSetDefaultProcessHardErrorMode();
|
|
|
|
|
|
|
|
/* If this is Session 0, make sure killing us bugchecks the system */
|
2012-10-20 13:00:41 +00:00
|
|
|
if (NtCurrentPeb()->SessionId == 0) RtlSetProcessIsCritical(TRUE, NULL, FALSE);
|
2010-03-10 04:59:39 +00:00
|
|
|
|
|
|
|
/* Kill this thread. CSRSRV keeps us going */
|
2012-02-15 16:11:12 +00:00
|
|
|
NtTerminateThread(NtCurrentThread(), Status);
|
2010-03-10 04:59:39 +00:00
|
|
|
return 0;
|
1999-06-08 22:50:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|