Skip to content

Commit 8fabb29

Browse files
committed
[UMPNPMGR] Fix the LiveCD check
1 parent d992cf0 commit 8fabb29

File tree

1 file changed

+41
-5
lines changed

1 file changed

+41
-5
lines changed

base/services/umpnpmgr/umpnpmgr.c

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,49 @@ GetSuppressNewUIValue(VOID)
204204
BOOL
205205
RunningOnLiveMedium(VOID)
206206
{
207-
WCHAR LogPath[MAX_PATH];
207+
WCHAR CommandLine[MAX_PATH];
208+
HKEY hSetupKey;
209+
DWORD dwType;
210+
DWORD dwSize;
211+
DWORD dwError;
212+
BOOL LiveMedium = FALSE;
208213

209-
GetSystemWindowsDirectoryW(LogPath, ARRAYSIZE(LogPath));
210-
if (GetDriveTypeW(LogPath) == DRIVE_FIXED)
211-
return FALSE;
214+
DPRINT("RunningOnLiveMedium()\n");
212215

213-
return TRUE;
216+
/* Open the Setup key */
217+
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
218+
L"SYSTEM\\Setup",
219+
0,
220+
KEY_QUERY_VALUE,
221+
&hSetupKey);
222+
if (dwError != ERROR_SUCCESS)
223+
goto done;
224+
225+
/* Read the CmdLine value */
226+
dwSize = sizeof(CommandLine);
227+
dwError = RegQueryValueExW(hSetupKey,
228+
L"CmdLine",
229+
NULL,
230+
&dwType,
231+
(LPBYTE)CommandLine,
232+
&dwSize);
233+
if (dwError != ERROR_SUCCESS ||
234+
(dwType != REG_SZ &&
235+
dwType != REG_EXPAND_SZ &&
236+
dwType != REG_MULTI_SZ))
237+
goto done;
238+
239+
/* Check for the '-mini' option */
240+
if (wcsstr(CommandLine, L" -mini") != NULL)
241+
{
242+
DPRINT("Running on LiveMedium\n");
243+
LiveMedium = TRUE;
244+
}
245+
246+
done:
247+
RegCloseKey(hSetupKey);
248+
249+
return LiveMedium;
214250
}
215251

216252
VOID WINAPI

0 commit comments

Comments
 (0)