From 45ce03c95feda0617b2099e3706b5f035b3487c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 2 Feb 2003 22:38:54 +0000 Subject: [PATCH] Make starting of SERVICES.EXE dependent on registry key svn path=/trunk/; revision=4108 --- reactos/subsys/system/winlogon/winlogon.c | 75 +++++++++++++++++------ reactos/system.hiv | 1 + 2 files changed, 58 insertions(+), 18 deletions(-) diff --git a/reactos/subsys/system/winlogon/winlogon.c b/reactos/subsys/system/winlogon/winlogon.c index cdddb95bbf8..171e9fe6799 100644 --- a/reactos/subsys/system/winlogon/winlogon.c +++ b/reactos/subsys/system/winlogon/winlogon.c @@ -1,4 +1,4 @@ -/* $Id: winlogon.c,v 1.14 2003/01/23 00:16:47 gvg Exp $ +/* $Id: winlogon.c,v 1.15 2003/02/02 22:38:54 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -30,7 +30,7 @@ HDESK ScreenSaverDesktop; /* WinSta0\Screen-Saver */ /* FUNCTIONS *****************************************************************/ -void PrintString (char* fmt,...) +static void PrintString (char* fmt,...) { char buffer[512]; va_list ap; @@ -43,7 +43,7 @@ void PrintString (char* fmt,...) } -BOOLEAN StartServices(VOID) +static BOOLEAN StartServices(VOID) { HANDLE ServicesInitEvent; BOOLEAN Result; @@ -113,7 +113,7 @@ BOOLEAN StartServices(VOID) return TRUE; } -BOOLEAN StartLsass(VOID) +static BOOLEAN StartLsass(VOID) { HANDLE LsassInitEvent; BOOLEAN Result; @@ -168,7 +168,46 @@ BOOLEAN StartLsass(VOID) return(TRUE); } -PCHAR GetShell(PCHAR CommandLine) +static BOOLEAN OpenRegistryKey(HANDLE *WinLogonKey) +{ + return ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\WinLogon"), + 0, + KEY_QUERY_VALUE, + WinLogonKey); +} + +static BOOLEAN StartProcess(PCHAR ValueName) +{ + BOOL StartIt; + HANDLE WinLogonKey; + DWORD Type; + DWORD Size; + DWORD StartValue; + + StartIt = TRUE; + if (OpenRegistryKey(&WinLogonKey)) + { + Size = sizeof(DWORD); + if (ERROR_SUCCESS == RegQueryValueEx(WinLogonKey, + ValueName, + NULL, + &Type, + (LPBYTE) &StartValue, + &Size)) + { + if (REG_DWORD == Type) + { + StartIt = (0 != StartValue); + } + } + RegCloseKey(WinLogonKey); + } + + return StartIt; +} + +static PCHAR GetShell(PCHAR CommandLine) { HANDLE WinLogonKey; BOOL GotCommandLine; @@ -177,18 +216,14 @@ PCHAR GetShell(PCHAR CommandLine) CHAR Shell[_MAX_PATH]; GotCommandLine = FALSE; - if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, - _T("SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\WinLogon"), - 0, - KEY_QUERY_VALUE, - &WinLogonKey)) + if (OpenRegistryKey(&WinLogonKey)) { Size = MAX_PATH; if (ERROR_SUCCESS == RegQueryValueEx(WinLogonKey, _T("Shell"), NULL, &Type, - Shell, + (LPBYTE) Shell, &Size)) { if (REG_EXPAND_SZ == Type) @@ -214,7 +249,7 @@ PCHAR GetShell(PCHAR CommandLine) return CommandLine; } -BOOL DoLoginUser(PCHAR Name, PCHAR Password) +static BOOL DoLoginUser(PCHAR Name, PCHAR Password) { PROCESS_INFORMATION ProcessInformation; STARTUPINFO StartupInfo; @@ -350,16 +385,20 @@ WinMain(HINSTANCE hInstance, AllocConsole(); SetConsoleTitle( "Winlogon" ); /* start system processes (services.exe & lsass.exe) */ - Success = StartServices(); - if (!Success) + if (StartProcess("StartServices")) { - DbgPrint("WL: Failed to Start Services (0x%X)\n", GetLastError()); + if (!StartServices()) + { + DbgPrint("WL: Failed to Start Services (0x%X)\n", GetLastError()); + } } #if 0 - Success = StartLsass(); - if (!Success) + if (StartProcess("StartLsass")) { - DbgPrint("WL: Failed to Start Security System (0x%X)\n", GetLastError()); + if (!StartLsass()) + { + DbgPrint("WL: Failed to Start Security System (0x%X)\n", GetLastError()); + } } #endif diff --git a/reactos/system.hiv b/reactos/system.hiv index db1ffd6d809..d1d5648fc1a 100644 --- a/reactos/system.hiv +++ b/reactos/system.hiv @@ -327,3 +327,4 @@ REGEDIT4 [\Registry\Machine\SOFTWARE\ReactOS\Windows NT\CurrentVersion\WinLogon] "Shell"=expand:"%SystemRoot%\System32\Shell.exe" +"StartServices"=dword:00000001