File tree Expand file tree Collapse file tree 1 file changed +41
-5
lines changed
Expand file tree Collapse file tree 1 file changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -204,13 +204,49 @@ GetSuppressNewUIValue(VOID)
204204BOOL
205205RunningOnLiveMedium (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
216252VOID WINAPI
You can’t perform that action at this time.
0 commit comments