Author: hpoussin Date: Mon Oct 29 14:55:06 2007 New Revision: 29948
URL: http://svn.reactos.org/svn/reactos?rev=29948&view=rev Log: Rename console boot switch to CONSOLE
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c trunk/reactos/base/system/userinit/userinit.c trunk/reactos/dll/win32/msgina/msgina.c
Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/umpn... ============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c Mon Oct 29 14:55:06 2007 @@ -891,7 +891,7 @@ lstrcpyW(szKeyName, L"System\CurrentControlSet\Control\Class"); lstrcatW(szKeyName, L"\"); if(lstrlenW(ClassGuid) < sizeof(szKeyName)/sizeof(WCHAR)-lstrlenW(szKeyName)) - lstrcatW(szKeyName, ClassGuid); + lstrcatW(szKeyName, ClassGuid); else return CR_INVALID_DATA;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, @@ -1486,7 +1486,7 @@ typedef BOOL (WINAPI *PDEV_INSTALL_W)(HWND, HINSTANCE, LPCWSTR, INT);
static BOOL -InstallDevice(PCWSTR DeviceInstance, BOOL SetupIsActive) +InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard) { PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData; HMODULE hNewDev = NULL; @@ -1520,7 +1520,7 @@ if (!DevInstallW) goto cleanup;
- if (!DevInstallW(NULL, NULL, DeviceInstance, SetupIsActive ? SW_HIDE : SW_SHOWNOACTIVATE)) + if (!DevInstallW(NULL, NULL, DeviceInstance, ShowWizard ? SW_SHOWNOACTIVATE : SW_HIDE)) goto cleanup;
DeviceInstalled = TRUE; @@ -1530,6 +1530,43 @@ FreeLibrary(hNewDev);
return DeviceInstalled; +} + + +static LONG +ReadRegSzKey( + IN HKEY hKey, + IN LPCWSTR pszKey, + OUT LPWSTR* pValue) +{ + LONG rc; + DWORD dwType; + DWORD cbData = 0; + LPWSTR Value; + + if (!pValue) + return ERROR_INVALID_PARAMETER; + + *pValue = NULL; + rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData); + if (rc != ERROR_SUCCESS) + return rc; + if (dwType != REG_SZ) + return ERROR_FILE_NOT_FOUND; + Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR)); + if (!Value) + return ERROR_NOT_ENOUGH_MEMORY; + rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData); + if (rc != ERROR_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, Value); + return rc; + } + /* NULL-terminate the string */ + Value[cbData / sizeof(WCHAR)] = '\0'; + + *pValue = Value; + return ERROR_SUCCESS; }
@@ -1564,6 +1601,50 @@ }
+static BOOL +IsConsoleBoot(VOID) +{ + HKEY ControlKey = NULL; + LPWSTR SystemStartOptions = NULL; + LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */ + BOOL ConsoleBoot = FALSE; + LONG rc; + + rc = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + L"SYSTEM\CurrentControlSet\Control", + 0, + KEY_QUERY_VALUE, + &ControlKey); + + rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions); + if (rc != ERROR_SUCCESS) + goto cleanup; + + /* Check for CMDCONS in SystemStartOptions */ + CurrentOption = SystemStartOptions; + while (CurrentOption) + { + NextOption = wcschr(CurrentOption, L' '); + if (NextOption) + *NextOption = L'\0'; + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) + { + DPRINT("Found %S. Switching to console boot\n", CurrentOption); + ConsoleBoot = TRUE; + goto cleanup; + } + CurrentOption = NextOption ? NextOption + 1 : NULL; + } + +cleanup: + if (ControlKey != NULL) + RegCloseKey(ControlKey); + HeapFree(GetProcessHeap(), 0, SystemStartOptions); + return ConsoleBoot; +} + + /* Loop to install all queued devices installations */ static DWORD WINAPI DeviceInstallThread(LPVOID lpParameter) @@ -1574,11 +1655,11 @@ PLIST_ENTRY ListEntry; #endif DeviceInstallParams* Params; - BOOL setupActive; + BOOL showWizard;
UNREFERENCED_PARAMETER(lpParameter);
- setupActive = SetupIsActive(); + showWizard = !SetupIsActive() && !IsConsoleBoot();
SetEnvironmentVariable(L"USERPROFILE", L"."); /* FIXME: why is it needed? */
@@ -1601,7 +1682,7 @@ { ResetEvent(hNoPendingInstalls); Params = CONTAINING_RECORD(ListEntry, DeviceInstallParams, ListEntry); - InstallDevice(Params->DeviceIds, setupActive); + InstallDevice(Params->DeviceIds, showWizard); } }
Modified: trunk/reactos/base/system/userinit/userinit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/userinit/userin... ============================================================================== --- trunk/reactos/base/system/userinit/userinit.c (original) +++ trunk/reactos/base/system/userinit/userinit.c Mon Oct 29 14:55:06 2007 @@ -88,14 +88,14 @@ if (rc != ERROR_SUCCESS) goto cleanup;
- /* Check for CMDCONS in SystemStartOptions */ + /* Check for CONSOLE in SystemStartOptions */ CurrentOption = SystemStartOptions; while (CurrentOption) { NextOption = wcschr(CurrentOption, L' '); if (NextOption) *NextOption = L'\0'; - if (wcsicmp(CurrentOption, L"CMDCONS") == 0) + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) { ret = TRUE; goto cleanup;
Modified: trunk/reactos/dll/win32/msgina/msgina.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?r... ============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.c (original) +++ trunk/reactos/dll/win32/msgina/msgina.c Mon Oct 29 14:55:06 2007 @@ -118,7 +118,7 @@ NextOption = wcschr(CurrentOption, L' '); if (NextOption) *NextOption = L'\0'; - if (wcsicmp(CurrentOption, L"CMDCONS") == 0) + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) { TRACE("Found %S. Switching to console boot\n", CurrentOption); ConsoleBoot = TRUE;