1 /* $Id: init.c,v 1.4 1999/12/01 15:18:54 ekohl Exp $
3 * init.c - Session Manager initialization
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 * 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 * 19990530 (Emanuele Aliberti)
27 * Compiled successfully with egcs 1.1.2
29 #include <ddk/ntddk.h>
30 #include <ntdll/rtl.h>
37 /* GLOBAL VARIABLES *********************************************************/
39 HANDLE SmApiPort
= INVALID_HANDLE_VALUE
;
40 HANDLE DbgSsApiPort
= INVALID_HANDLE_VALUE
;
41 HANDLE DbgUiApiPort
= INVALID_HANDLE_VALUE
;
43 PVOID SmSystemEnvironment
= NULL
;
46 /* FUNCTIONS ****************************************************************/
50 SmCreatePagingFiles (VOID
)
52 UNICODE_STRING FileName
;
55 /* FIXME: Read file names from registry */
57 RtlInitUnicodeString (&FileName
,
58 L
"\\??\\C:\\reactos\\pagefile.sys");
60 NtCreatePagingFile (&FileName
,
74 UNICODE_STRING UnicodeString
;
75 OBJECT_ATTRIBUTES ObjectAttributes
;
76 UNICODE_STRING CmdLineW
;
78 /* Create the "\SmApiPort" object (LPC) */
79 RtlInitUnicodeString (&UnicodeString
,
81 InitializeObjectAttributes (&ObjectAttributes
,
87 Status
= NtCreatePort (&SmApiPort
,
93 if (!NT_SUCCESS(Status
))
99 DisplayString (L
"SmApiPort created...\n");
102 /* Create two threads for "\SmApiPort" */
103 RtlCreateUserThread (NtCurrentProcess (),
109 (PTHREAD_START_ROUTINE
)SmApiThread
,
114 RtlCreateUserThread (NtCurrentProcess (),
120 (PTHREAD_START_ROUTINE
)SmApiThread
,
125 /* Create the system environment */
126 Status
= RtlCreateEnvironment (TRUE
,
127 &SmSystemEnvironment
);
128 if (!NT_SUCCESS(Status
))
131 DisplayString (L
"System Environment created\n");
134 /* FIXME: Define symbolic links to kernel devices (MS-DOS names) */
136 /* FIXME: Run all programs in the boot execution list */
138 /* FIXME: Process the file rename list */
140 /* Create paging files */
142 SmCreatePagingFiles ();
145 /* FIXME: Load the well known DLLs */
147 /* FIXME: Load missing registry hives */
149 /* FIXME: Set environment variables from registry */
151 /* Load the kernel mode driver win32k.sys */
152 RtlInitUnicodeString (&CmdLineW
,
153 L
"\\??\\C:\\reactos\\system32\\drivers\\win32k.sys");
154 Status
= NtLoadDriver (&CmdLineW
);
156 if (!NT_SUCCESS(Status
))
161 /* Start the Win32 subsystem (csrss.exe) */
163 DisplayString (L
"Executing csrss.exe\n");
164 RtlInitUnicodeString (&UnicodeString
,
165 L
"\\??\\C:\\reactos\\system32\\csrss.exe");
167 Status
= RtlCreateUserProcess (&UnicodeString
,
173 &Children
[CHILD_CSRSS
],
176 if (!NT_SUCCESS(Status
))
178 DisplayString (L
"Loading csrss.exe failed!\n");
183 /* Start the simple shell (shell.exe) */
184 DisplayString (L
"Executing shell\n");
185 RtlInitUnicodeString (&UnicodeString
,
186 L
"\\??\\C:\\reactos\\system32\\shell.exe");
189 /* Start the logon process (winlogon.exe) */
190 RtlInitUnicodeString (&CmdLineW
,
191 L
"\\??\\C:\\reactos\\system32\\winlogon.exe");
193 Status
= RtlCreateUserProcess (&UnicodeString
,
199 &Children
[CHILD_WINLOGON
],
202 if (!NT_SUCCESS(Status
))
204 DisplayString (L
"Loading shell.exe failed!\n");
206 NtTerminateProcess (Children
[CHILD_CSRSS
],
212 /* Create the \DbgSsApiPort object (LPC) */
213 RtlInitUnicodeString (&UnicodeString
,
215 InitializeObjectAttributes (&ObjectAttributes
,
221 Status
= NtCreatePort (&DbgSsApiPort
,
227 if (!NT_SUCCESS(Status
))
232 DisplayString (L
"DbgSsApiPort created...\n");
235 /* Create the \DbgUiApiPort object (LPC) */
236 RtlInitUnicodeString (&UnicodeString
,
238 InitializeObjectAttributes (&ObjectAttributes
,
244 Status
= NtCreatePort (&DbgUiApiPort
,
250 if (!NT_SUCCESS(Status
))
255 DisplayString (L
"DbgUiApiPort created...\n");