@@ -1387,14 +1387,12 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
1387
1387
NTSTATUS
1388
1388
NTAPI
1389
1389
HalpGetFullGeometry (IN PDEVICE_OBJECT DeviceObject ,
1390
- IN PDISK_GEOMETRY Geometry ,
1391
- OUT PULONGLONG RealSectorCount )
1390
+ OUT PDISK_GEOMETRY_EX Geometry )
1392
1391
{
1393
1392
PIRP Irp ;
1394
1393
IO_STATUS_BLOCK IoStatusBlock ;
1395
1394
PKEVENT Event ;
1396
1395
NTSTATUS Status ;
1397
- PARTITION_INFORMATION PartitionInfo ;
1398
1396
PAGED_CODE ();
1399
1397
1400
1398
/* Allocate a non-paged event */
@@ -1407,12 +1405,12 @@ HalpGetFullGeometry(IN PDEVICE_OBJECT DeviceObject,
1407
1405
KeInitializeEvent (Event , NotificationEvent , FALSE);
1408
1406
1409
1407
/* Build the IRP */
1410
- Irp = IoBuildDeviceIoControlRequest (IOCTL_DISK_GET_DRIVE_GEOMETRY ,
1408
+ Irp = IoBuildDeviceIoControlRequest (IOCTL_DISK_GET_DRIVE_GEOMETRY_EX ,
1411
1409
DeviceObject ,
1412
1410
NULL ,
1413
1411
0UL ,
1414
1412
Geometry ,
1415
- sizeof (DISK_GEOMETRY ),
1413
+ sizeof (DISK_GEOMETRY_EX ),
1416
1414
FALSE,
1417
1415
Event ,
1418
1416
& IoStatusBlock );
@@ -1432,47 +1430,6 @@ HalpGetFullGeometry(IN PDEVICE_OBJECT DeviceObject,
1432
1430
Status = IoStatusBlock .Status ;
1433
1431
}
1434
1432
1435
- /* Check if the driver returned success */
1436
- if (NT_SUCCESS (Status ))
1437
- {
1438
- /* Build another IRP */
1439
- Irp = IoBuildDeviceIoControlRequest (IOCTL_DISK_GET_PARTITION_INFO ,
1440
- DeviceObject ,
1441
- NULL ,
1442
- 0UL ,
1443
- & PartitionInfo ,
1444
- sizeof (PARTITION_INFORMATION ),
1445
- FALSE,
1446
- Event ,
1447
- & IoStatusBlock );
1448
- if (!Irp )
1449
- {
1450
- /* Fail, free the event */
1451
- ExFreePoolWithTag (Event , TAG_FILE_SYSTEM );
1452
- return STATUS_INSUFFICIENT_RESOURCES ;
1453
- }
1454
-
1455
- /* Reset event */
1456
- KeClearEvent (Event );
1457
-
1458
- /* Call the driver and check if it's pending */
1459
- Status = IoCallDriver (DeviceObject , Irp );
1460
- if (Status == STATUS_PENDING )
1461
- {
1462
- /* Wait on the driver */
1463
- KeWaitForSingleObject (Event , Executive , KernelMode , FALSE, NULL );
1464
- Status = IoStatusBlock .Status ;
1465
- }
1466
-
1467
- /* Check if the driver returned success */
1468
- if (NT_SUCCESS (Status ))
1469
- {
1470
- /* Get the number of sectors */
1471
- * RealSectorCount = (PartitionInfo .PartitionLength .QuadPart /
1472
- Geometry -> BytesPerSector );
1473
- }
1474
- }
1475
-
1476
1433
/* Free the event and return the Status */
1477
1434
ExFreePoolWithTag (Event , TAG_FILE_SYSTEM );
1478
1435
return Status ;
@@ -1823,9 +1780,8 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
1823
1780
ULONG BufferSize = 2048 , InputSize ;
1824
1781
PDRIVE_LAYOUT_INFORMATION DriveLayoutInfo = NULL ;
1825
1782
LONG j = -1 , i = -1 , k ;
1826
- DISK_GEOMETRY DiskGeometry ;
1783
+ DISK_GEOMETRY_EX DiskGeometryEx ;
1827
1784
LONGLONG EndSector , MaxSector , StartOffset ;
1828
- ULONGLONG MaxOffset ;
1829
1785
LARGE_INTEGER Offset , VolumeOffset ;
1830
1786
BOOLEAN IsPrimary = TRUE, IsEzDrive = FALSE, MbrFound = FALSE;
1831
1787
BOOLEAN IsValid , IsEmpty = TRUE;
@@ -1856,7 +1812,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
1856
1812
}
1857
1813
1858
1814
/* Get drive geometry */
1859
- Status = HalpGetFullGeometry (DeviceObject , & DiskGeometry , & MaxOffset );
1815
+ Status = HalpGetFullGeometry (DeviceObject , & DiskGeometryEx );
1860
1816
if (!NT_SUCCESS (Status ))
1861
1817
{
1862
1818
ExFreePoolWithTag (* PartitionBuffer , TAG_FILE_SYSTEM );
@@ -1865,10 +1821,10 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
1865
1821
}
1866
1822
1867
1823
/* Get the end and maximum sector */
1868
- EndSector = MaxOffset ;
1869
- MaxSector = MaxOffset << 1 ;
1870
- DPRINT ("FSTUB: MaxOffset = %#I64x, MaxSector = %#I64x\n" ,
1871
- MaxOffset , MaxSector );
1824
+ EndSector = DiskGeometryEx . DiskSize . QuadPart / DiskGeometryEx . Geometry . BytesPerSector ;
1825
+ MaxSector = EndSector << 1 ;
1826
+ DPRINT ("FSTUB: DiskSize = %#I64x, MaxSector = %#I64x\n" ,
1827
+ DiskGeometryEx . DiskSize , MaxSector );
1872
1828
1873
1829
/* Allocate our buffer */
1874
1830
Buffer = ExAllocatePoolWithTag (NonPagedPool , InputSize , TAG_FILE_SYSTEM );
@@ -1970,13 +1926,12 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
1970
1926
if (PartitionType == EFI_PMBR_OSTYPE_EFI )
1971
1927
{
1972
1928
/* Partition length might be bigger than disk size */
1973
- FstubFixupEfiPartition (PartitionDescriptor ,
1974
- MaxOffset );
1929
+ FstubFixupEfiPartition (PartitionDescriptor , DiskGeometryEx .DiskSize .QuadPart );
1975
1930
}
1976
1931
1977
1932
/* Make sure that the partition is valid, unless it's the first */
1978
1933
if (!(HalpIsValidPartitionEntry (PartitionDescriptor ,
1979
- MaxOffset ,
1934
+ DiskGeometryEx . DiskSize . QuadPart ,
1980
1935
MaxSector )) && (j == 0 ))
1981
1936
{
1982
1937
/* It's invalid, so fail */
@@ -2158,7 +2113,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
2158
2113
} while (Offset .HighPart | Offset .LowPart );
2159
2114
2160
2115
/* Check if this is a removable device that's probably a super-floppy */
2161
- if ((DiskGeometry .MediaType == RemovableMedia ) &&
2116
+ if ((DiskGeometryEx . Geometry .MediaType == RemovableMedia ) &&
2162
2117
(j == 0 ) && (MbrFound ) && (IsEmpty ))
2163
2118
{
2164
2119
PBOOT_SECTOR_INFO BootSectorInfo = (PBOOT_SECTOR_INFO )Buffer ;
@@ -2179,15 +2134,15 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
2179
2134
if (j == -1 )
2180
2135
{
2181
2136
/* The likely cause is the super floppy detection above */
2182
- if ((MbrFound ) || (DiskGeometry .MediaType == RemovableMedia ))
2137
+ if ((MbrFound ) || (DiskGeometryEx . Geometry .MediaType == RemovableMedia ))
2183
2138
{
2184
2139
/* Print out debugging information */
2185
2140
DPRINT1 ("FSTUB: Drive %#p has no valid MBR. Make it into a "
2186
2141
"super-floppy\n" ,
2187
2142
DeviceObject );
2188
2143
DPRINT1 ("FSTUB: Drive has %I64d sectors and is %#016I64x "
2189
2144
"bytes large\n" ,
2190
- EndSector , EndSector * DiskGeometry . BytesPerSector );
2145
+ EndSector , DiskGeometryEx . DiskSize );
2191
2146
2192
2147
/* We should at least have some sectors */
2193
2148
if (EndSector > 0 )
@@ -2202,9 +2157,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
2202
2157
PartitionInfo -> BootIndicator = FALSE;
2203
2158
PartitionInfo -> HiddenSectors = 0 ;
2204
2159
PartitionInfo -> StartingOffset .QuadPart = 0 ;
2205
- PartitionInfo -> PartitionLength .QuadPart = (EndSector *
2206
- DiskGeometry .
2207
- BytesPerSector );
2160
+ PartitionInfo -> PartitionLength = DiskGeometryEx .DiskSize ;
2208
2161
2209
2162
/* FIXME: REACTOS HACK */
2210
2163
PartitionInfo -> PartitionNumber = 0 ;
0 commit comments