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>
37 #include <rosrtl/string.h>
41 /* Native process' entry point */
43 VOID STDCALL
NtProcessStartup(PPEB Peb
)
45 PRTL_USER_PROCESS_PARAMETERS ProcParams
;
50 int afterlastspace
= 0;
51 OBJECT_ATTRIBUTES ObjectAttributes
;
52 HANDLE CsrssInitEvent
;
53 UNICODE_STRING UnicodeString
;
56 ProcParams
= RtlNormalizeProcessParams (Peb
->ProcessParameters
);
58 argv
= (PWSTR
*)RtlAllocateHeap (Peb
->ProcessHeap
,
59 0, 512 * sizeof(PWSTR
));
60 ArgBuffer
= (PWSTR
)RtlAllocateHeap (Peb
->ProcessHeap
,
62 ProcParams
->CommandLine
.Length
+ sizeof(WCHAR
));
64 ProcParams
->CommandLine
.Buffer
,
65 ProcParams
->CommandLine
.Length
+ sizeof(WCHAR
));
69 if (ArgBuffer
[i
] == L
' ')
73 argv
[argc
-1] = &(ArgBuffer
[afterlastspace
]);
75 while (ArgBuffer
[i
] == L
' ')
85 if (ArgBuffer
[afterlastspace
] != L
'\0')
89 argv
[argc
-1] = &(ArgBuffer
[afterlastspace
]);
92 RtlRosInitUnicodeStringFromLiteral(&UnicodeString
,
94 InitializeObjectAttributes(&ObjectAttributes
,
99 Status
= NtOpenEvent(&CsrssInitEvent
,
102 if (!NT_SUCCESS(Status
))
104 DbgPrint("CSR: Failed to open csrss notification event\n");
106 if (CsrServerInitialization (argc
, argv
) == TRUE
)
109 NtSetEvent(CsrssInitEvent
,
112 RtlFreeHeap (Peb
->ProcessHeap
,
114 RtlFreeHeap (Peb
->ProcessHeap
,
118 /* terminate the current thread only */
119 NtTerminateThread( NtCurrentThread(), 0 );
123 DisplayString( L
"CSR: Subsystem initialization failed.\n" );
125 RtlFreeHeap (Peb
->ProcessHeap
,
127 RtlFreeHeap (Peb
->ProcessHeap
,
134 NtTerminateProcess( NtCurrentProcess(), 0 );