[freeldr] Rework the ramdisk driver to let it be a full device, instead of a deprecat...
[reactos.git] / reactos / boot / freeldr / freeldr / reactos / reactos.c
index f7b0227..7db4d0e 100644 (file)
@@ -67,7 +67,7 @@ FrLdrLoadDriver(PCHAR szFileName,
     FilePointer = FsOpenFile(szFileName);
 
     /* Try under the system root in the main dir and drivers */
-    if (FilePointer == NULL)
+    if (!FilePointer)
     {
     strcpy(value, SystemRoot);
     if(value[strlen(value)-1] != '\\')
@@ -76,7 +76,7 @@ FrLdrLoadDriver(PCHAR szFileName,
     FilePointer = FsOpenFile(value);
     }
 
-    if (FilePointer == NULL)
+    if (!FilePointer)
     {
     strcpy(value, SystemRoot);
     if(value[strlen(value)-1] != '\\')
@@ -86,7 +86,7 @@ FrLdrLoadDriver(PCHAR szFileName,
     FilePointer = FsOpenFile(value);
     }
 
-    if (FilePointer == NULL)
+    if (!FilePointer)
     {
     strcpy(value, SystemRoot);
     if(value[strlen(value)-1] != '\\')
@@ -97,7 +97,7 @@ FrLdrLoadDriver(PCHAR szFileName,
     }
 
     /* Make sure we did */
-    if (FilePointer == NULL) {
+    if (!FilePointer) {
 
         /* Fail if file wasn't opened */
         strcpy(value, szFileName);
@@ -201,7 +201,7 @@ FrLdrLoadNlsFile(PCSTR szFileName,
     FilePointer = FsOpenFile(szFileName);
 
     /* Make sure we did */
-    if (FilePointer == NULL) {
+    if (!FilePointer) {
 
         /* Fail if file wasn't opened */
         strcpy(value, szFileName);
@@ -746,23 +746,11 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
 
     UiDrawStatusText("Loading...");
 
-    //
-    // If we have a ramdisk, this will switch to the ramdisk disk routines
-    // which read from memory instead of using the firmware. This has to be done
-    // after hardware detection, since hardware detection will require using the
-    // real routines in order to perform disk-detection (just because we're on a
-    // ram-boot doesn't mean the user doesn't have actual disks installed too!)
-    //
-    RamDiskSwitchFromBios();
-
-    /*
-     * Try to open system drive
-     */
-    if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice))
-    {
-        UiMessageBox("Failed to open system drive.");
-        return;
-    }
+    /* Get boot path */
+    if (strchr(SystemPath, '\\') != NULL)
+        strcpy(szBootPath, strchr(SystemPath, '\\'));
+    else
+        szBootPath[0] = '\0';
 
     /* append a backslash */
     if ((strlen(szBootPath)==0) ||
@@ -847,7 +835,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
        DPRINTM(DPRINT_REACTOS, "SystemHive: '%s'", szFileName);
 
     FilePointer = FsOpenFile(szFileName);
-    if (FilePointer == NULL)
+    if (!FilePointer)
     {
         UiMessageBox("Could not find the System hive!");
         return;
@@ -871,7 +859,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
                UiMessageBox("Could not load the System hive!\n");
                return;
        }
-       DPRINTM(DPRINT_REACTOS, "SystemHive loaded at 0x%x size %u", (unsigned)Base, (unsigned)Size);
+       DPRINTM(DPRINT_REACTOS, "SystemHive loaded at 0x%x size %u\n", (unsigned)Base, (unsigned)Size);
 
     /*
      * Import the loaded system hive