1 /* $Id: csrss.c,v 1.10 2002/02/08 02:57:10 chorns Exp $
3 * csrss.c - Client/Server Runtime subsystem
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).
34 #include <ddk/ntddk.h>
35 #include <ntdll/rtl.h>
36 #include <csrss/csrss.h>
40 /* Native process' entry point */
42 VOID
NtProcessStartup(PPEB Peb
)
44 PRTL_USER_PROCESS_PARAMETERS ProcParams
;
49 int afterlastspace
= 0;
50 OBJECT_ATTRIBUTES ObjectAttributes
;
51 HANDLE CsrssInitEvent
;
52 UNICODE_STRING UnicodeString
;
55 ProcParams
= RtlNormalizeProcessParams (Peb
->ProcessParameters
);
57 argv
= (PWSTR
*)RtlAllocateHeap (Peb
->ProcessHeap
,
58 0, 512 * sizeof(PWSTR
));
59 ArgBuffer
= (PWSTR
)RtlAllocateHeap (Peb
->ProcessHeap
,
61 ProcParams
->CommandLine
.Length
+ sizeof(WCHAR
));
63 ProcParams
->CommandLine
.Buffer
,
64 ProcParams
->CommandLine
.Length
+ sizeof(WCHAR
));
68 if (ArgBuffer
[i
] == L
' ')
72 argv
[argc
-1] = &(ArgBuffer
[afterlastspace
]);
74 while (ArgBuffer
[i
] == L
' ')
84 if (ArgBuffer
[afterlastspace
] != L
'\0')
88 argv
[argc
-1] = &(ArgBuffer
[afterlastspace
]);
91 RtlInitUnicodeString(&UnicodeString
,
93 InitializeObjectAttributes(&ObjectAttributes
,
98 Status
= NtOpenEvent(&CsrssInitEvent
,
101 if (!NT_SUCCESS(Status
))
103 DbgPrint("CSR: Failed to open csrss notification event\n");
105 if (CsrServerInitialization (argc
, argv
) == TRUE
)
108 NtSetEvent(CsrssInitEvent
,
111 RtlFreeHeap (Peb
->ProcessHeap
,
113 RtlFreeHeap (Peb
->ProcessHeap
,
117 /* terminate the current thread only */
118 NtTerminateThread( NtCurrentThread(), 0 );
122 DisplayString( L
"CSR: Subsystem initialization failed.\n" );
124 RtlFreeHeap (Peb
->ProcessHeap
,
126 RtlFreeHeap (Peb
->ProcessHeap
,
133 NtTerminateProcess( NtCurrentProcess(), 0 );