ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

csrss.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Client Server Runtime SubSystem (CSRSS)
00003  * LICENSE:         BSD - See COPYING.ARM in root directory
00004  * FILE:            subsystems/win32/csrss/csrss.c
00005  * PURPOSE:         Main Executable Code
00006  * PROGRAMMERS:     Alex Ionescu
00007  *                  ReactOS Portable Systems Group
00008  */
00009 
00010 /* INCLUDES *******************************************************************/
00011 
00012 #define WIN32_NO_STATUS
00013 #include <windows.h>
00014 #define NTOS_MODE_USER
00015 #include <ndk/ntndk.h>
00016 #include <api.h>
00017 #define NDEBUG
00018 #include <debug.h>
00019 
00020 /* 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 int
00036 _cdecl
00037 _main(int argc,
00038       char *argv[],
00039       char *envp[],
00040       int DebugFlag)
00041 {
00042     KPRIORITY BasePriority = (8 + 1) + 4;
00043     NTSTATUS Status;
00044     //ULONG Response;
00045     UNREFERENCED_PARAMETER(envp);
00046     UNREFERENCED_PARAMETER(DebugFlag);
00047 
00048     /* Set the Priority */
00049     NtSetInformationProcess(NtCurrentProcess(),
00050                             ProcessBasePriority,
00051                             &BasePriority,
00052                             sizeof(KPRIORITY));
00053 
00054     /* Give us IOPL so that we can access the VGA registers */
00055     Status = NtSetInformationProcess(NtCurrentProcess(),
00056                                      ProcessUserModeIOPL,
00057                                      NULL,
00058                                      0);
00059     if (!NT_SUCCESS(Status))
00060     {
00061         /* Raise a hard error */
00062         DPRINT1("CSRSS: Could not raise IOPL: %x\n", Status);
00063 #if 0
00064         Status = NtRaiseHardError(STATUS_IO_PRIVILEGE_FAILED,
00065                                   0,
00066                                   0,
00067                                   NULL,
00068                                   OptionOk,
00069                                   &Response);
00070 #endif
00071     }
00072 
00073     /* Initialize CSR through CSRSRV */
00074     Status = CsrServerInitialization(argc, argv);
00075     if (!NT_SUCCESS(Status))
00076     {
00077         /* Kill us */
00078         DPRINT1("CSRSS: CsrServerInitialization failed:% lx\n", Status);
00079         NtTerminateProcess(NtCurrentProcess(), Status);
00080     }
00081 
00082     /* Disable errors */
00083     CsrpSetDefaultProcessHardErrorMode();
00084 
00085     /* If this is Session 0, make sure killing us bugchecks the system */
00086     if (!NtCurrentPeb()->SessionId) RtlSetProcessIsCritical(TRUE, NULL, FALSE);
00087 
00088     /* Kill this thread. CSRSRV keeps us going */
00089     NtTerminateThread(NtCurrentThread(), Status);
00090     return 0;
00091 }
00092 
00093 /* EOF */

Generated on Wed May 23 2012 04:35:29 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.