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
This commit is contained in:
Hervé Poussineau 2007-08-03 09:28:01 +00:00
parent eedac786ea
commit cfda12103c
4 changed files with 33 additions and 148 deletions

View file

@ -794,8 +794,13 @@ InitializeSAS(
WNDCLASSEXW swc; WNDCLASSEXW swc;
BOOL ret = FALSE; BOOL ret = FALSE;
/* register SAS window class. if (!SwitchDesktop(Session->WinlogonDesktop))
* WARNING! MAKE SURE WE ARE IN THE WINLOGON DESKTOP! */ {
ERR("WL: Failed to switch to winlogon desktop\n");
goto cleanup;
}
/* Register SAS window class */
swc.cbSize = sizeof(WNDCLASSEXW); swc.cbSize = sizeof(WNDCLASSEXW);
swc.style = CS_SAVEBITS; swc.style = CS_SAVEBITS;
swc.lpfnWndProc = SASWindowProc; swc.lpfnWndProc = SASWindowProc;
@ -814,7 +819,7 @@ InitializeSAS(
goto cleanup; goto cleanup;
} }
/* create invisible SAS window */ /* Create invisible SAS window */
Session->SASWindow = CreateWindowExW( Session->SASWindow = CreateWindowExW(
0, 0,
WINLOGON_SAS_CLASS, WINLOGON_SAS_CLASS,

View file

@ -85,8 +85,8 @@ SetSetupType (DWORD dwSetupType)
} }
BOOL static DWORD WINAPI
RunSetup (VOID) RunSetupThreadProc (IN LPVOID lpParameter)
{ {
PROCESS_INFORMATION ProcessInformation; PROCESS_INFORMATION ProcessInformation;
STARTUPINFOW StartupInfo; 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 */ /* EOF */

View file

@ -156,130 +156,6 @@ StartLsass(VOID)
return TRUE; 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 BOOL
DisplayStatusMessage( DisplayStatusMessage(
IN PWLSESSION Session, IN PWLSESSION Session,
@ -410,22 +286,6 @@ WinMain(
ExitProcess(1); 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()) if (!StartLsass())
{ {
ERR("WL: Failed to start lsass.exe service (error %lu)\n", GetLastError()); ERR("WL: Failed to start lsass.exe service (error %lu)\n", GetLastError());
@ -489,7 +349,18 @@ WinMain(
/* Display logged out screen */ /* Display logged out screen */
WLSession->LogonStatus = WKSTA_IS_LOGGED_OFF; WLSession->LogonStatus = WKSTA_IS_LOGGED_OFF;
RemoveStatusMessage(WLSession); 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 */ /* Message loop for the SAS window */
while (GetMessageW(&Msg, WLSession->SASWindow, 0, 0)) while (GetMessageW(&Msg, WLSession->SASWindow, 0, 0))

View file

@ -570,8 +570,7 @@ InstallLiveCD(IN HINSTANCE hInstance)
if (!res) if (!res)
goto cleanup; goto cleanup;
/* Wait for process termination */ return 0;
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
cleanup: cleanup:
MessageBoxA( MessageBoxA(
@ -728,6 +727,7 @@ InstallReactOS(HINSTANCE hInstance)
/// DO NOT REMOVE!!! /// DO NOT REMOVE!!!
DbgPrint("SYSREG_CHECKPOINT:SYSSETUP_COMPLETE\n"); DbgPrint("SYSREG_CHECKPOINT:SYSSETUP_COMPLETE\n");
ExitWindowsEx(EWX_REBOOT, 0);
return 0; return 0;
} }