mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
Replaced IDEGetPartitionTable() by call to IoReadPartitionTable()
Several minor fixes svn path=/trunk/; revision=1948
This commit is contained in:
parent
6d96f0e0cc
commit
77fa055814
4 changed files with 282 additions and 446 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ide.c,v 1.41 2001/06/02 15:53:26 ekohl Exp $
|
/* $Id: ide.c,v 1.42 2001/06/07 21:18:01 ekohl Exp $
|
||||||
*
|
*
|
||||||
* IDE.C - IDE Disk driver
|
* IDE.C - IDE Disk driver
|
||||||
* written by Rex Jolliff
|
* written by Rex Jolliff
|
||||||
|
@ -108,7 +108,6 @@ IDE_CONTROLLER_PARAMETERS Controllers[IDE_MAX_CONTROLLERS] =
|
||||||
};
|
};
|
||||||
|
|
||||||
static BOOLEAN IDEInitialized = FALSE;
|
static BOOLEAN IDEInitialized = FALSE;
|
||||||
static int TotalPartitions = 0;
|
|
||||||
|
|
||||||
// ----------------------------------------------- Discardable Declarations
|
// ----------------------------------------------- Discardable Declarations
|
||||||
|
|
||||||
|
@ -147,21 +146,15 @@ static BOOLEAN IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
static BOOLEAN IDEGetDriveIdentification(IN int CommandPort,
|
static BOOLEAN IDEGetDriveIdentification(IN int CommandPort,
|
||||||
IN int DriveNum,
|
IN int DriveNum,
|
||||||
OUT PIDE_DRIVE_IDENTIFY DrvParms);
|
OUT PIDE_DRIVE_IDENTIFY DrvParms);
|
||||||
static BOOLEAN IDEGetPartitionTable(IN int CommandPort,
|
|
||||||
IN int DriveNum,
|
|
||||||
IN int Offset,
|
|
||||||
IN PIDE_DRIVE_IDENTIFY DrvParms,
|
|
||||||
PARTITION *PartitionTable);
|
|
||||||
static NTSTATUS IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
|
static NTSTATUS IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
// IN PCHAR DeviceName,
|
|
||||||
OUT PDEVICE_OBJECT *DeviceObject,
|
OUT PDEVICE_OBJECT *DeviceObject,
|
||||||
IN PCONTROLLER_OBJECT ControllerObject,
|
IN PCONTROLLER_OBJECT ControllerObject,
|
||||||
IN int UnitNumber,
|
IN int UnitNumber,
|
||||||
IN ULONG DiskNumber,
|
IN ULONG DiskNumber,
|
||||||
IN ULONG PartitionNumber,
|
|
||||||
IN PIDE_DRIVE_IDENTIFY DrvParms,
|
IN PIDE_DRIVE_IDENTIFY DrvParms,
|
||||||
IN DWORD Offset,
|
IN ULONG PartitionIdx,
|
||||||
IN DWORD Size);
|
IN ULONGLONG Offset,
|
||||||
|
IN ULONGLONG Size);
|
||||||
static int IDEPolledRead(IN WORD Address,
|
static int IDEPolledRead(IN WORD Address,
|
||||||
IN BYTE PreComp,
|
IN BYTE PreComp,
|
||||||
IN BYTE SectorCnt,
|
IN BYTE SectorCnt,
|
||||||
|
@ -351,6 +344,9 @@ IDECreateController(IN PDRIVER_OBJECT DriverObject,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TEST */
|
||||||
|
IDEInitialized = TRUE;
|
||||||
|
|
||||||
// Create device objects for each raw device (and for partitions)
|
// Create device objects for each raw device (and for partitions)
|
||||||
CreatedDevices = FALSE;
|
CreatedDevices = FALSE;
|
||||||
for (DriveIdx = 0; DriveIdx < IDE_MAX_DRIVES; DriveIdx++)
|
for (DriveIdx = 0; DriveIdx < IDE_MAX_DRIVES; DriveIdx++)
|
||||||
|
@ -413,21 +409,6 @@ IDEResetController(IN WORD CommandPort,
|
||||||
// Negate drive reset line
|
// Negate drive reset line
|
||||||
IDEWriteDriveControl(ControlPort, 0);
|
IDEWriteDriveControl(ControlPort, 0);
|
||||||
|
|
||||||
// Wait for BUSY assertion
|
|
||||||
/*for (Retries = 0; Retries < IDE_MAX_BUSY_RETRIES; Retries++)
|
|
||||||
{
|
|
||||||
if (IDEReadStatus(CommandPort) & IDE_SR_BUSY)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
KeStallExecutionProcessor(10);
|
|
||||||
}
|
|
||||||
CHECKPOINT;
|
|
||||||
if (Retries >= IDE_MAX_BUSY_RETRIES)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Wait for BUSY negation
|
// Wait for BUSY negation
|
||||||
for (Retries = 0; Retries < IDE_RESET_BUSY_TIMEOUT * 1000; Retries++)
|
for (Retries = 0; Retries < IDE_RESET_BUSY_TIMEOUT * 1000; Retries++)
|
||||||
{
|
{
|
||||||
|
@ -479,25 +460,20 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
IN int DriveIdx,
|
IN int DriveIdx,
|
||||||
IN int HarddiskIdx)
|
IN int HarddiskIdx)
|
||||||
{
|
{
|
||||||
BOOLEAN CreatedDevices;
|
|
||||||
WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
|
WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
|
||||||
int CommandPort, PartitionIdx, PartitionNum;
|
int CommandPort;
|
||||||
NTSTATUS RC;
|
NTSTATUS Status;
|
||||||
IDE_DRIVE_IDENTIFY DrvParms;
|
IDE_DRIVE_IDENTIFY DrvParms;
|
||||||
PDEVICE_OBJECT RawDeviceObject;
|
PDEVICE_OBJECT RawDeviceObject;
|
||||||
PDEVICE_OBJECT PrimaryDeviceObject;
|
PDEVICE_OBJECT PartitionDeviceObject;
|
||||||
PIDE_DEVICE_EXTENSION RawDeviceExtension;
|
PIDE_DEVICE_EXTENSION RawDeviceExtension;
|
||||||
PARTITION PartitionTable[4], *p;
|
|
||||||
UNICODE_STRING UnicodeDeviceDirName;
|
UNICODE_STRING UnicodeDeviceDirName;
|
||||||
OBJECT_ATTRIBUTES DeviceDirAttributes;
|
OBJECT_ATTRIBUTES DeviceDirAttributes;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
ULONG SectorCount = 0;
|
ULONG SectorCount = 0;
|
||||||
BOOLEAN ExtendedPart = FALSE;
|
PDRIVE_LAYOUT_INFORMATION PartitionList = NULL;
|
||||||
ULONG PartitionOffset = 0;
|
PPARTITION_INFORMATION PartitionEntry;
|
||||||
ULONG offsetToNextPartition = 0;
|
ULONG i;
|
||||||
#ifdef PARTITION_FIX
|
|
||||||
ULONG ExtendedOffset;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Copy I/O port offsets for convenience
|
// Copy I/O port offsets for convenience
|
||||||
CommandPort = ControllerExtension->CommandPortBase;
|
CommandPort = ControllerExtension->CommandPortBase;
|
||||||
|
@ -507,7 +483,7 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
CommandPort,
|
CommandPort,
|
||||||
DriveIdx);
|
DriveIdx);
|
||||||
|
|
||||||
// Get the Drive Identification Data
|
/* Get the Drive Identification Data */
|
||||||
if (!IDEGetDriveIdentification(CommandPort, DriveIdx, &DrvParms))
|
if (!IDEGetDriveIdentification(CommandPort, DriveIdx, &DrvParms))
|
||||||
{
|
{
|
||||||
DPRINT("Giving up on drive %d on controller %d...\n",
|
DPRINT("Giving up on drive %d on controller %d...\n",
|
||||||
|
@ -516,9 +492,7 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatedDevices = FALSE;
|
/* Create the harddisk device directory */
|
||||||
|
|
||||||
// Create the harddisk device directory
|
|
||||||
swprintf (NameBuffer,
|
swprintf (NameBuffer,
|
||||||
L"\\Device\\Harddisk%d",
|
L"\\Device\\Harddisk%d",
|
||||||
HarddiskIdx);
|
HarddiskIdx);
|
||||||
|
@ -529,14 +503,14 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
RC = ZwCreateDirectoryObject(&Handle, 0, &DeviceDirAttributes);
|
Status = ZwCreateDirectoryObject(&Handle, 0, &DeviceDirAttributes);
|
||||||
if (!NT_SUCCESS(RC))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("Could not create device dir object\n");
|
DbgPrint("Could not create device dir object\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the raw device
|
/* Create the disk device */
|
||||||
if (DrvParms.Capabilities & IDE_DRID_LBA_SUPPORTED)
|
if (DrvParms.Capabilities & IDE_DRID_LBA_SUPPORTED)
|
||||||
{
|
{
|
||||||
SectorCount =
|
SectorCount =
|
||||||
|
@ -549,129 +523,87 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
|
||||||
}
|
}
|
||||||
DPRINT("SectorCount %lu\n", SectorCount);
|
DPRINT("SectorCount %lu\n", SectorCount);
|
||||||
|
|
||||||
RC = IDECreateDevice(DriverObject,
|
Status = IDECreateDevice(DriverObject,
|
||||||
&RawDeviceObject,
|
&RawDeviceObject,
|
||||||
ControllerObject,
|
ControllerObject,
|
||||||
DriveIdx,
|
DriveIdx,
|
||||||
HarddiskIdx,
|
HarddiskIdx,
|
||||||
0,
|
|
||||||
&DrvParms,
|
&DrvParms,
|
||||||
0,
|
0,
|
||||||
|
0,
|
||||||
SectorCount);
|
SectorCount);
|
||||||
if (!NT_SUCCESS(RC))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint ("IDECreateDevice call failed for raw device\n", 0);
|
DbgPrint("IDECreateDevice call failed for raw device\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
/* Increase number of available physical disk drives */
|
||||||
// Increase number of available raw disk drives
|
|
||||||
IoGetConfigurationInformation()->DiskCount++;
|
IoGetConfigurationInformation()->DiskCount++;
|
||||||
|
|
||||||
CreatedDevices = TRUE;
|
RawDeviceExtension = (PIDE_DEVICE_EXTENSION)RawDeviceObject->DeviceExtension;
|
||||||
RawDeviceExtension = (PIDE_DEVICE_EXTENSION)
|
|
||||||
RawDeviceObject->DeviceExtension;
|
|
||||||
|
|
||||||
// Initialze the controller timer here (since it has to be
|
/*
|
||||||
// tied to a device)...
|
* Initialize the controller timer here
|
||||||
|
* (since it has to be tied to a device)
|
||||||
|
*/
|
||||||
if (DriveIdx == 0)
|
if (DriveIdx == 0)
|
||||||
{
|
{
|
||||||
ControllerExtension->TimerState = IDETimerIdle;
|
ControllerExtension->TimerState = IDETimerIdle;
|
||||||
ControllerExtension->TimerCount = 0;
|
ControllerExtension->TimerCount = 0;
|
||||||
ControllerExtension->TimerDevice = RawDeviceObject;
|
ControllerExtension->TimerDevice = RawDeviceObject;
|
||||||
IoInitializeTimer(RawDeviceObject, IDEIoTimer, ControllerExtension);
|
IoInitializeTimer(RawDeviceObject,
|
||||||
}
|
IDEIoTimer,
|
||||||
|
ControllerExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the partition table (chain)
|
DPRINT("DrvParms.BytesPerSector %ld\n",DrvParms.BytesPerSector);
|
||||||
PartitionOffset = 0;
|
|
||||||
#ifdef PARTITION_FIX
|
|
||||||
ExtendedOffset = 0;
|
|
||||||
#endif
|
|
||||||
PartitionNum = 1;
|
|
||||||
|
|
||||||
do
|
/* Read partition table */
|
||||||
|
Status = IoReadPartitionTable(RawDeviceObject,
|
||||||
|
DrvParms.BytesPerSector,
|
||||||
|
TRUE,
|
||||||
|
&PartitionList);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExtendedPart = FALSE;
|
DbgPrint("IoReadPartitionTable() failed\n");
|
||||||
|
return FALSE;
|
||||||
// Get Next partition table for device
|
|
||||||
if (!IDEGetPartitionTable(CommandPort, DriveIdx, PartitionOffset, &DrvParms, PartitionTable))
|
|
||||||
{
|
|
||||||
DbgPrint("drive %d controller %d offset %lu: Could not get partition table\n",
|
|
||||||
DriveIdx,
|
|
||||||
ControllerExtension->Number,
|
|
||||||
PartitionOffset);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// build devices for all partitions in table
|
|
||||||
DPRINT("Read partition on %wZ at %ld\n",
|
|
||||||
&UnicodeDeviceDirName,
|
|
||||||
PartitionOffset);
|
|
||||||
for (PartitionIdx = 0; PartitionIdx < 4; PartitionIdx++)
|
|
||||||
{
|
|
||||||
// copy partition pointer for convenience
|
|
||||||
p = &PartitionTable[PartitionIdx];
|
|
||||||
|
|
||||||
// if the partition entry is in use, create a device for it
|
DPRINT(" Number of partitions: %u\n", PartitionList->PartitionCount);
|
||||||
if (IsRecognizedPartition(p->PartitionType))
|
for (i=0;i < PartitionList->PartitionCount; i++)
|
||||||
{
|
{
|
||||||
DPRINT("Partition: %wZ entry:%d type:%02x Start:%lu Size:%lu\n",
|
PartitionEntry = &PartitionList->PartitionEntry[i];
|
||||||
&UnicodeDeviceDirName,
|
|
||||||
PartitionIdx,
|
|
||||||
p->PartitionType,
|
|
||||||
p->StartingBlock,
|
|
||||||
p->SectorCount);
|
|
||||||
|
|
||||||
// Create Device for partition
|
DPRINT("Partition %02ld: nr: %d boot: %1x type: %x offset: %I64d size: %I64d\n",
|
||||||
TotalPartitions++;
|
i,
|
||||||
RC = IDECreateDevice(DriverObject,
|
PartitionEntry->PartitionNumber,
|
||||||
&PrimaryDeviceObject,
|
PartitionEntry->BootIndicator,
|
||||||
|
PartitionEntry->PartitionType,
|
||||||
|
PartitionEntry->StartingOffset.QuadPart / 512 /*DrvParms.BytesPerSector*/,
|
||||||
|
PartitionEntry->PartitionLength.QuadPart / 512 /* DrvParms.BytesPerSector*/);
|
||||||
|
|
||||||
|
/* Create device for partition */
|
||||||
|
Status = IDECreateDevice(DriverObject,
|
||||||
|
&PartitionDeviceObject,
|
||||||
ControllerObject,
|
ControllerObject,
|
||||||
DriveIdx,
|
DriveIdx,
|
||||||
HarddiskIdx,
|
HarddiskIdx,
|
||||||
PartitionNum,
|
|
||||||
&DrvParms,
|
&DrvParms,
|
||||||
p->StartingBlock + PartitionOffset,
|
PartitionEntry->PartitionNumber,
|
||||||
p->SectorCount);
|
PartitionEntry->StartingOffset.QuadPart / 512 /* DrvParms.BytesPerSector*/,
|
||||||
if (!NT_SUCCESS(RC))
|
PartitionEntry->PartitionLength.QuadPart / 512 /*DrvParms.BytesPerSector*/);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint ("IDECreateDevice call failed\n", 0);
|
DbgPrint("IDECreateDevice() failed\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PartitionNum++;
|
|
||||||
}
|
}
|
||||||
else if (IsExtendedPartition(p->PartitionType))
|
|
||||||
{
|
if (PartitionList != NULL)
|
||||||
// Create devices for logical partitions within an extended partition
|
ExFreePool(PartitionList);
|
||||||
DPRINT("Extended: entry:%d type:%02x Start:%lu Size:%lu\n",
|
|
||||||
PartitionIdx,
|
//for (;;);
|
||||||
p->PartitionType,
|
|
||||||
p->StartingBlock,
|
|
||||||
p->SectorCount);
|
|
||||||
ExtendedPart = TRUE;
|
|
||||||
#ifdef PARTITION_FIX
|
|
||||||
if (ExtendedOffset == 0)
|
|
||||||
{
|
|
||||||
ExtendedOffset = p->StartingBlock;
|
|
||||||
offsetToNextPartition = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
offsetToNextPartition = p->StartingBlock;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
offsetToNextPartition = p->StartingBlock;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef PARTITION_FIX
|
|
||||||
PartitionOffset = ExtendedOffset + offsetToNextPartition;
|
|
||||||
#else
|
|
||||||
PartitionOffset += offsetToNextPartition;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (ExtendedPart == TRUE);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -743,118 +675,11 @@ IDEGetDriveIdentification(IN int CommandPort,
|
||||||
DrvParms->TMSectorCountLo,
|
DrvParms->TMSectorCountLo,
|
||||||
(ULONG)((DrvParms->TMSectorCountHi << 16) + DrvParms->TMSectorCountLo));
|
(ULONG)((DrvParms->TMSectorCountHi << 16) + DrvParms->TMSectorCountLo));
|
||||||
|
|
||||||
|
DPRINT("BytesPerSector %d\n", DrvParms->BytesPerSector);
|
||||||
|
DrvParms->BytesPerSector = 512; /* FIXME !!!*/
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDEGetPartitionTable
|
|
||||||
//
|
|
||||||
// DESCRIPTION:
|
|
||||||
// Gets the partition table from the device at the given offset if one exists
|
|
||||||
//
|
|
||||||
// RUN LEVEL:
|
|
||||||
// PASSIVE_LEVEL
|
|
||||||
//
|
|
||||||
// ARGUMENTS:
|
|
||||||
// IN int CommandPort Address of command port for controller
|
|
||||||
// IN int DriveNum index of drive (0,1)
|
|
||||||
// IN int Offset Block offset (LBA addressing)
|
|
||||||
// OUT PARTITION *PartitionTable address to write partition table
|
|
||||||
//
|
|
||||||
// RETURNS:
|
|
||||||
// TRUE partition table was retrieved successfully
|
|
||||||
//
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
IDEGetPartitionTable(IN int CommandPort,
|
|
||||||
IN int DriveNum,
|
|
||||||
IN int Offset,
|
|
||||||
IN PIDE_DRIVE_IDENTIFY DrvParms,
|
|
||||||
OUT PARTITION *PartitionTable)
|
|
||||||
{
|
|
||||||
BYTE SectorBuf[512], SectorNum, DrvHead, CylinderLow, CylinderHigh;
|
|
||||||
int RC, SaveOffset;
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
int i;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Get sector at offset
|
|
||||||
SaveOffset = Offset;
|
|
||||||
if (DrvParms->Capabilities & IDE_DRID_LBA_SUPPORTED)
|
|
||||||
{
|
|
||||||
SectorNum = Offset & 0xff;
|
|
||||||
CylinderLow = (Offset >> 8) & 0xff;
|
|
||||||
CylinderHigh = (Offset >> 16) & 0xff;
|
|
||||||
DrvHead = ((Offset >> 24) & 0x0f) |
|
|
||||||
(DriveNum ? IDE_DH_DRV1 : 0) |
|
|
||||||
IDE_DH_LBA;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SectorNum = (Offset % DrvParms->SectorsPerTrack) + 1;
|
|
||||||
Offset /= DrvParms->SectorsPerTrack;
|
|
||||||
DrvHead = (Offset % DrvParms->LogicalHeads) |
|
|
||||||
(DriveNum ? IDE_DH_DRV1 : 0);
|
|
||||||
Offset /= DrvParms->LogicalHeads;
|
|
||||||
CylinderLow = Offset & 0xff;
|
|
||||||
CylinderHigh = Offset >> 8;
|
|
||||||
}
|
|
||||||
Offset = SaveOffset;
|
|
||||||
|
|
||||||
RC = IDEPolledRead(CommandPort,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
SectorNum,
|
|
||||||
CylinderLow,
|
|
||||||
CylinderHigh,
|
|
||||||
DrvHead,
|
|
||||||
// IDE_CMD_READ_RETRY,
|
|
||||||
IDE_CMD_READ,
|
|
||||||
SectorBuf);
|
|
||||||
if (RC != 0)
|
|
||||||
{
|
|
||||||
DbgPrint ("read failed: port %04x drive %d sector %d rc %d\n",
|
|
||||||
CommandPort,
|
|
||||||
DriveNum,
|
|
||||||
Offset,
|
|
||||||
RC);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else if (*((WORD *)(SectorBuf + PART_MAGIC_OFFSET)) != PARTITION_MAGIC)
|
|
||||||
{
|
|
||||||
DbgPrint ("Bad partition magic: port %04x drive %d offset %d magic %d\n",
|
|
||||||
CommandPort,
|
|
||||||
DriveNum,
|
|
||||||
Offset,
|
|
||||||
*((short *)(SectorBuf + PART_MAGIC_OFFSET)));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
RtlCopyMemory(PartitionTable, SectorBuf + PARTITION_OFFSET, sizeof(PARTITION) * 4);
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
DPRINT("Partition Table for device %d at offset %d on port %x\n",
|
|
||||||
DriveNum,
|
|
||||||
Offset,
|
|
||||||
CommandPort);
|
|
||||||
for (i = 0; i < PARTITION_TBL_SIZE; i++)
|
|
||||||
{
|
|
||||||
DPRINT(" %d: flags:%2x type:%x start:%d:%d:%d end:%d:%d:%d stblk:%d count:%d\n",
|
|
||||||
i,
|
|
||||||
PartitionTable[i].BootFlags,
|
|
||||||
PartitionTable[i].PartitionType,
|
|
||||||
PartitionTable[i].StartingHead,
|
|
||||||
PartitionTable[i].StartingSector,
|
|
||||||
PartitionTable[i].StartingCylinder,
|
|
||||||
PartitionTable[i].EndingHead,
|
|
||||||
PartitionTable[i].EndingSector,
|
|
||||||
PartitionTable[i].EndingCylinder,
|
|
||||||
PartitionTable[i].StartingBlock,
|
|
||||||
PartitionTable[i].SectorCount);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// IDECreateDevice
|
// IDECreateDevice
|
||||||
//
|
//
|
||||||
|
@ -885,10 +710,10 @@ IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
IN PCONTROLLER_OBJECT ControllerObject,
|
IN PCONTROLLER_OBJECT ControllerObject,
|
||||||
IN int UnitNumber,
|
IN int UnitNumber,
|
||||||
IN ULONG DiskNumber,
|
IN ULONG DiskNumber,
|
||||||
IN ULONG PartitionNumber,
|
|
||||||
IN PIDE_DRIVE_IDENTIFY DrvParms,
|
IN PIDE_DRIVE_IDENTIFY DrvParms,
|
||||||
IN DWORD Offset,
|
IN ULONG PartitionNumber,
|
||||||
IN DWORD Size)
|
IN ULONGLONG Offset,
|
||||||
|
IN ULONGLONG Size)
|
||||||
{
|
{
|
||||||
WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
|
WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
|
||||||
WCHAR ArcNameBuffer[IDE_MAX_NAME_LENGTH + 15];
|
WCHAR ArcNameBuffer[IDE_MAX_NAME_LENGTH + 15];
|
||||||
|
@ -933,9 +758,11 @@ IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
DrvParms->SectorsPerTrack;
|
DrvParms->SectorsPerTrack;
|
||||||
DeviceExtension->SectorsPerLogTrk = DrvParms->SectorsPerTrack;
|
DeviceExtension->SectorsPerLogTrk = DrvParms->SectorsPerTrack;
|
||||||
DeviceExtension->LogicalHeads = DrvParms->LogicalHeads;
|
DeviceExtension->LogicalHeads = DrvParms->LogicalHeads;
|
||||||
|
DeviceExtension->LogicalCylinders =
|
||||||
|
(DrvParms->Capabilities & IDE_DRID_LBA_SUPPORTED) ? DrvParms->TMCylinders : DrvParms->LogicalCyls;
|
||||||
DeviceExtension->Offset = Offset;
|
DeviceExtension->Offset = Offset;
|
||||||
DeviceExtension->Size = Size;
|
DeviceExtension->Size = Size;
|
||||||
DPRINT("%wZ: offset %d size %d \n",
|
DPRINT("%wZ: offset %lu size %lu \n",
|
||||||
&DeviceName,
|
&DeviceName,
|
||||||
DeviceExtension->Offset,
|
DeviceExtension->Offset,
|
||||||
DeviceExtension->Size);
|
DeviceExtension->Size);
|
||||||
|
@ -945,7 +772,7 @@ IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
if (PartitionNumber != 0)
|
if (PartitionNumber != 0)
|
||||||
{
|
{
|
||||||
DbgPrint("%wZ %dMB\n", &DeviceName, Size / 2048);
|
DbgPrint("%wZ %luMB\n", &DeviceName, Size / 2048);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* assign arc name */
|
/* assign arc name */
|
||||||
|
@ -1208,8 +1035,8 @@ DPRINT("AdjOffset:%ld:%ld + Length:%ld = AdjExtent:%ld:%ld\n",
|
||||||
if ((AdjustedExtent.QuadPart > PartitionExtent.QuadPart) ||
|
if ((AdjustedExtent.QuadPart > PartitionExtent.QuadPart) ||
|
||||||
(IrpStack->Parameters.Read.Length & (DeviceExtension->BytesPerSector - 1)))
|
(IrpStack->Parameters.Read.Length & (DeviceExtension->BytesPerSector - 1)))
|
||||||
{
|
{
|
||||||
DbgPrint ("Request failed on bad parameters\n");
|
DPRINT("Request failed on bad parameters\n",0);
|
||||||
DbgPrint ("AdjustedExtent=%d:%d PartitionExtent=%d:%d ReadLength=%d\n",
|
DPRINT("AdjustedExtent=%d:%d PartitionExtent=%d:%d ReadLength=%d\n",
|
||||||
(unsigned int) AdjustedExtent.u.HighPart,
|
(unsigned int) AdjustedExtent.u.HighPart,
|
||||||
(unsigned int) AdjustedExtent.u.LowPart,
|
(unsigned int) AdjustedExtent.u.LowPart,
|
||||||
(unsigned int) PartitionExtent.u.HighPart,
|
(unsigned int) PartitionExtent.u.HighPart,
|
||||||
|
@ -1248,8 +1075,8 @@ DPRINT("AdjOffset:%ld:%ld + Length:%ld = AdjExtent:%ld:%ld\n",
|
||||||
// NTSTATUS
|
// NTSTATUS
|
||||||
//
|
//
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS STDCALL
|
||||||
STDCALL IDEDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
IDEDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
NTSTATUS RC;
|
NTSTATUS RC;
|
||||||
|
@ -1279,8 +1106,7 @@ STDCALL IDEDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject,
|
||||||
Geometry = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer;
|
Geometry = (PDISK_GEOMETRY) Irp->AssociatedIrp.SystemBuffer;
|
||||||
Geometry->MediaType = FixedMedia;
|
Geometry->MediaType = FixedMedia;
|
||||||
// FIXME: should report for RawDevice even on partition
|
// FIXME: should report for RawDevice even on partition
|
||||||
Geometry->Cylinders.QuadPart = DeviceExtension->Size /
|
Geometry->Cylinders.QuadPart = DeviceExtension->LogicalCylinders;
|
||||||
DeviceExtension->SectorsPerLogCyl;
|
|
||||||
Geometry->TracksPerCylinder = DeviceExtension->SectorsPerLogTrk /
|
Geometry->TracksPerCylinder = DeviceExtension->SectorsPerLogTrk /
|
||||||
DeviceExtension->SectorsPerLogCyl;
|
DeviceExtension->SectorsPerLogCyl;
|
||||||
Geometry->SectorsPerTrack = DeviceExtension->SectorsPerLogTrk;
|
Geometry->SectorsPerTrack = DeviceExtension->SectorsPerLogTrk;
|
||||||
|
@ -1344,6 +1170,8 @@ STDCALL IDEStartIo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PIDE_DEVICE_EXTENSION DeviceExtension;
|
PIDE_DEVICE_EXTENSION DeviceExtension;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
|
||||||
|
DPRINT("IDEStartIo() called!\n");
|
||||||
|
|
||||||
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
IrpStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
DeviceExtension = (PIDE_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
DeviceExtension = (PIDE_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
@ -1387,6 +1215,7 @@ STDCALL IDEStartIo(IN PDEVICE_OBJECT DeviceObject,
|
||||||
IoStartNextPacket(DeviceObject, FALSE);
|
IoStartNextPacket(DeviceObject, FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
DPRINT("IDEStartIo() finished!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDEAllocateController
|
// IDEAllocateController
|
||||||
|
|
|
@ -24,7 +24,7 @@ extern "C" {
|
||||||
#define IDE_MAX_CMD_RETRIES 0
|
#define IDE_MAX_CMD_RETRIES 0
|
||||||
#define IDE_CMD_TIMEOUT 5
|
#define IDE_CMD_TIMEOUT 5
|
||||||
#define IDE_RESET_PULSE_LENGTH 500 /* maybe a little too long */
|
#define IDE_RESET_PULSE_LENGTH 500 /* maybe a little too long */
|
||||||
#define IDE_RESET_BUSY_TIMEOUT 31
|
#define IDE_RESET_BUSY_TIMEOUT 120
|
||||||
#define IDE_RESET_DRDY_TIMEOUT 120
|
#define IDE_RESET_DRDY_TIMEOUT 120
|
||||||
|
|
||||||
// Control Block offsets and masks
|
// Control Block offsets and masks
|
||||||
|
@ -126,7 +126,8 @@ extern "C" {
|
||||||
// Available at any IRQL
|
// Available at any IRQL
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef struct _IDE_DEVICE_EXTENSION {
|
typedef struct _IDE_DEVICE_EXTENSION
|
||||||
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PCONTROLLER_OBJECT ControllerObject;
|
PCONTROLLER_OBJECT ControllerObject;
|
||||||
struct _IDE_DEVICE_EXTESION *DiskExtension;
|
struct _IDE_DEVICE_EXTESION *DiskExtension;
|
||||||
|
@ -135,6 +136,7 @@ typedef struct _IDE_DEVICE_EXTENSION {
|
||||||
BOOLEAN DMASupported;
|
BOOLEAN DMASupported;
|
||||||
int BytesPerSector;
|
int BytesPerSector;
|
||||||
int LogicalHeads;
|
int LogicalHeads;
|
||||||
|
int LogicalCylinders;
|
||||||
int SectorsPerLogCyl;
|
int SectorsPerLogCyl;
|
||||||
int SectorsPerLogTrk;
|
int SectorsPerLogTrk;
|
||||||
int Offset;
|
int Offset;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: disk.h,v 1.4 2000/08/21 00:11:51 ekohl Exp $
|
/* $Id: disk.h,v 1.5 2001/06/07 21:16:17 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -101,7 +101,8 @@ typedef enum _MEDIA_TYPE {
|
||||||
FixedMedia
|
FixedMedia
|
||||||
} MEDIA_TYPE;
|
} MEDIA_TYPE;
|
||||||
|
|
||||||
typedef struct _PARTITION_INFORMATION {
|
typedef struct _PARTITION_INFORMATION
|
||||||
|
{
|
||||||
LARGE_INTEGER StartingOffset;
|
LARGE_INTEGER StartingOffset;
|
||||||
LARGE_INTEGER PartitionLength;
|
LARGE_INTEGER PartitionLength;
|
||||||
DWORD HiddenSectors;
|
DWORD HiddenSectors;
|
||||||
|
@ -110,15 +111,17 @@ typedef struct _PARTITION_INFORMATION {
|
||||||
BOOLEAN BootIndicator;
|
BOOLEAN BootIndicator;
|
||||||
BOOLEAN RecognizedPartition;
|
BOOLEAN RecognizedPartition;
|
||||||
BOOLEAN RewritePartition;
|
BOOLEAN RewritePartition;
|
||||||
} PARTITION_INFORMATION;
|
} PARTITION_INFORMATION, *PPARTITION_INFORMATION;
|
||||||
|
|
||||||
typedef struct _DRIVE_LAYOUT_INFORMATION {
|
typedef struct _DRIVE_LAYOUT_INFORMATION
|
||||||
|
{
|
||||||
DWORD PartitionCount;
|
DWORD PartitionCount;
|
||||||
DWORD Signature;
|
DWORD Signature;
|
||||||
PARTITION_INFORMATION PartitionEntry[1];
|
PARTITION_INFORMATION PartitionEntry[1];
|
||||||
} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
|
} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
|
||||||
|
|
||||||
typedef struct _DISK_GEOMETRY {
|
typedef struct _DISK_GEOMETRY
|
||||||
|
{
|
||||||
LARGE_INTEGER Cylinders;
|
LARGE_INTEGER Cylinders;
|
||||||
MEDIA_TYPE MediaType;
|
MEDIA_TYPE MediaType;
|
||||||
DWORD TracksPerCylinder;
|
DWORD TracksPerCylinder;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: xhaldrv.c,v 1.8 2001/05/06 22:32:34 ekohl Exp $
|
/* $Id: xhaldrv.c,v 1.9 2001/06/07 21:16:41 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -142,14 +142,11 @@ xHalpQueryDriveLayout (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID FASTCALL
|
||||||
FASTCALL
|
xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
|
||||||
xHalExamineMBR (
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN ULONG SectorSize,
|
IN ULONG SectorSize,
|
||||||
IN ULONG MBRTypeIdentifier,
|
IN ULONG MBRTypeIdentifier,
|
||||||
OUT PVOID * Buffer
|
OUT PVOID *Buffer)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
IO_STATUS_BLOCK StatusBlock;
|
IO_STATUS_BLOCK StatusBlock;
|
||||||
|
@ -568,18 +565,15 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS FASTCALL
|
||||||
FASTCALL
|
xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||||
xHalIoReadPartitionTable (
|
|
||||||
PDEVICE_OBJECT DeviceObject,
|
|
||||||
ULONG SectorSize,
|
ULONG SectorSize,
|
||||||
BOOLEAN ReturnRecognizedPartitions,
|
BOOLEAN ReturnRecognizedPartitions,
|
||||||
PDRIVE_LAYOUT_INFORMATION * PartitionBuffer
|
PDRIVE_LAYOUT_INFORMATION *PartitionBuffer)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
IO_STATUS_BLOCK StatusBlock;
|
IO_STATUS_BLOCK StatusBlock;
|
||||||
ULARGE_INTEGER Offset;
|
ULARGE_INTEGER PartitionOffset;
|
||||||
PUCHAR SectorBuffer;
|
PUCHAR SectorBuffer;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -613,9 +607,10 @@ xHalIoReadPartitionTable (
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory (LayoutBuffer, 0x1000);
|
RtlZeroMemory(LayoutBuffer,
|
||||||
|
0x1000);
|
||||||
|
|
||||||
Offset.QuadPart = 0;
|
PartitionOffset.QuadPart = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -623,14 +618,15 @@ xHalIoReadPartitionTable (
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
|
DPRINT("PartitionOffset: %I64u\n", PartitionOffset.QuadPart / SectorSize);
|
||||||
|
|
||||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||||
DeviceObject,
|
DeviceObject,
|
||||||
SectorBuffer,
|
SectorBuffer,
|
||||||
SectorSize,
|
SectorSize,
|
||||||
(PLARGE_INTEGER)&Offset,
|
(PLARGE_INTEGER)&PartitionOffset,
|
||||||
&Event,
|
&Event,
|
||||||
&StatusBlock);
|
&StatusBlock);
|
||||||
|
|
||||||
Status = IoCallDriver(DeviceObject,
|
Status = IoCallDriver(DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
|
@ -645,7 +641,7 @@ xHalIoReadPartitionTable (
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("xHalIoReadPartitonTable failed (Status = 0x%08lx)\n",
|
DPRINT("xHalIoReadPartitonTable failed (Status = 0x%08lx)\n",
|
||||||
Status);
|
Status);
|
||||||
ExFreePool(SectorBuffer);
|
ExFreePool(SectorBuffer);
|
||||||
ExFreePool(LayoutBuffer);
|
ExFreePool(LayoutBuffer);
|
||||||
|
@ -658,11 +654,8 @@ xHalIoReadPartitionTable (
|
||||||
DPRINT("Magic %x\n", PartitionTable->Magic);
|
DPRINT("Magic %x\n", PartitionTable->Magic);
|
||||||
if (PartitionTable->Magic != PARTITION_MAGIC)
|
if (PartitionTable->Magic != PARTITION_MAGIC)
|
||||||
{
|
{
|
||||||
DPRINT1("Invalid partition table magic\n");
|
DPRINT("Invalid partition table magic\n");
|
||||||
ExFreePool(SectorBuffer);
|
ExFreePool(SectorBuffer);
|
||||||
// ExFreePool (LayoutBuffer);
|
|
||||||
// return STATUS_UNSUCCESSFUL;
|
|
||||||
|
|
||||||
*PartitionBuffer = LayoutBuffer;
|
*PartitionBuffer = LayoutBuffer;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -691,28 +684,37 @@ xHalIoReadPartitionTable (
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedFound = FALSE;
|
ExtendedFound = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < PARTITION_TBL_SIZE; i++)
|
for (i = 0; i < PARTITION_TBL_SIZE; i++)
|
||||||
|
{
|
||||||
|
if ((ReturnRecognizedPartitions == FALSE) ||
|
||||||
|
((ReturnRecognizedPartitions == TRUE) &&
|
||||||
|
IsRecognizedPartition(PartitionTable->Partition[i].PartitionType)))
|
||||||
{
|
{
|
||||||
/* handle normal partition */
|
/* handle normal partition */
|
||||||
DPRINT("Partition %u: Normal Partition\n", i);
|
DPRINT("Partition %u: Normal Partition\n", i);
|
||||||
Count = LayoutBuffer->PartitionCount;
|
Count = LayoutBuffer->PartitionCount;
|
||||||
DPRINT("Logical Partition %u\n", Count);
|
DPRINT("Logical Partition %u\n", Count);
|
||||||
|
if (PartitionTable->Partition[i].StartingBlock == 0)
|
||||||
if (PartitionTable->Partition[i].StartingBlock)
|
{
|
||||||
|
LayoutBuffer->PartitionEntry[Count].StartingOffset.QuadPart = 0;
|
||||||
|
}
|
||||||
|
else if (IsExtendedPartition(PartitionTable->Partition[i].PartitionType))
|
||||||
{
|
{
|
||||||
LayoutBuffer->PartitionEntry[Count].StartingOffset.QuadPart =
|
LayoutBuffer->PartitionEntry[Count].StartingOffset.QuadPart =
|
||||||
(ULONGLONG)Offset.QuadPart +
|
(ULONGLONG)PartitionOffset.QuadPart;
|
||||||
((ULONGLONG)PartitionTable->Partition[i].StartingBlock * (ULONGLONG)SectorSize);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LayoutBuffer->PartitionEntry[Count].StartingOffset.QuadPart = 0;
|
LayoutBuffer->PartitionEntry[Count].StartingOffset.QuadPart =
|
||||||
|
(ULONGLONG)PartitionOffset.QuadPart +
|
||||||
|
((ULONGLONG)PartitionTable->Partition[i].StartingBlock * (ULONGLONG)SectorSize);
|
||||||
}
|
}
|
||||||
LayoutBuffer->PartitionEntry[Count].PartitionLength.QuadPart =
|
LayoutBuffer->PartitionEntry[Count].PartitionLength.QuadPart =
|
||||||
(ULONGLONG)PartitionTable->Partition[i].SectorCount * (ULONGLONG)SectorSize;
|
(ULONGLONG)PartitionTable->Partition[i].SectorCount * (ULONGLONG)SectorSize;
|
||||||
LayoutBuffer->PartitionEntry[Count].HiddenSectors = 0;
|
LayoutBuffer->PartitionEntry[Count].HiddenSectors = 0;
|
||||||
|
|
||||||
if (IsUsablePartition(PartitionTable->Partition[i].PartitionType))
|
if (IsRecognizedPartition(PartitionTable->Partition[i].PartitionType))
|
||||||
{
|
{
|
||||||
LayoutBuffer->PartitionEntry[Count].PartitionNumber = Number;
|
LayoutBuffer->PartitionEntry[Count].PartitionNumber = Number;
|
||||||
Number++;
|
Number++;
|
||||||
|
@ -730,20 +732,7 @@ xHalIoReadPartitionTable (
|
||||||
IsRecognizedPartition (PartitionTable->Partition[i].PartitionType);
|
IsRecognizedPartition (PartitionTable->Partition[i].PartitionType);
|
||||||
LayoutBuffer->PartitionEntry[Count].RewritePartition = FALSE;
|
LayoutBuffer->PartitionEntry[Count].RewritePartition = FALSE;
|
||||||
|
|
||||||
DPRINT(" Offset: 0x%I64x", Offset.QuadPart);
|
DPRINT1(" %ld: nr: %d boot: %1x type: %x start: 0x%I64x count: 0x%I64x\n",
|
||||||
|
|
||||||
if (IsUsablePartition(PartitionTable->Partition[i].PartitionType))
|
|
||||||
{
|
|
||||||
Offset.QuadPart = (ULONGLONG)Offset.QuadPart +
|
|
||||||
(((ULONGLONG)PartitionTable->Partition[i].StartingBlock + (ULONGLONG)PartitionTable->Partition[i].SectorCount)* (ULONGLONG)SectorSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsExtendedPartition(PartitionTable->Partition[i].PartitionType))
|
|
||||||
{
|
|
||||||
ExtendedFound = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT(" %ld: nr: %d boot: %1x type: %x start: 0x%I64x count: 0x%I64x\n",
|
|
||||||
Count,
|
Count,
|
||||||
LayoutBuffer->PartitionEntry[Count].PartitionNumber,
|
LayoutBuffer->PartitionEntry[Count].PartitionNumber,
|
||||||
LayoutBuffer->PartitionEntry[Count].BootIndicator,
|
LayoutBuffer->PartitionEntry[Count].BootIndicator,
|
||||||
|
@ -753,6 +742,19 @@ xHalIoReadPartitionTable (
|
||||||
|
|
||||||
LayoutBuffer->PartitionCount++;
|
LayoutBuffer->PartitionCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsUsablePartition(PartitionTable->Partition[i].PartitionType))
|
||||||
|
{
|
||||||
|
PartitionOffset.QuadPart = (ULONGLONG)PartitionOffset.QuadPart +
|
||||||
|
(((ULONGLONG)PartitionTable->Partition[i].StartingBlock +
|
||||||
|
(ULONGLONG)PartitionTable->Partition[i].SectorCount)* (ULONGLONG)SectorSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsExtendedPartition(PartitionTable->Partition[i].PartitionType))
|
||||||
|
{
|
||||||
|
ExtendedFound = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (ExtendedFound == TRUE);
|
while (ExtendedFound == TRUE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue