From cfda12103c874931fe111f3c34bfc621ef816b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Fri, 3 Aug 2007 09:28:01 +0000 Subject: [PATCH] Create the invisible SAS window even in setup mode Explicitly reboot at the end of 2nd stage See issue #2431 for more details. svn path=/trunk/; revision=28116 --- reactos/base/system/winlogon/sas.c | 11 +- reactos/base/system/winlogon/setup.c | 13 +- reactos/base/system/winlogon/winlogon.c | 153 ++---------------------- reactos/dll/win32/syssetup/install.c | 4 +- 4 files changed, 33 insertions(+), 148 deletions(-) diff --git a/reactos/base/system/winlogon/sas.c b/reactos/base/system/winlogon/sas.c index 8faa9a3a111..a5eaa980fa3 100644 --- a/reactos/base/system/winlogon/sas.c +++ b/reactos/base/system/winlogon/sas.c @@ -794,8 +794,13 @@ InitializeSAS( WNDCLASSEXW swc; BOOL ret = FALSE; - /* register SAS window class. - * WARNING! MAKE SURE WE ARE IN THE WINLOGON DESKTOP! */ + if (!SwitchDesktop(Session->WinlogonDesktop)) + { + ERR("WL: Failed to switch to winlogon desktop\n"); + goto cleanup; + } + + /* Register SAS window class */ swc.cbSize = sizeof(WNDCLASSEXW); swc.style = CS_SAVEBITS; swc.lpfnWndProc = SASWindowProc; @@ -814,7 +819,7 @@ InitializeSAS( goto cleanup; } - /* create invisible SAS window */ + /* Create invisible SAS window */ Session->SASWindow = CreateWindowExW( 0, WINLOGON_SAS_CLASS, diff --git a/reactos/base/system/winlogon/setup.c b/reactos/base/system/winlogon/setup.c index 50c432138b8..d9a2dc5cc2c 100644 --- a/reactos/base/system/winlogon/setup.c +++ b/reactos/base/system/winlogon/setup.c @@ -85,8 +85,8 @@ SetSetupType (DWORD dwSetupType) } -BOOL -RunSetup (VOID) +static DWORD WINAPI +RunSetupThreadProc (IN LPVOID lpParameter) { PROCESS_INFORMATION ProcessInformation; STARTUPINFOW StartupInfo; @@ -184,4 +184,13 @@ RunSetup (VOID) } +BOOL +RunSetup (VOID) +{ + HANDLE hThread; + + hThread = CreateThread(NULL, 0, RunSetupThreadProc, NULL, 0, NULL); + return hThread != NULL; +} + /* EOF */ diff --git a/reactos/base/system/winlogon/winlogon.c b/reactos/base/system/winlogon/winlogon.c index 53239cb7a8f..231250a74e9 100644 --- a/reactos/base/system/winlogon/winlogon.c +++ b/reactos/base/system/winlogon/winlogon.c @@ -156,130 +156,6 @@ StartLsass(VOID) return TRUE; } -#if 0 -static BOOL -OpenRegistryKey( - OUT HKEY *WinLogonKey) -{ - return ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, - L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon", - 0, - KEY_QUERY_VALUE, - WinLogonKey); -} -#endif - -#if 0 -static BOOL -StartProcess( - IN PWCHAR ValueName) -{ - BOOL StartIt; - HKEY 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; -} -#endif - -/* -static BOOL RestartShell( - IN OUT PWLSESSION Session) -{ - HKEY WinLogonKey; - DWORD Type, Size, Value; - - if(OpenRegistryKey(&WinLogonKey)) - { - Size = sizeof(DWORD); - if(ERROR_SUCCESS == RegQueryValueEx(WinLogonKey, - L"AutoRestartShell", - NULL, - &Type, - (LPBYTE)&Value, - &Size)) - { - if(Type == REG_DWORD) - { - RegCloseKey(WinLogonKey); - return (Value != 0); - } - } - RegCloseKey(WinLogonKey); - } - return FALSE; -} -*/ - -#if 0 -static PWCHAR -GetUserInit( - OUT WCHAR *CommandLine, - IN DWORD BufferLength) -{ - HKEY WinLogonKey; - BOOL GotCommandLine; - DWORD Type; - DWORD Size; - WCHAR Shell[_MAX_PATH]; - - GotCommandLine = FALSE; - if (OpenRegistryKey(&WinLogonKey)) - { - Size = MAX_PATH; - if (ERROR_SUCCESS == RegQueryValueEx(WinLogonKey, - L"UserInit", - NULL, - &Type, - (LPBYTE) Shell, - &Size)) - { - if (REG_EXPAND_SZ == Type) - { - ExpandEnvironmentStrings(Shell, CommandLine, _MAX_PATH); - GotCommandLine = TRUE; - } - else if (REG_SZ == Type) - { - wcscpy(CommandLine, Shell); - GotCommandLine = TRUE; - } - } - RegCloseKey(WinLogonKey); - } - - if (! GotCommandLine) - { - GetSystemDirectory(CommandLine, MAX_PATH - 15); - wcscat(CommandLine, L"\\userinit.exe"); - } - - return CommandLine; -} - -#endif - BOOL DisplayStatusMessage( IN PWLSESSION Session, @@ -410,22 +286,6 @@ WinMain( ExitProcess(1); } - /* Check for pending setup */ - if (GetSetupType() != 0) - { - TRACE("WL: Setup mode detected\n"); - - /* Set locale */ - SetDefaultLanguage(FALSE); - - /* Run setup and reboot when done */ - SwitchDesktop(WLSession->ApplicationDesktop); - RunSetup(); - - HandleShutdown(WLSession, WLX_SAS_ACTION_SHUTDOWN_REBOOT); - ExitProcess(0); - } - if (!StartLsass()) { ERR("WL: Failed to start lsass.exe service (error %lu)\n", GetLastError()); @@ -489,7 +349,18 @@ WinMain( /* Display logged out screen */ WLSession->LogonStatus = WKSTA_IS_LOGGED_OFF; RemoveStatusMessage(WLSession); - PostMessageW(WLSession->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_TIMEOUT, 0); + + /* Check for pending setup */ + if (GetSetupType() != 0) + { + TRACE("WL: Setup mode detected\n"); + + /* Run setup and reboot when done */ + SwitchDesktop(WLSession->ApplicationDesktop); + RunSetup(); + } + else + PostMessageW(WLSession->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_TIMEOUT, 0); /* Message loop for the SAS window */ while (GetMessageW(&Msg, WLSession->SASWindow, 0, 0)) diff --git a/reactos/dll/win32/syssetup/install.c b/reactos/dll/win32/syssetup/install.c index 4cc61b00c9d..a5c1c3fe580 100644 --- a/reactos/dll/win32/syssetup/install.c +++ b/reactos/dll/win32/syssetup/install.c @@ -570,8 +570,7 @@ InstallLiveCD(IN HINSTANCE hInstance) if (!res) goto cleanup; - /* Wait for process termination */ - WaitForSingleObject(ProcessInformation.hProcess, INFINITE); + return 0; cleanup: MessageBoxA( @@ -728,6 +727,7 @@ InstallReactOS(HINSTANCE hInstance) /// DO NOT REMOVE!!! DbgPrint("SYSREG_CHECKPOINT:SYSSETUP_COMPLETE\n"); + ExitWindowsEx(EWX_REBOOT, 0); return 0; }