From 3b8acca85c026faa368a65d17b69a2533589499d Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 9 Oct 2000 00:18:00 +0000 Subject: [PATCH] Minor update svn path=/trunk/; revision=1398 --- reactos/subsys/smss/init.c | 40 ++++++++++++++++++++------------------ reactos/subsys/smss/smss.c | 32 ++++++++++-------------------- 2 files changed, 31 insertions(+), 41 deletions(-) diff --git a/reactos/subsys/smss/init.c b/reactos/subsys/smss/init.c index 43da81e29e9..dde0591bcca 100644 --- a/reactos/subsys/smss/init.c +++ b/reactos/subsys/smss/init.c @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.18 2000/06/29 23:35:51 dwelch Exp $ +/* $Id: init.c,v 1.19 2000/10/09 00:18:00 ekohl Exp $ * * init.c - Session Manager initialization * @@ -29,14 +29,12 @@ #include #include #include +#include #include "smss.h" #define NDEBUG -/* uncomment to run csrss.exe */ -#define RUN_CSRSS - /* GLOBAL VARIABLES *********************************************************/ HANDLE SmApiPort = INVALID_HANDLE_VALUE; @@ -58,7 +56,7 @@ SmCreatePagingFiles (VOID) /* FIXME: Read file names from registry */ RtlInitUnicodeString (&FileName, - L"\\??\\C:\\reactos\\pagefile.sys"); + L"\\SystemRoot\\pagefile.sys"); NtCreatePagingFile (&FileName, 50, @@ -76,13 +74,16 @@ SmSetEnvironmentVariables (VOID) UNICODE_STRING EnvExpandedValue; ULONG ExpandedLength; WCHAR ExpandBuffer[512]; + WCHAR ValueBuffer[MAX_PATH]; + PKUSER_SHARED_DATA SharedUserData = + (PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE; /* * The following environment variables are read from the registry. - * Since the registry does not work yet, the environment variables - * are set one by one, using hard-coded default values. + * Because the registry does not work yet, the environment variables + * are set one by one, using information from the shared user page. * - * Variables: + * Variables (example): * SystemRoot = C:\reactos * SystemDrive = C: * @@ -91,20 +92,24 @@ SmSetEnvironmentVariables (VOID) * windir = %SystemRoot% */ - /* Set "SystemRoot = C:\reactos" */ + /* copy system root into value buffer */ + wcscpy (ValueBuffer, SharedUserData->NtSystemRoot); + + /* set "SystemRoot = C:\reactos" */ RtlInitUnicodeString (&EnvVariable, L"SystemRoot"); RtlInitUnicodeString (&EnvValue, - L"C:\\reactos"); + ValueBuffer); RtlSetEnvironmentVariable (&SmSystemEnvironment, &EnvVariable, &EnvValue); + /* cut off trailing path */ + ValueBuffer[2] = 0; + /* Set "SystemDrive = C:" */ RtlInitUnicodeString (&EnvVariable, L"SystemDrive"); - RtlInitUnicodeString (&EnvValue, - L"C:"); RtlSetEnvironmentVariable (&SmSystemEnvironment, &EnvVariable, &EnvValue); @@ -236,17 +241,15 @@ BOOL InitSessionManager (HANDLE Children[]) SmCreatePagingFiles (); #endif -#if 0 - /* Load missing registry hives */ + /* Load remaining registry hives */ NtInitializeRegistry (FALSE); -#endif /* Set environment variables from registry */ SmSetEnvironmentVariables (); /* Load the kernel mode driver win32k.sys */ RtlInitUnicodeString (&CmdLineW, - L"\\??\\C:\\reactos\\system32\\drivers\\win32k.sys"); + L"\\SystemRoot\\system32\\drivers\\win32k.sys"); Status = NtLoadDriver (&CmdLineW); if (!NT_SUCCESS(Status)) @@ -254,7 +257,7 @@ BOOL InitSessionManager (HANDLE Children[]) return FALSE; } -#ifdef RUN_CSRSS + /* Run csrss.exe */ RtlInitUnicodeString(&UnicodeString, L"\\CsrssInitDone"); InitializeObjectAttributes(&ObjectAttributes, @@ -301,7 +304,7 @@ BOOL InitSessionManager (HANDLE Children[]) FALSE, 0, 0, - 0, + 0, &ProcessInfo); RtlDestroyProcessParameters (ProcessParameters); @@ -319,7 +322,6 @@ BOOL InitSessionManager (HANDLE Children[]) DbgPrint("SM: Finished waiting for csrss\n"); Children[CHILD_CSRSS] = ProcessInfo.ProcessHandle; -#endif /* RUN_CSRSS */ /* Start the simple shell (shell.exe) */ diff --git a/reactos/subsys/smss/smss.c b/reactos/subsys/smss/smss.c index bbd3eacb07e..aec6828710e 100644 --- a/reactos/subsys/smss/smss.c +++ b/reactos/subsys/smss/smss.c @@ -1,4 +1,4 @@ -/* $Id: smss.c,v 1.7 2000/02/27 15:47:17 ekohl Exp $ +/* $Id: smss.c,v 1.8 2000/10/09 00:18:00 ekohl Exp $ * * smss.c - Session Manager * @@ -48,7 +48,6 @@ PrintString (char* fmt,...) va_list ap; UNICODE_STRING UnicodeString; ANSI_STRING AnsiString; - ULONG i; va_start(ap, fmt); vsprintf(buffer, fmt, ap); @@ -92,38 +91,27 @@ void NtProcessStartup (PPEB Peb) TRUE, /* alertable */ NULL ); - - - // if (!NT_SUCCESS(wws)) + +// if (!NT_SUCCESS(wws)) if (wws > 1) { DisplayString( L"SM: NtWaitForMultipleObjects failed!\n" ); - /* FIXME: CRASH THE SYSTEM (BSOD) */ } else { DisplayString( L"SM: Process terminated!\n" ); - /* FIXME: CRASH THE SYSTEM (BSOD) */ } } else { - DisplayString( L"SM: initialization failed!\n" ); - /* FIXME: CRASH SYSTEM (BSOD)*/ + DisplayString( L"SM: Initialization failed!\n" ); } - - - /* - * OK: CSRSS asked to shutdown the system; - * We die. - */ -#if 0 - NtRaiseHardError ( - STATUS_SYSTEM_PROCESS_TERMINATED, - ...); -#endif - - NtTerminateProcess(NtCurrentProcess(), 0); + + /* Raise a hard error (crash the system/BSOD) */ + NtRaiseHardError (STATUS_SYSTEM_PROCESS_TERMINATED, + 0,0,0,0,0); + +// NtTerminateProcess(NtCurrentProcess(), 0); } /* EOF */