From 2e610aa9df3f289624ec9f01c765dcf3eb958b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 14 Jul 2024 18:43:55 +0200 Subject: [PATCH] [NTOS:FSTUB/IO] Unhardcode some values --- ntoskrnl/fstub/disksup.c | 4 ++-- ntoskrnl/fstub/fstubex.c | 2 +- ntoskrnl/io/iomgr/arcname.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ntoskrnl/fstub/disksup.c b/ntoskrnl/fstub/disksup.c index 7aaa79d3b23..ae3b7a2bfe8 100644 --- a/ntoskrnl/fstub/disksup.c +++ b/ntoskrnl/fstub/disksup.c @@ -278,8 +278,8 @@ HalpQueryPartitionType( return STATUS_SUCCESS; } - /* Now, evaluate the partition to the 4 in the input layout */ - for (i = 0; i < 4; ++i) + /* Now, evaluate the partition to those in the input layout */ + for (i = 0; i < NUM_PARTITION_TABLE_ENTRIES; ++i) { /* If we find a partition matching */ if (LayoutInfo->PartitionEntry[i].StartingOffset.QuadPart == PartitionInfo.StartingOffset.QuadPart) diff --git a/ntoskrnl/fstub/fstubex.c b/ntoskrnl/fstub/fstubex.c index b8cfed6814b..f83cf29d227 100644 --- a/ntoskrnl/fstub/fstubex.c +++ b/ntoskrnl/fstub/fstubex.c @@ -564,7 +564,7 @@ FstubDbgPrintDriveLayoutEx(IN PDRIVE_LAYOUT_INFORMATION_EX DriveLayout) switch (DriveLayout->PartitionStyle) { case PARTITION_STYLE_MBR: - if (DriveLayout->PartitionCount % 4 != 0) + if (DriveLayout->PartitionCount % NUM_PARTITION_TABLE_ENTRIES != 0) { DPRINT("Warning: Partition count isn't a 4-factor: %lu!\n", DriveLayout->PartitionCount); } diff --git a/ntoskrnl/io/iomgr/arcname.c b/ntoskrnl/io/iomgr/arcname.c index 6029e2ea017..ee9237aef4d 100644 --- a/ntoskrnl/io/iomgr/arcname.c +++ b/ntoskrnl/io/iomgr/arcname.c @@ -628,7 +628,7 @@ IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock, /* Check MBR type against EZ Drive type */ StartingOffset.QuadPart = 0; - HalExamineMBR(DeviceObject, DiskGeometry.BytesPerSector, 0x55, &Data); + HalExamineMBR(DeviceObject, DiskGeometry.BytesPerSector, PARTITION_EZDRIVE, &Data); if (Data) { /* If MBR is of the EZ Drive type, we'll read after it */