https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a56a2e95a2f7d3ced5d210...
commit a56a2e95a2f7d3ced5d210acbe3385aa145fb785 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Wed Jan 2 20:28:21 2019 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Feb 10 22:39:12 2019 +0100
[DISK.SYS] Add a HACK so that we can use NT5+ NTOS functions with this NT4 driver for removable devices.
This is needed in order to avoid an infinite recursive loop between disk!UpdateRemovableGeometry() and ntos!IoReadPartitionTable(). This does not happen with NT5+ disk_new.sys because it doesn't call IoReadPartitionTable() in that situation. --- drivers/storage/class/disk/disk.c | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
diff --git a/drivers/storage/class/disk/disk.c b/drivers/storage/class/disk/disk.c index cb84565691..b91e88e04d 100644 --- a/drivers/storage/class/disk/disk.c +++ b/drivers/storage/class/disk/disk.c @@ -116,6 +116,15 @@ typedef struct _DISK_DATA {
PARTITION_LIST_STATE PartitionListState;
+#ifdef __REACTOS__ + // + // HACK so that we can use NT5+ NTOS functions with this NT4 driver + // for removable devices and avoid an infinite recursive loop between + // disk!UpdateRemovableGeometry() and ntos!IoReadPartitionTable(). + // + ULONG UpdateRemovableGeometryCount; +#endif + } DISK_DATA, *PDISK_DATA;
// @@ -1147,6 +1156,15 @@ CreatePartitionDeviceObjects(
}
+#ifdef __REACTOS__ + // + // HACK so that we can use NT5+ NTOS functions with this NT4 driver + // for removable devices and avoid an infinite recursive loop between + // disk!UpdateRemovableGeometry() and ntos!IoReadPartitionTable(). + // + diskData->UpdateRemovableGeometryCount = 0; +#endif + // // Create objects for all the partitions on the device. // @@ -4456,6 +4474,21 @@ Return Value: return(status); }
+#ifdef __REACTOS__ + // + // HACK so that we can use NT5+ NTOS functions with this NT4 driver + // for removable devices and avoid an infinite recursive loop between + // disk!UpdateRemovableGeometry() and ntos!IoReadPartitionTable(). + // + // Check whether the update-count is greater or equal than one + // (and increase it) and if so, reset it and return success. + if (diskData->UpdateRemovableGeometryCount++ >= 1) + { + diskData->UpdateRemovableGeometryCount = 0; + return(STATUS_SUCCESS); + } +#endif + // // Read the partition table again. // @@ -4465,6 +4498,15 @@ Return Value: TRUE, &partitionList);
+#ifdef __REACTOS__ + // + // HACK so that we can use NT5+ NTOS functions with this NT4 driver + // for removable devices and avoid an infinite recursive loop between + // disk!UpdateRemovableGeometry() and ntos!IoReadPartitionTable(). + // + // Inconditionally reset the update-count. + diskData->UpdateRemovableGeometryCount = 0; +#endif
if (!NT_SUCCESS(status)) {