[FREELDR] Add ReactOS Setup as a custom boot type. (#1763) 1763/head
authorYaroslav Kibysh <yanet.prod@gmail.com>
Sun, 28 Jul 2019 21:17:03 +0000 (00:17 +0300)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Wed, 7 Aug 2019 16:50:26 +0000 (18:50 +0200)
CORE-9023 CORE-16260

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
boot/freeldr/freeldr/bootmgr.c
boot/freeldr/freeldr/custom.c
boot/freeldr/freeldr/include/custom.h

index d0ce314..8c97eea 100644 (file)
@@ -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 ******************************************************************/
index 319cbcd..dfeba30 100644 (file)
@@ -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 */
index 0bf8d68..b38241f 100644 (file)
@@ -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);