3 * main.c - Client/Server Runtime - entry point
5 * ReactOS Operating System
7 * --------------------------------------------------------------------
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
14 * This software is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this software; see the file COPYING.LIB. If not, write
21 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
24 * --------------------------------------------------------------------
26 * 19990417 (Emanuele Aliberti)
27 * Do nothing native application skeleton
28 * 19990528 (Emanuele Aliberti)
29 * Compiled successfully with egcs 1.1.2
30 * 19990605 (Emanuele Aliberti)
31 * First standalone run under ReactOS (it
32 * actually does nothing but running).
33 * 20050329 (Emanuele Aliberti)
34 * C/S run-time moved to CSRSRV.DLL
35 * Win32 emulation moved to server DLLs basesrv+winsrv
36 * (previously code was already in win32csr.dll)
43 COMMAND_LINE_ARGUMENT Argument
;
45 /* never fail or so */
47 VOID STDCALL
CsrpSetDefaultProcessHardErrorMode (VOID
)
49 DWORD DefaultHardErrorMode
= 0;
50 NtSetInformationProcess (NtCurrentProcess(),
51 ProcessDefaultHardErrorMode
,
52 & DefaultHardErrorMode
,
53 sizeof DefaultHardErrorMode
);
56 /* Native process' entry point */
58 VOID STDCALL
NtProcessStartup (PPEB Peb
)
60 NTSTATUS Status
= STATUS_SUCCESS
;
63 * Parse the command line.
65 Status
= CsrParseCommandLine (Peb
, & Argument
);
66 if (STATUS_SUCCESS
!= Status
)
68 DPRINT1("CSR: %s: CsrParseCommandLine failed (Status=0x%08lx)\n",
69 __FUNCTION__
, Status
);
72 * Initialize the environment subsystem server.
74 Status
= CsrServerInitialization (Argument
.Count
, Argument
.Vector
);
75 if (!NT_SUCCESS(Status
))
78 DPRINT1("CSR: %s: CSRSRV!CsrServerInitialization failed (Status=0x%08lx)\n",
79 __FUNCTION__
, Status
);
81 CsrFreeCommandLine (Peb
, & Argument
);
83 * Tell the SM we failed. If we are a required
84 * subsystem, SM will halt the system.
86 NtTerminateProcess (NtCurrentProcess(), Status
);
89 * The server booted OK: never stop on error!
91 CsrpSetDefaultProcessHardErrorMode ();
93 * Cleanup command line
95 CsrFreeCommandLine (Peb
, & Argument
);
97 * Terminate the current thread only (server's
98 * threads that serve the LPC port continue
99 * running and keep the process alive).
101 NtTerminateThread (NtCurrentThread(), Status
);