[ros-diffs] [hpoussin] 43227: Reapply r43141: Remove now unneeded ARC cdrom hack in NTLDR boot-style. We're now able to boot from a LiveCD, even if ReactOS directory is not "reactos" Keep the existing hack for FreeLdr boot-style, which should be removed one day

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Tue Sep 29 22:01:21 CEST 2009


Author: hpoussin
Date: Tue Sep 29 22:01:20 2009
New Revision: 43227

URL: http://svn.reactos.org/svn/reactos?rev=43227&view=rev
Log:
Reapply r43141: Remove now unneeded ARC cdrom hack in NTLDR boot-style. We're now able to boot from a LiveCD, even if ReactOS directory is not "reactos"
Keep the existing hack for FreeLdr boot-style, which should be removed one day

Modified:
    trunk/reactos/ntoskrnl/io/iomgr/arcname.c

Modified: trunk/reactos/ntoskrnl/io/iomgr/arcname.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/arcname.c?rev=43227&r1=43226&r2=43227&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] Tue Sep 29 22:01:20 2009
@@ -17,6 +17,7 @@
 
 UNICODE_STRING IoArcHalDeviceName, IoArcBootDeviceName;
 PCHAR IoLoaderArcBootDeviceName;
+extern PROS_LOADER_PARAMETER_BLOCK KeRosLoaderBlock;
 
 /* FUNCTIONS *****************************************************************/
 
@@ -278,7 +279,8 @@
 BOOLEAN
 INIT_FUNCTION
 NTAPI
-IopAssignArcNamesToCdrom(IN PULONG Buffer,
+IopAssignArcNamesToCdrom(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
+                         IN PULONG Buffer,
                          IN ULONG DiskNumber)
 {
     CHAR ArcBuffer[128];
@@ -292,6 +294,10 @@
     ULONG i, CheckSum = 0;
     PDEVICE_OBJECT DeviceObject;
     PFILE_OBJECT FileObject;
+    PARC_DISK_INFORMATION ArcDiskInfo = LoaderBlock->ArcDiskInformation;
+    PLIST_ENTRY NextEntry;
+    PARC_DISK_SIGNATURE ArcDiskEntry;
+    BOOLEAN IsBootCdRom = FALSE;
 
     /* Build the device name */
     sprintf(ArcBuffer, "\\Device\\CdRom%lu", DiskNumber);
@@ -348,6 +354,28 @@
     /* Now calculate the checksum */
     for (i = 0; i < 2048 / sizeof(ULONG); i++) CheckSum += Buffer[i];
 
+    if (KeRosLoaderBlock) goto freeldrhack;
+
+    /* Search if this device is the actual boot CD */
+    for (NextEntry = ArcDiskInfo->DiskSignatureListHead.Flink;
+         NextEntry != &ArcDiskInfo->DiskSignatureListHead;
+         NextEntry = NextEntry->Flink)
+    {
+        /* Get the current ARC disk signature entry */
+        ArcDiskEntry = CONTAINING_RECORD(NextEntry,
+                                         ARC_DISK_SIGNATURE,
+                                         ListEntry);
+        /* And check if checksums and arc names match */
+        if (CheckSum == ArcDiskEntry->CheckSum &&
+            strcmp(KeLoaderBlock->ArcBootDeviceName, ArcDiskEntry->ArcName) == 0)
+        {
+            IsBootCdRom = TRUE;
+            break;
+        }
+    }
+    goto checkbootcd;
+
+freeldrhack:
     /*
      * FIXME: In normal conditions, NTLDR/FreeLdr sends the *proper* CDROM
      * ARC Path name, and what happens here is a comparision of both checksums
@@ -363,7 +391,10 @@
      * The signature code stays however, because eventually FreeLDR will work
      * like NTLDR, and, conversly, we do want to be able to be booted by NTLDR.
      */
-    if (IopApplyRosCdromArcHack(DiskNumber))
+    IsBootCdRom = IopApplyRosCdromArcHack(DiskNumber);
+
+checkbootcd:
+    if (IsBootCdRom)
     {
         /* This is the boot CD-ROM, build the ARC name */
         sprintf(ArcBuffer, "\\ArcName\\%s", KeLoaderBlock->ArcBootDeviceName);
@@ -583,7 +614,7 @@
         for (i = 0; i < ConfigInfo->CdRomCount; i++)
         {
             /* Give it an ARC name */
-            if (IopAssignArcNamesToCdrom(PartitionBuffer, i)) break;
+            if (IopAssignArcNamesToCdrom(LoaderBlock, PartitionBuffer, i)) break;
         }
 
         /* Free the buffer */




More information about the Ros-diffs mailing list