From bc7c6894489cfa77b66ecc7303228a72cee53fee Mon Sep 17 00:00:00 2001 From: Yaroslav Kibysh Date: Mon, 29 Jul 2019 00:17:03 +0300 Subject: [PATCH] [FREELDR] Add ReactOS Setup as a custom boot type. (#1763) CORE-9023 CORE-16260 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hermès Bélusca-Maïto --- boot/freeldr/freeldr/bootmgr.c | 24 +++++++++++++++++++----- boot/freeldr/freeldr/custom.c | 26 +++++++++++++++++++------- boot/freeldr/freeldr/include/custom.h | 5 ++++- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/boot/freeldr/freeldr/bootmgr.c b/boot/freeldr/freeldr/bootmgr.c index d0ce314bb46..8c97eeaaa95 100644 --- a/boot/freeldr/freeldr/bootmgr.c +++ b/boot/freeldr/freeldr/bootmgr.c @@ -31,6 +31,20 @@ VOID (*EDIT_OS_ENTRY_PROC)( IN ULONG_PTR SectionId OPTIONAL); +static VOID +EditCustomBootReactOSSetup( + IN ULONG_PTR SectionId OPTIONAL) +{ + EditCustomBootReactOS(SectionId, TRUE); +} + +static VOID +EditCustomBootNTOS( + IN ULONG_PTR SectionId OPTIONAL) +{ + EditCustomBootReactOS(SectionId, FALSE); +} + static const struct { PCSTR BootType; @@ -38,18 +52,18 @@ static const struct ARC_ENTRY_POINT OsLoader; } OSLoadingMethods[] = { - {"ReactOSSetup", EditCustomBootReactOS, LoadReactOSSetup}, + {"ReactOSSetup", EditCustomBootReactOSSetup, LoadReactOSSetup}, #ifdef _M_IX86 {"Drive" , EditCustomBootDisk , LoadAndBootDrive }, {"Partition" , EditCustomBootPartition , LoadAndBootPartition }, {"BootSector" , EditCustomBootSectorFile, LoadAndBootBootSector}, - {"Linux" , EditCustomBootLinux , LoadAndBootLinux }, - {"WindowsNT40" , EditCustomBootReactOS, LoadAndBootWindows}, + {"Linux" , EditCustomBootLinux, LoadAndBootLinux }, + {"WindowsNT40" , EditCustomBootNTOS , LoadAndBootWindows}, #endif - {"Windows" , EditCustomBootReactOS, LoadAndBootWindows}, - {"Windows2003" , EditCustomBootReactOS, LoadAndBootWindows}, + {"Windows" , EditCustomBootNTOS , LoadAndBootWindows}, + {"Windows2003" , EditCustomBootNTOS , LoadAndBootWindows}, }; /* FUNCTIONS ******************************************************************/ diff --git a/boot/freeldr/freeldr/custom.c b/boot/freeldr/freeldr/custom.c index 319cbcd61a7..dfeba3051e5 100644 --- a/boot/freeldr/freeldr/custom.c +++ b/boot/freeldr/freeldr/custom.c @@ -51,7 +51,8 @@ VOID OptionMenuCustomBoot(VOID) "Boot Sector File", "Linux", #endif - "ReactOS" + "ReactOS", + "ReactOS Setup" }; ULONG SelectedMenuItem; @@ -84,11 +85,19 @@ VOID OptionMenuCustomBoot(VOID) EditCustomBootLinux(0); break; case 4: // ReactOS -#else - case 0: -#endif - EditCustomBootReactOS(0); + EditCustomBootReactOS(0, FALSE); break; + case 5: // ReactOS Setup + EditCustomBootReactOS(0, TRUE); + break; +#else + case 0: // ReactOS + EditCustomBootReactOS(0, FALSE); + break; + case 1: // ReactOS Setup + EditCustomBootReactOS(0, TRUE); + break; +#endif } } @@ -386,7 +395,10 @@ VOID EditCustomBootLinux(IN ULONG_PTR SectionId OPTIONAL) #endif // _M_IX86 -VOID EditCustomBootReactOS(IN ULONG_PTR SectionId OPTIONAL) +VOID +EditCustomBootReactOS( + IN ULONG_PTR SectionId OPTIONAL, + IN BOOLEAN IsSetup) { TIMEINFO* TimeInfo; OperatingSystemItem OperatingSystem; @@ -452,7 +464,7 @@ VOID EditCustomBootReactOS(IN ULONG_PTR SectionId OPTIONAL) return; /* Add the BootType */ - if (!IniAddSettingValueToSection(SectionId, "BootType", "Windows2003")) + if (!IniAddSettingValueToSection(SectionId, "BootType", IsSetup ? "ReactOSSetup" : "Windows2003")) return; /* Construct the ReactOS ARC system path */ diff --git a/boot/freeldr/freeldr/include/custom.h b/boot/freeldr/freeldr/include/custom.h index 0bf8d680f32..b38241f135e 100644 --- a/boot/freeldr/freeldr/include/custom.h +++ b/boot/freeldr/freeldr/include/custom.h @@ -36,7 +36,10 @@ VOID EditCustomBootLinux(IN ULONG_PTR SectionId OPTIONAL); VOID OptionMenuCustomBoot(VOID); #endif -VOID EditCustomBootReactOS(IN ULONG_PTR SectionId OPTIONAL); +VOID +EditCustomBootReactOS( + IN ULONG_PTR SectionId OPTIONAL, + IN BOOLEAN IsSetup); #ifdef HAS_OPTION_MENU_REBOOT VOID OptionMenuReboot(VOID);