Fix for error in reading next extended partition when partition contains slack

or more than one non container partition.

svn path=/trunk/; revision=2035
This commit is contained in:
Rex Jolliff 2001-07-04 16:42:37 +00:00
parent eed177f191
commit df84ec15d8

View file

@ -1,4 +1,4 @@
/* $Id: xhaldrv.c,v 1.13 2001/06/29 11:09:48 ekohl Exp $ /* $Id: xhaldrv.c,v 1.14 2001/07/04 16:42:37 rex Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -541,6 +541,8 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
KEVENT Event; KEVENT Event;
IO_STATUS_BLOCK StatusBlock; IO_STATUS_BLOCK StatusBlock;
ULARGE_INTEGER PartitionOffset; ULARGE_INTEGER PartitionOffset;
ULARGE_INTEGER nextPartitionOffset;
ULARGE_INTEGER containerOffset;
PUCHAR SectorBuffer; PUCHAR SectorBuffer;
PIRP Irp; PIRP Irp;
NTSTATUS Status; NTSTATUS Status;
@ -578,6 +580,7 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
0x1000); 0x1000);
PartitionOffset.QuadPart = 0; PartitionOffset.QuadPart = 0;
containerOffset.QuadPart = 0;
do do
{ {
@ -710,18 +713,28 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
LayoutBuffer->PartitionCount++; LayoutBuffer->PartitionCount++;
} }
#if 0
if (IsNormalPartition(PartitionTable->Partition[i].PartitionType)) if (IsNormalPartition(PartitionTable->Partition[i].PartitionType))
{ {
PartitionOffset.QuadPart = (ULONGLONG)PartitionOffset.QuadPart + PartitionOffset.QuadPart = (ULONGLONG)PartitionOffset.QuadPart +
(((ULONGLONG)PartitionTable->Partition[i].StartingBlock + (((ULONGLONG)PartitionTable->Partition[i].StartingBlock +
(ULONGLONG)PartitionTable->Partition[i].SectorCount)* (ULONGLONG)SectorSize); (ULONGLONG)PartitionTable->Partition[i].SectorCount)* (ULONGLONG)SectorSize);
} }
#endif
if (IsExtendedPartition(PartitionTable->Partition[i].PartitionType)) if (IsExtendedPartition(PartitionTable->Partition[i].PartitionType))
{ {
ExtendedFound = TRUE; ExtendedFound = TRUE;
if ((ULONGLONG) containerOffset.QuadPart == (ULONGLONG) 0)
{
containerOffset = PartitionOffset;
}
nextPartitionOffset.QuadPart = (ULONGLONG) containerOffset.QuadPart +
(ULONGLONG) PartitionTable->Partition[i].StartingBlock *
(ULONGLONG) SectorSize;
} }
} }
PartitionOffset = nextPartitionOffset;
} }
while (ExtendedFound == TRUE); while (ExtendedFound == TRUE);
@ -731,7 +744,6 @@ xHalIoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
NTSTATUS FASTCALL NTSTATUS FASTCALL
xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize, IN ULONG SectorSize,