From c9c5fd1a1824a7d4661212b6d0ca72d72e2bf38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 2 Nov 2023 15:22:02 +0100 Subject: [PATCH] [SETUPLIB][BOOTDATA] Rename "MBRInstallType" to "BootLoaderLocation" Less hardcoded references to "MBR" for code that should be generic is always better. --- base/setup/lib/setuplib.c | 8 ++++---- base/setup/lib/setuplib.h | 2 +- base/setup/usetup/usetup.c | 26 ++++++++++++------------ boot/bootdata/bootcd/unattend.inf | 9 ++++---- boot/bootdata/bootcdregtest/unattend.inf | 9 ++++---- 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/base/setup/lib/setuplib.c b/base/setup/lib/setuplib.c index e7c46c433ed..94f43cac05f 100644 --- a/base/setup/lib/setuplib.c +++ b/base/setup/lib/setuplib.c @@ -154,13 +154,13 @@ CheckUnattendedSetup( IsUnattendedSetup = TRUE; DPRINT("Running unattended setup\n"); - /* Search for 'MBRInstallType' in the 'Unattend' section */ - pSetupData->MBRInstallType = -1; - if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"MBRInstallType", &Context)) + /* Search for 'BootLoaderLocation' in the 'Unattend' section */ + pSetupData->BootLoaderLocation = 2; // Default to "system partition" + if (SpInfFindFirstLine(UnattendInf, L"Unattend", L"BootLoaderLocation", &Context)) { if (SpInfGetIntField(&Context, 1, &IntValue)) { - pSetupData->MBRInstallType = IntValue; + pSetupData->BootLoaderLocation = IntValue; } } diff --git a/base/setup/lib/setuplib.h b/base/setup/lib/setuplib.h index 4272138cac6..79a1692eea6 100644 --- a/base/setup/lib/setuplib.h +++ b/base/setup/lib/setuplib.h @@ -110,7 +110,7 @@ typedef struct _USETUP_DATA LONG DestinationDiskNumber; LONG DestinationPartitionNumber; - LONG MBRInstallType; + LONG BootLoaderLocation; LONG FormatPartition; LONG AutoPartition; LONG FsType; diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c index e6025854e8e..fb6de2eb614 100644 --- a/base/setup/usetup/usetup.c +++ b/base/setup/usetup/usetup.c @@ -3470,15 +3470,15 @@ BootLoaderSelectPage(PINPUT_RECORD Ir) */ if (RepairUpdateFlag) { - USetupData.MBRInstallType = 0; + USetupData.BootLoaderLocation = 0; goto Quit; } /* For unattended setup, skip MBR installation or install on removable disk if needed */ if (IsUnattendedSetup) { - if ((USetupData.MBRInstallType == 0) || - (USetupData.MBRInstallType == 1)) + if ((USetupData.BootLoaderLocation == 0) || + (USetupData.BootLoaderLocation == 1)) { goto Quit; } @@ -3493,7 +3493,7 @@ BootLoaderSelectPage(PINPUT_RECORD Ir) if ((SystemPartition->DiskEntry->DiskStyle != PARTITION_STYLE_MBR) || !IsRecognizedPartition(SystemPartition->PartitionType)) { - USetupData.MBRInstallType = 1; + USetupData.BootLoaderLocation = 1; goto Quit; } #endif @@ -3501,8 +3501,8 @@ BootLoaderSelectPage(PINPUT_RECORD Ir) /* Is it an unattended install on hdd? */ if (IsUnattendedSetup) { - if ((USetupData.MBRInstallType == 2) || - (USetupData.MBRInstallType == 3)) + if ((USetupData.BootLoaderLocation == 2) || + (USetupData.BootLoaderLocation == 3)) { goto Quit; } @@ -3574,25 +3574,25 @@ BootLoaderSelectPage(PINPUT_RECORD Ir) if (Line == 12) { /* Install on both MBR and VBR */ - USetupData.MBRInstallType = 2; + USetupData.BootLoaderLocation = 2; break; } else if (Line == 13) { /* Install on VBR only */ - USetupData.MBRInstallType = 3; + USetupData.BootLoaderLocation = 3; break; } else if (Line == 14) { /* Install on removable disk */ - USetupData.MBRInstallType = 1; + USetupData.BootLoaderLocation = 1; break; } else if (Line == 15) { /* Skip installation */ - USetupData.MBRInstallType = 0; + USetupData.BootLoaderLocation = 0; break; } @@ -3661,7 +3661,7 @@ BootLoaderHardDiskPage(PINPUT_RECORD Ir) NTSTATUS Status; WCHAR DestinationDevicePathBuffer[MAX_PATH]; - if (USetupData.MBRInstallType == 2) + if (USetupData.BootLoaderLocation == 2) { /* Step 1: Write the VBR */ Status = InstallVBRToPartition(&USetupData.SystemRootPath, @@ -3737,10 +3737,10 @@ BootLoaderInstallPage(PINPUT_RECORD Ir) RtlCreateUnicodeString(&USetupData.SystemRootPath, PathBuffer); DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath); - if (USetupData.MBRInstallType != 0) + if (USetupData.BootLoaderLocation != 0) MUIDisplayPage(BOOTLOADER_INSTALL_PAGE); - switch (USetupData.MBRInstallType) + switch (USetupData.BootLoaderLocation) { /* Skip installation */ case 0: diff --git a/boot/bootdata/bootcd/unattend.inf b/boot/bootdata/bootcd/unattend.inf index dcf98b732f4..ec41adcc97b 100644 --- a/boot/bootdata/bootcd/unattend.inf +++ b/boot/bootdata/bootcd/unattend.inf @@ -11,10 +11,11 @@ DestinationDiskNumber = 0 DestinationPartitionNumber = 1 InstallationDirectory=ReactOS -; MBRInstallType=0 skips MBR installation -; MBRInstallType=1 install MBR on floppy -; MBRInstallType=2 install MBR on hdd -MBRInstallType=2 +; BootLoaderLocation=0 Skip installation +; BootLoaderLocation=1 Install on removable media (floppy) +; BootLoaderLocation=2 Install on system partition (for MBR disks: MBR and VBR) +; BootLoaderLocation=3 Install on VBR only (for MBR disks) +BootLoaderLocation=2 FullName="MyName" ;OrgName="MyOrg" diff --git a/boot/bootdata/bootcdregtest/unattend.inf b/boot/bootdata/bootcdregtest/unattend.inf index c96371bbed5..6617f40b3a4 100644 --- a/boot/bootdata/bootcdregtest/unattend.inf +++ b/boot/bootdata/bootcdregtest/unattend.inf @@ -11,10 +11,11 @@ DestinationDiskNumber = 0 DestinationPartitionNumber = 1 InstallationDirectory=ReactOS -; MBRInstallType=0 skips MBR installation -; MBRInstallType=1 install MBR on floppy -; MBRInstallType=2 install MBR on hdd -MBRInstallType=2 +; BootLoaderLocation=0 Skip installation +; BootLoaderLocation=1 Install on removable media (floppy) +; BootLoaderLocation=2 Install on system partition (for MBR disks: MBR and VBR) +; BootLoaderLocation=3 Install on VBR only (for MBR disks) +BootLoaderLocation=2 FullName="MyName" ;OrgName="MyOrg"