https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6c2d3dee041072ea7b78eb...
commit 6c2d3dee041072ea7b78ebb55cc6683d9b132537 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Sun Sep 3 16:17:27 2017 +0000 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Oct 28 14:42:00 2018 +0100
[SETUPLIB][USETUP] Move the registry-update procedure into setuplib.
- It can therefore be also used by the 1st-stage GUI setup. - Rename some function parameters to clarify what they should be.
Based on: svn path=/branches/setup_improvements/; revision=75750 --- base/setup/lib/registry.c | 16 +-- base/setup/lib/registry.h | 6 +- base/setup/lib/setuplib.c | 236 +++++++++++++++++++++++++++++++++++++ base/setup/lib/setuplib.h | 28 +++++ base/setup/lib/utils/regutil.c | 14 +-- base/setup/lib/utils/regutil.h | 6 +- base/setup/usetup/usetup.c | 260 ++++++++--------------------------------- 7 files changed, 331 insertions(+), 235 deletions(-)
diff --git a/base/setup/lib/registry.c b/base/setup/lib/registry.c index 54655f5108..69f47c3fdb 100644 --- a/base/setup/lib/registry.c +++ b/base/setup/lib/registry.c @@ -611,7 +611,7 @@ C_ASSERT(_countof(SecurityRegistryHives) == NUMBER_OF_SECURITY_REGISTRY_HIVES);
NTSTATUS VerifyRegistryHives( - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, OUT PBOOLEAN ShouldRepairRegistry) { NTSTATUS Status; @@ -642,7 +642,7 @@ VerifyRegistryHives(
for (i = 0; i < ARRAYSIZE(RegistryHives); ++i) { - Status = VerifyRegistryHive(InstallPath, RegistryHives[i].HiveName); + Status = VerifyRegistryHive(NtSystemRoot, RegistryHives[i].HiveName); if (!NT_SUCCESS(Status)) { DPRINT1("Registry hive '%S' needs repair!\n", RegistryHives[i].HiveName); @@ -658,7 +658,7 @@ VerifyRegistryHives( /** These hives are created by LSASS during 2nd stage setup */ for (i = 0; i < ARRAYSIZE(SecurityRegistryHives); ++i) { - Status = VerifyRegistryHive(InstallPath, SecurityRegistryHives[i].HiveName); + Status = VerifyRegistryHive(NtSystemRoot, SecurityRegistryHives[i].HiveName); if (!NT_SUCCESS(Status)) { DPRINT1("Registry hive '%S' needs repair!\n", SecurityRegistryHives[i].HiveName); @@ -687,7 +687,7 @@ VerifyRegistryHives(
NTSTATUS RegInitializeRegistry( - IN PUNICODE_STRING InstallPath) + IN PUNICODE_STRING NtSystemRoot) { NTSTATUS Status; HANDLE KeyHandle; @@ -750,7 +750,7 @@ RegInitializeRegistry( if (RegistryHives[i].State != Create && RegistryHives[i].State != Repair) continue;
- Status = CreateRegistryFile(InstallPath, + Status = CreateRegistryFile(NtSystemRoot, RegistryHives[i].HiveName, RegistryHives[i].State != Repair, // RegistryHives[i].State == Create, KeyHandle); @@ -833,7 +833,7 @@ RegInitializeRegistry( { Status = ConnectRegistry(NULL, RegistryHives[i].HiveRegistryPath, - InstallPath, + NtSystemRoot, RegistryHives[i].HiveName /* SystemSecurity, sizeof(SystemSecurity) */); if (!NT_SUCCESS(Status)) @@ -995,7 +995,7 @@ Quit:
VOID RegCleanupRegistry( - IN PUNICODE_STRING InstallPath) + IN PUNICODE_STRING NtSystemRoot) { NTSTATUS Status; HANDLE KeyHandle; @@ -1094,7 +1094,7 @@ RegCleanupRegistry( continue;
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 3, - InstallPath->Buffer, L"System32\config", RegistryHives[i].HiveName); + NtSystemRoot->Buffer, L"System32\config", RegistryHives[i].HiveName); RtlStringCchCopyW(DstPath, ARRAYSIZE(DstPath), SrcPath); RtlStringCchCatW(DstPath, ARRAYSIZE(DstPath), L".sav");
diff --git a/base/setup/lib/registry.h b/base/setup/lib/registry.h index 7bc8d8f7a0..cab0be3c8b 100644 --- a/base/setup/lib/registry.h +++ b/base/setup/lib/registry.h @@ -47,15 +47,15 @@ ImportRegistryFile(
NTSTATUS VerifyRegistryHives( - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, OUT PBOOLEAN ShouldRepairRegistry);
NTSTATUS RegInitializeRegistry( - IN PUNICODE_STRING InstallPath); + IN PUNICODE_STRING NtSystemRoot);
VOID RegCleanupRegistry( - IN PUNICODE_STRING InstallPath); + IN PUNICODE_STRING NtSystemRoot);
/* EOF */ diff --git a/base/setup/lib/setuplib.c b/base/setup/lib/setuplib.c index aba1533ceb..5bd9fa4f03 100644 --- a/base/setup/lib/setuplib.c +++ b/base/setup/lib/setuplib.c @@ -574,4 +574,240 @@ LoadSetupInf( return ERROR_SUCCESS; }
+/* + * SIDEEFFECTS + * Calls RegInitializeRegistry + * Calls ImportRegistryFile + * Calls SetDefaultPagefile + * Calls SetMountedDeviceValues + */ +ERROR_NUMBER +UpdateRegistry( + IN HINF SetupInf, + IN OUT PUSETUP_DATA pSetupData, + /**/IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */ + /**/IN PPARTLIST PartitionList, /* HACK HACK! */ + /**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */ + /**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */ + IN PGENERIC_LIST DisplayList, + IN PGENERIC_LIST LayoutList, + IN PGENERIC_LIST LanguageList, + IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL) +{ + ERROR_NUMBER ErrorNumber; + NTSTATUS Status; + INFCONTEXT InfContext; + PWSTR Action; + PWSTR File; + PWSTR Section; + BOOLEAN Success; + BOOLEAN ShouldRepairRegistry = FALSE; + BOOLEAN Delete; + + if (RepairUpdateFlag) + { + DPRINT1("TODO: Updating / repairing the registry is not completely implemented yet!\n"); + + /* Verify the registry hives and check whether we need to update or repair any of them */ + Status = VerifyRegistryHives(&pSetupData->DestinationPath, &ShouldRepairRegistry); + if (!NT_SUCCESS(Status)) + { + DPRINT1("VerifyRegistryHives failed, Status 0x%08lx\n", Status); + ShouldRepairRegistry = FALSE; + } + if (!ShouldRepairRegistry) + DPRINT1("No need to repair the registry\n"); + } + +DoUpdate: + ErrorNumber = ERROR_SUCCESS; + + /* Update the registry */ + if (StatusRoutine) StatusRoutine(RegHiveUpdate); + + /* Initialize the registry and setup the registry hives */ + Status = RegInitializeRegistry(&pSetupData->DestinationPath); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RegInitializeRegistry() failed\n"); + /********** HACK!!!!!!!!!!! **********/ + if (Status == STATUS_NOT_IMPLEMENTED) + { + /* The hack was called, return its corresponding error */ + return ERROR_INITIALIZE_REGISTRY; + } + else + /*************************************/ + { + /* Something else failed */ + return ERROR_CREATE_HIVE; + } + } + + 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"); + ErrorNumber = ERROR_FIND_REGISTRY; + 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); + + if (StatusRoutine) StatusRoutine(ImportRegHive, File); + + if (!ImportRegistryFile(pSetupData->SourcePath.Buffer, + File, Section, + pSetupData->LanguageId, Delete)) + { + DPRINT1("Importing %S failed\n", File); + INF_FreeData(File); + INF_FreeData(Section); + ErrorNumber = ERROR_IMPORT_HIVE; + goto Cleanup; + } + } while (SetupFindNextLine(&InfContext, &InfContext)); + + if (!RepairUpdateFlag || ShouldRepairRegistry) + { + /* See the explanation for this test above */ + + /* Update display registry settings */ + if (StatusRoutine) StatusRoutine(DisplaySettingsUpdate); + if (!ProcessDisplayRegistry(SetupInf, DisplayList)) + { + ErrorNumber = ERROR_UPDATE_DISPLAY_SETTINGS; + goto Cleanup; + } + + /* Set the locale */ + if (StatusRoutine) StatusRoutine(LocaleSettingsUpdate); + if (!ProcessLocaleRegistry(LanguageList)) + { + ErrorNumber = ERROR_UPDATE_LOCALESETTINGS; + goto Cleanup; + } + + /* Add keyboard layouts */ + if (StatusRoutine) StatusRoutine(KeybLayouts); + if (!AddKeyboardLayouts(SelectedLanguageId)) + { + ErrorNumber = ERROR_ADDING_KBLAYOUTS; + goto Cleanup; + } + + /* Set GeoID */ + if (!SetGeoID(MUIGetGeoID(SelectedLanguageId))) + { + ErrorNumber = ERROR_UPDATE_GEOID; + goto Cleanup; + } + + if (!IsUnattendedSetup) + { + /* Update keyboard layout settings */ + if (StatusRoutine) StatusRoutine(KeybSettingsUpdate); + if (!ProcessKeyboardLayoutRegistry(LayoutList, SelectedLanguageId)) + { + ErrorNumber = ERROR_UPDATE_KBSETTINGS; + goto Cleanup; + } + } + + /* Add codepage information to registry */ + if (StatusRoutine) StatusRoutine(CodePageInfoUpdate); + if (!AddCodePage(SelectedLanguageId)) + { + ErrorNumber = ERROR_ADDING_CODEPAGE; + 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(&pSetupData->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; + } + + return ErrorNumber; +} + /* EOF */ diff --git a/base/setup/lib/setuplib.h b/base/setup/lib/setuplib.h index 2e231bdd0e..46c42f72a7 100644 --- a/base/setup/lib/setuplib.h +++ b/base/setup/lib/setuplib.h @@ -123,4 +123,32 @@ LoadSetupInf( IN OUT PUSETUP_DATA pSetupData);
+typedef enum _REGISTRY_STATUS +{ + Success = 0, + RegHiveUpdate, + ImportRegHive, + DisplaySettingsUpdate, + LocaleSettingsUpdate, + KeybLayouts, + KeybSettingsUpdate, + CodePageInfoUpdate, +} REGISTRY_STATUS; + +typedef VOID +(__cdecl *PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS, ...); + +ERROR_NUMBER +UpdateRegistry( + IN HINF SetupInf, + IN OUT PUSETUP_DATA pSetupData, + /**/IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */ + /**/IN PPARTLIST PartitionList, /* HACK HACK! */ + /**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */ + /**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */ + IN PGENERIC_LIST DisplayList, + IN PGENERIC_LIST LayoutList, + IN PGENERIC_LIST LanguageList, + IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL); + /* EOF */ diff --git a/base/setup/lib/utils/regutil.c b/base/setup/lib/utils/regutil.c index 54bc7c260d..f70d9545e2 100644 --- a/base/setup/lib/utils/regutil.c +++ b/base/setup/lib/utils/regutil.c @@ -133,7 +133,7 @@ CreateNestedKey(PHANDLE KeyHandle, */ NTSTATUS CreateRegistryFile( - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey, IN BOOLEAN IsHiveNew, IN HANDLE ProtoKeyHandle @@ -156,7 +156,7 @@ CreateRegistryFile( WCHAR PathBuffer2[MAX_PATH];
CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 3, - InstallPath->Buffer, L"System32\config", RegistryKey); + NtSystemRoot->Buffer, L"System32\config", RegistryKey);
Extension = Extensions[IsHiveNew ? 0 : 1];
@@ -212,7 +212,7 @@ CreateRegistryFile( InitializeObjectAttributes(&ObjectAttributes, &FileName, OBJ_CASE_INSENSITIVE, - NULL, // Could have been InstallPath, etc... + NULL, // Could have been NtSystemRoot, etc... NULL); // Descriptor
Status = NtCreateFile(&FileHandle, @@ -320,7 +320,7 @@ ConnectRegistry( IN HKEY RootKey OPTIONAL, IN PCWSTR RegMountPoint, // IN HANDLE RootDirectory OPTIONAL, - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey /* IN PUCHAR Descriptor, @@ -341,7 +341,7 @@ ConnectRegistry( NULL); // Descriptor
CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 3, - InstallPath->Buffer, L"System32\config", RegistryKey); + NtSystemRoot->Buffer, L"System32\config", RegistryKey); RtlInitUnicodeString(&FileName, PathBuffer); InitializeObjectAttributes(&FileObjectAttributes, &FileName, @@ -383,7 +383,7 @@ NTSTATUS VerifyRegistryHive( // IN HKEY RootKey OPTIONAL, // // IN HANDLE RootDirectory OPTIONAL, - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey /* , IN PCWSTR RegMountPoint */) { @@ -392,7 +392,7 @@ VerifyRegistryHive( /* Try to mount the specified registry hive */ Status = ConnectRegistry(NULL, L"\Registry\Machine\USetup_VerifyHive", - InstallPath, + NtSystemRoot, RegistryKey /* NULL, 0 */); if (!NT_SUCCESS(Status)) diff --git a/base/setup/lib/utils/regutil.h b/base/setup/lib/utils/regutil.h index 2b2d6a12e1..401638717e 100644 --- a/base/setup/lib/utils/regutil.h +++ b/base/setup/lib/utils/regutil.h @@ -25,7 +25,7 @@ CreateNestedKey(PHANDLE KeyHandle, */ NTSTATUS CreateRegistryFile( - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey, IN BOOLEAN IsHiveNew, IN HANDLE ProtoKeyHandle @@ -49,7 +49,7 @@ ConnectRegistry( IN HKEY RootKey OPTIONAL, IN PCWSTR RegMountPoint, // IN HANDLE RootDirectory OPTIONAL, - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey /* IN PUCHAR Descriptor, @@ -73,7 +73,7 @@ NTSTATUS VerifyRegistryHive( // IN HKEY RootKey OPTIONAL, // // IN HANDLE RootDirectory OPTIONAL, - IN PUNICODE_STRING InstallPath, + IN PUNICODE_STRING NtSystemRoot, IN PCWSTR RegistryKey /* , IN PCWSTR RegMountPoint */);
diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c index 51ad13e782..f78f6525aa 100644 --- a/base/setup/usetup/usetup.c +++ b/base/setup/usetup/usetup.c @@ -4097,6 +4097,37 @@ FileCopyPage(PINPUT_RECORD Ir) }
+static VOID +__cdecl +RegistryStatus(IN REGISTRY_STATUS RegStatus, ...) +{ + /* WARNING: Please keep this lookup table in sync with the resources! */ + static const UINT StringIDs[] = + { + STRING_DONE, /* Success */ + STRING_REGHIVEUPDATE, /* RegHiveUpdate */ + STRING_IMPORTFILE, /* ImportRegHive */ + STRING_DISPLAYSETTINGSUPDATE, /* DisplaySettingsUpdate */ + STRING_LOCALESETTINGSUPDATE, /* LocaleSettingsUpdate */ + STRING_ADDKBLAYOUTS, /* KeybLayouts */ + STRING_KEYBOARDSETTINGSUPDATE, /* KeybSettingsUpdate */ + STRING_CODEPAGEINFOUPDATE, /* CodePageInfoUpdate */ + }; + + va_list args; + + if (RegStatus < ARRAYSIZE(StringIDs)) + { + va_start(args, RegStatus); + CONSOLE_SetStatusTextV(MUIGetString(StringIDs[RegStatus]), args); + va_end(args); + } + else + { + CONSOLE_SetStatusText("Unknown status %d", RegStatus); + } +} + /* * Displays the RegistryPage. * @@ -4106,10 +4137,7 @@ FileCopyPage(PINPUT_RECORD Ir) * QuitPage * * SIDEEFFECTS - * Calls RegInitializeRegistry - * Calls ImportRegistryFile - * Calls SetDefaultPagefile - * Calls SetMountedDeviceValues + * Calls UpdateRegistry * * RETURNS * Number of the next page. @@ -4117,226 +4145,30 @@ FileCopyPage(PINPUT_RECORD Ir) static PAGE_NUMBER RegistryPage(PINPUT_RECORD Ir) { - NTSTATUS Status; - INFCONTEXT InfContext; - PWSTR Action; - PWSTR File; - PWSTR Section; - BOOLEAN Success; - BOOLEAN ShouldRepairRegistry = FALSE; - BOOLEAN Delete; + ULONG Error;
MUIDisplayPage(REGISTRY_PAGE);
- if (RepairUpdateFlag) - { - DPRINT1("TODO: Updating / repairing the registry is not completely implemented yet!\n"); - - /* Verify the registry hives and check whether we need to update or repair any of them */ - Status = VerifyRegistryHives(&USetupData.DestinationPath, &ShouldRepairRegistry); - if (!NT_SUCCESS(Status)) - { - DPRINT1("VerifyRegistryHives failed, Status 0x%08lx\n", Status); - ShouldRepairRegistry = FALSE; - } - if (!ShouldRepairRegistry) - DPRINT1("No need to repair the registry\n"); - } - -DoUpdate: - /* Update the registry */ - CONSOLE_SetStatusText(MUIGetString(STRING_REGHIVEUPDATE)); - - /* Initialize the registry and setup the registry hives */ - Status = RegInitializeRegistry(&USetupData.DestinationPath); - if (!NT_SUCCESS(Status)) + Error = UpdateRegistry(SetupInf, + &USetupData, + RepairUpdateFlag, + PartitionList, + DestinationDriveLetter, + SelectedLanguageId, + DisplayList, + LayoutList, + LanguageList, + RegistryStatus); + if (Error != ERROR_SUCCESS) { - DPRINT1("RegInitializeRegistry() failed\n"); - /********** HACK!!!!!!!!!!! **********/ - if (Status == STATUS_NOT_IMPLEMENTED) - { - /* The hack was called, display its corresponding error */ - MUIDisplayError(ERROR_INITIALIZE_REGISTRY, Ir, POPUP_WAIT_ENTER); - } - else - /*************************************/ - { - /* Something else failed */ - MUIDisplayError(ERROR_CREATE_HIVE, Ir, POPUP_WAIT_ENTER); - } + MUIDisplayError(Error, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } - - 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)) + else { CONSOLE_SetStatusText(MUIGetString(STRING_DONE)); return BOOT_LOADER_PAGE; } - else - { - return QUIT_PAGE; - } }