From 04dfc992a13e7d657041777484f5a3f9c6b4d208 Mon Sep 17 00:00:00 2001 From: ReactOS Portable Systems Group Date: Tue, 22 Jul 2008 06:31:31 +0000 Subject: [PATCH] - Fail: was using the wrong structure (the boot sector is a BOOT_SECTOR which contains the BIOS Parameter Block, not a BPB directly). - Fix wrong debug print too. svn path=/trunk/; revision=34660 --- .../drivers/storage/class/ramdisk/ramdisk.c | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/reactos/drivers/storage/class/ramdisk/ramdisk.c b/reactos/drivers/storage/class/ramdisk/ramdisk.c index 887e8a800dc..cd7fe2f01b5 100644 --- a/reactos/drivers/storage/class/ramdisk/ramdisk.c +++ b/reactos/drivers/storage/class/ramdisk/ramdisk.c @@ -289,7 +289,7 @@ RamdiskMapPages(IN PRAMDISK_DRIVE_EXTENSION DeviceExtension, // Calculate the actual offset in the drive // ActualOffset.QuadPart = DeviceExtension->DiskOffset + Offset.QuadPart; - DPRINT1("Disk offset is: %I64d and Offset is: %I64d. Total: %I64d\n", + DPRINT1("Disk offset is: %d and Offset is: %I64d. Total: %I64d\n", DeviceExtension->DiskOffset, Offset, ActualOffset); // @@ -328,10 +328,7 @@ RamdiskMapPages(IN PRAMDISK_DRIVE_EXTENSION DeviceExtension, // MappedBase = MmMapIoSpace(PhysicalAddress, ActualLength, MmCached); DPRINT1("Mapped at: %p\n", MappedBase); - - UNIMPLEMENTED; - while (TRUE); - return NULL; + return MappedBase; } PVOID @@ -360,7 +357,7 @@ RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension, PVOID Buffer; WCHAR LocalBuffer[16]; UNICODE_STRING SymbolicLinkName, DriveString, GuidString, DeviceName; - PPACKED_BIOS_PARAMETER_BLOCK Parameters; + PPACKED_BOOT_SECTOR BootSector; ULONG BytesPerSector, SectorsPerTrack, Heads, BytesRead; PVOID BaseAddress; LARGE_INTEGER CurrentOffset; @@ -616,10 +613,10 @@ RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension, // // Get the data // - Parameters = (PPACKED_BIOS_PARAMETER_BLOCK)BaseAddress; - BytesPerSector = Parameters->BytesPerSector[0]; - SectorsPerTrack = Parameters->SectorsPerTrack[0]; - Heads = Parameters->Heads[0]; + BootSector = (PPACKED_BOOT_SECTOR)BaseAddress; + BytesPerSector = BootSector->PackedBpb.BytesPerSector[0]; + SectorsPerTrack = BootSector->PackedBpb.SectorsPerTrack[0]; + Heads = BootSector->PackedBpb.Heads[0]; // // Save it @@ -647,6 +644,17 @@ RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension, } } + // + // Sanity check for debugging + // + DPRINT1("[RAMDISK] Loaded...\n" + "Bytes per Sector: %d\n" + "Sectors per Track: %d\n" + "Number of Heads: %d\n", + DriveExtension->BytesPerSector, + DriveExtension->SectorsPerTrack, + DriveExtension->NumberOfHeads); + // // Check if the drive settings haven't been set yet // @@ -676,7 +684,7 @@ RamdiskCreateDiskDevice(IN PRAMDISK_BUS_EXTENSION DeviceExtension, DriveExtension->NumberOfHeads = 16; } } - + // // Acquire the disk lock //