[FREELDR] Fix erroneous change from d05be0da regarding RAMDISK loading in SETUPLDR.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 8 Aug 2019 21:06:33 +0000 (23:06 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 8 Aug 2019 21:09:43 +0000 (23:09 +0200)
Restore the correct position of (optional) RAMDISK loading code, before
attempting to open txtsetup.sif since the bootcd ISO might be the RAMDISK.

boot/freeldr/freeldr/ntldr/setupldr.c

index 98b66e8..5342a1b 100644 (file)
@@ -238,6 +238,24 @@ LoadReactOSSetup(
 
     TRACE("BootOptions: '%s'\n", BootOptions2);
 
 
     TRACE("BootOptions: '%s'\n", BootOptions2);
 
+    /* Check if a ramdisk file was given */
+    File = strstr(BootOptions2, "/RDPATH=");
+    if (File)
+    {
+        /* Copy the file name and everything else after it */
+        RtlStringCbCopyA(FileName, sizeof(FileName), File + 8);
+
+        /* Null-terminate */
+        *strstr(FileName, " ") = ANSI_NULL;
+
+        /* Load the ramdisk */
+        if (!RamDiskLoadVirtualFile(FileName))
+        {
+            UiMessageBox("Failed to load RAM disk file %s", FileName);
+            return ENOENT;
+        }
+    }
+
     /* Check if we booted from floppy */
     BootFromFloppy = strstr(BootPath, "fdisk") != NULL;
 
     /* Check if we booted from floppy */
     BootFromFloppy = strstr(BootPath, "fdisk") != NULL;
 
@@ -293,24 +311,6 @@ LoadReactOSSetup(
 
     TRACE("BootOptions: '%s'\n", BootOptions);
 
 
     TRACE("BootOptions: '%s'\n", BootOptions);
 
-    /* Check if a ramdisk file was given */
-    File = strstr(BootOptions2, "/RDPATH=");
-    if (File)
-    {
-        /* Copy the file name and everything else after it */
-        RtlStringCbCopyA(FileName, sizeof(FileName), File + 8);
-
-        /* Null-terminate */
-        *strstr(FileName, " ") = ANSI_NULL;
-
-        /* Load the ramdisk */
-        if (!RamDiskLoadVirtualFile(FileName))
-        {
-            UiMessageBox("Failed to load RAM disk file %s", FileName);
-            return ENOENT;
-        }
-    }
-
     /* Allocate and minimalist-initialize LPB */
     AllocateAndInitLPB(&LoaderBlock);
 
     /* Allocate and minimalist-initialize LPB */
     AllocateAndInitLPB(&LoaderBlock);