Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmain.cGo to the documentation of this file.00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS CSR Sub System 00004 * FILE: subsys/csr/csrss.c 00005 * PURPOSE: CSR Executable 00006 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) 00007 */ 00008 00009 /* INCLUDES ******************************************************************/ 00010 00011 #define WIN32_NO_STATUS 00012 #include <windows.h> 00013 #define NTOS_MODE_USER 00014 #include <ndk/ntndk.h> 00015 #include <csr/server.h> 00016 00017 #define NDEBUG 00018 #include <debug.h> 00019 00020 /* PRIVATE FUNCTIONS *********************************************************/ 00021 00022 VOID 00023 NTAPI 00024 CsrpSetDefaultProcessHardErrorMode (VOID) 00025 { 00026 ULONG DefaultHardErrorMode = 0; 00027 00028 /* Disable hard errors */ 00029 NtSetInformationProcess(NtCurrentProcess(), 00030 ProcessDefaultHardErrorMode, 00031 &DefaultHardErrorMode, 00032 sizeof(DefaultHardErrorMode)); 00033 } 00034 00035 /* 00036 * Note: Standard entrypoint for Native C Programs. 00037 * The OS backend (NtProcessStartup) which calls this routine is 00038 * implemented in a CRT-like static library (much like mainCRTStartup). 00039 * Do NOT manually add the NtProcessStartup entrypoint or anything else. 00040 */ 00041 int 00042 _cdecl 00043 _main(int argc, 00044 char *argv[], 00045 char *envp[], 00046 int DebugFlag) 00047 { 00048 KPRIORITY BasePriority = (8 + 1) + 4; 00049 NTSTATUS Status; 00050 ULONG Response; 00051 UNREFERENCED_PARAMETER(envp); 00052 UNREFERENCED_PARAMETER(DebugFlag); 00053 00054 /* Set the Priority */ 00055 NtSetInformationProcess(NtCurrentProcess(), 00056 ProcessBasePriority, 00057 &BasePriority, 00058 sizeof(KPRIORITY)); 00059 00060 /* Give us IOPL so that we can access the VGA registers */ 00061 Status = NtSetInformationProcess(NtCurrentProcess(), 00062 ProcessUserModeIOPL, 00063 NULL, 00064 0); 00065 if (!NT_SUCCESS(Status)) 00066 { 00067 /* Raise a hard error */ 00068 DPRINT1("CSRSS: Could not raise IOPL: %x\n", Status); 00069 Status = NtRaiseHardError(STATUS_IO_PRIVILEGE_FAILED, 00070 0, 00071 0, 00072 NULL, 00073 OptionOk, 00074 &Response); 00075 } 00076 00077 /* Initialize CSR through CSRSRV */ 00078 Status = CsrServerInitialization(argc, argv); 00079 if (!NT_SUCCESS(Status)) 00080 { 00081 /* Kill us */ 00082 DPRINT1("CSRSS: CsrServerInitialization failed:% lx\n", Status); 00083 NtTerminateProcess(NtCurrentProcess(), Status); 00084 } 00085 00086 /* Disable errors */ 00087 CsrpSetDefaultProcessHardErrorMode(); 00088 00089 /* If this is Session 0, make sure killing us bugchecks the system */ 00090 if (!NtCurrentPeb()->SessionId) RtlSetProcessIsCritical(TRUE, NULL, FALSE); 00091 00092 /* Kill this thread. CSRSRV keeps us going */ 00093 NtTerminateThread(NtCurrentThread(), Status); 00094 return 0; 00095 } 00096 00097 /* EOF */ Generated on Tue May 15 04:38:48 2012 for ReactOS by
1.6.3
|