[ros-diffs] [hpoussin] 28116: Create the invisible SAS window even in setup mode Explicitly reboot at the end of 2nd stage See issue #2431 for more details.

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Fri Aug 3 11:28:01 CEST 2007


Author: hpoussin
Date: Fri Aug  3 13:28:01 2007
New Revision: 28116

URL: http://svn.reactos.org/svn/reactos?rev=28116&view=rev
Log:
Create the invisible SAS window even in setup mode
Explicitly reboot at the end of 2nd stage
See issue #2431 for more details.

Modified:
    trunk/reactos/base/system/winlogon/sas.c
    trunk/reactos/base/system/winlogon/setup.c
    trunk/reactos/base/system/winlogon/winlogon.c
    trunk/reactos/dll/win32/syssetup/install.c

Modified: trunk/reactos/base/system/winlogon/sas.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/sas.c?rev=28116&r1=28115&r2=28116&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/sas.c (original)
+++ trunk/reactos/base/system/winlogon/sas.c Fri Aug  3 13:28:01 2007
@@ -794,8 +794,13 @@
 	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 @@
 		goto cleanup;
 	}
 
-	/* create invisible SAS window */
+	/* Create invisible SAS window */
 	Session->SASWindow = CreateWindowExW(
 		0,
 		WINLOGON_SAS_CLASS,

Modified: trunk/reactos/base/system/winlogon/setup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/setup.c?rev=28116&r1=28115&r2=28116&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/setup.c (original)
+++ trunk/reactos/base/system/winlogon/setup.c Fri Aug  3 13:28:01 2007
@@ -85,8 +85,8 @@
 }
 
 
-BOOL
-RunSetup (VOID)
+static DWORD WINAPI
+RunSetupThreadProc (IN LPVOID lpParameter)
 {
   PROCESS_INFORMATION ProcessInformation;
   STARTUPINFOW StartupInfo;
@@ -184,4 +184,13 @@
 }
 
 
+BOOL
+RunSetup (VOID)
+{
+	HANDLE hThread;
+
+	hThread = CreateThread(NULL, 0, RunSetupThreadProc, NULL, 0, NULL);
+	return hThread != NULL;
+}
+
 /* EOF */

Modified: trunk/reactos/base/system/winlogon/winlogon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlogon.c?rev=28116&r1=28115&r2=28116&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.c (original)
+++ trunk/reactos/base/system/winlogon/winlogon.c Fri Aug  3 13:28:01 2007
@@ -155,130 +155,6 @@
 
 	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(
@@ -410,22 +286,6 @@
 		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 @@
 	/* 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))

Modified: trunk/reactos/dll/win32/syssetup/install.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install.c?rev=28116&r1=28115&r2=28116&view=diff
==============================================================================
--- trunk/reactos/dll/win32/syssetup/install.c (original)
+++ trunk/reactos/dll/win32/syssetup/install.c Fri Aug  3 13:28:01 2007
@@ -570,8 +570,7 @@
     if (!res)
         goto cleanup;
 
-    /* Wait for process termination */
-    WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
+    return 0;
 
 cleanup:
     MessageBoxA(
@@ -728,6 +727,7 @@
     /// DO NOT REMOVE!!!
     DbgPrint("SYSREG_CHECKPOINT:SYSSETUP_COMPLETE\n");
 
+    ExitWindowsEx(EWX_REBOOT, 0);
     return 0;
 }
 




More information about the Ros-diffs mailing list