-
- if (!RepairUpdateFlag || ShouldRepairRegistry)
- {
- /*
- * We fully setup the hives, in case we are doing a fresh installation
- * (RepairUpdateFlag == FALSE), or in case we are doing an update
- * (RepairUpdateFlag == TRUE) BUT we have some registry hives to
- * "repair" (aka. recreate: ShouldRepairRegistry == TRUE).
- */
-
- Success = SetupFindFirstLineW(SetupInf, L"HiveInfs.Fresh", NULL, &InfContext); // Windows-compatible
- if (!Success)
- Success = SetupFindFirstLineW(SetupInf, L"HiveInfs.Install", NULL, &InfContext); // ReactOS-specific
-
- if (!Success)
- {
- DPRINT1("SetupFindFirstLine() failed\n");
- MUIDisplayError(ERROR_FIND_REGISTRY, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
- }
- else // if (RepairUpdateFlag && !ShouldRepairRegistry)
- {
- /*
- * In case we are doing an update (RepairUpdateFlag == TRUE) and
- * NO registry hives need a repair (ShouldRepairRegistry == FALSE),
- * we only update the hives.
- */
-
- Success = SetupFindFirstLineW(SetupInf, L"HiveInfs.Upgrade", NULL, &InfContext);
- if (!Success)
- {
- /* Nothing to do for update! */
- DPRINT1("No update needed for the registry!\n");
- goto Cleanup;
- }
- }
-
- do
- {
- INF_GetDataField(&InfContext, 0, &Action);
- INF_GetDataField(&InfContext, 1, &File);
- INF_GetDataField(&InfContext, 2, &Section);
-
- DPRINT("Action: %S File: %S Section %S\n", Action, File, Section);
-
- if (Action == NULL)
- {
- INF_FreeData(Action);
- INF_FreeData(File);
- INF_FreeData(Section);
- break; // Hackfix
- }
-
- if (!_wcsicmp(Action, L"AddReg"))
- Delete = FALSE;
- else if (!_wcsicmp(Action, L"DelReg"))
- Delete = TRUE;
- else
- {
- DPRINT1("Unrecognized registry INF action '%S'\n", Action);
- INF_FreeData(Action);
- INF_FreeData(File);
- INF_FreeData(Section);
- continue;
- }
-
- INF_FreeData(Action);
-
- CONSOLE_SetStatusText(MUIGetString(STRING_IMPORTFILE), File);
-
- if (!ImportRegistryFile(USetupData.SourcePath.Buffer, File, Section, USetupData.LanguageId, Delete))
- {
- DPRINT1("Importing %S failed\n", File);
- INF_FreeData(File);
- INF_FreeData(Section);
- MUIDisplayError(ERROR_IMPORT_HIVE, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
- } while (SetupFindNextLine(&InfContext, &InfContext));
-
- if (!RepairUpdateFlag || ShouldRepairRegistry)
- {
- /* See the explanation for this test above */
-
- /* Update display registry settings */
- CONSOLE_SetStatusText(MUIGetString(STRING_DISPLAYSETTINGSUPDATE));
- if (!ProcessDisplayRegistry(SetupInf, DisplayList))
- {
- MUIDisplayError(ERROR_UPDATE_DISPLAY_SETTINGS, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
-
- /* Set the locale */
- CONSOLE_SetStatusText(MUIGetString(STRING_LOCALESETTINGSUPDATE));
- if (!ProcessLocaleRegistry(LanguageList))
- {
- MUIDisplayError(ERROR_UPDATE_LOCALESETTINGS, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
-
- /* Add keyboard layouts */
- CONSOLE_SetStatusText(MUIGetString(STRING_ADDKBLAYOUTS));
- if (!AddKeyboardLayouts(SelectedLanguageId))
- {
- MUIDisplayError(ERROR_ADDING_KBLAYOUTS, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
-
- /* Set GeoID */
- if (!SetGeoID(MUIGetGeoID(SelectedLanguageId)))
- {
- MUIDisplayError(ERROR_UPDATE_GEOID, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
-
- if (!IsUnattendedSetup)
- {
- /* Update keyboard layout settings */
- CONSOLE_SetStatusText(MUIGetString(STRING_KEYBOARDSETTINGSUPDATE));
- if (!ProcessKeyboardLayoutRegistry(LayoutList, SelectedLanguageId))
- {
- MUIDisplayError(ERROR_UPDATE_KBSETTINGS, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
- }
-
- /* Add codepage information to registry */
- CONSOLE_SetStatusText(MUIGetString(STRING_CODEPAGEINFOUPDATE));
- if (!AddCodePage(SelectedLanguageId))
- {
- MUIDisplayError(ERROR_ADDING_CODEPAGE, Ir, POPUP_WAIT_ENTER);
- goto Cleanup;
- }
-
- /* Set the default pagefile entry */
- SetDefaultPagefile(DestinationDriveLetter);
-
- /* Update the mounted devices list */
- // FIXME: This should technically be done by mountmgr (if AutoMount is enabled)!
- SetMountedDeviceValues(PartitionList);
- }
-
-Cleanup:
- //
- // TODO: Unload all the registry stuff, perform cleanup,
- // and copy the created hive files into .sav files.
- //
- RegCleanupRegistry(&USetupData.DestinationPath);
-
- /*
- * Check whether we were in update/repair mode but we were actually
- * repairing the registry hives. If so, we have finished repairing them,
- * and we now reset the flag and run the proper registry update.
- * Otherwise we have finished the registry update!
- */
- if (RepairUpdateFlag && ShouldRepairRegistry)
- {
- ShouldRepairRegistry = FALSE;
- goto DoUpdate;
- }
-
- if (NT_SUCCESS(Status))