https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bc7c6894489cfa77b66ecc7303228a72cee53fee

commit bc7c6894489cfa77b66ecc7303228a72cee53fee
Author:     Yaroslav Kibysh <[email protected]>
AuthorDate: Mon Jul 29 00:17:03 2019 +0300
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Wed Aug 7 18:50:26 2019 +0200

    [FREELDR] Add ReactOS Setup as a custom boot type. (#1763)
    CORE-9023 CORE-16260
    
    Co-authored-by: Hermès Bélusca-Maïto <[email protected]>
---
 boot/freeldr/freeldr/bootmgr.c        | 24 +++++++++++++++++++-----
 boot/freeldr/freeldr/custom.c         | 24 ++++++++++++++++++------
 boot/freeldr/freeldr/include/custom.h |  5 ++++-
 3 files changed, 41 insertions(+), 12 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
+            EditCustomBootReactOS(0, FALSE);
+            break;
+        case 5: // ReactOS Setup
+            EditCustomBootReactOS(0, TRUE);
+            break;
 #else
-        case 0:
-#endif
-            EditCustomBootReactOS(0);
+        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);

Reply via email to