https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eb682bbfab56566a5cff6f...
commit eb682bbfab56566a5cff6f95265544b17c4f2562 Author: Victor Perevertkin victor.perevertkin@reactos.org AuthorDate: Sat Dec 5 19:19:25 2020 +0300 Commit: Victor Perevertkin victor.perevertkin@reactos.org CommitDate: Sat Dec 5 22:14:50 2020 +0300
[DISK_NEW] Various small fixes
- Silence a (possibly wrong) assert in DiskShutdownFlush - Fix build with GCC and MSVC amd64
CORE-17129 --- drivers/storage/class/disk_new/disk.c | 8 ++++++-- drivers/storage/class/disk_new/pnp.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/storage/class/disk_new/disk.c b/drivers/storage/class/disk_new/disk.c index 29259da6dba..3aee7640418 100644 --- a/drivers/storage/class/disk_new/disk.c +++ b/drivers/storage/class/disk_new/disk.c @@ -1258,7 +1258,11 @@ Return Value: InsertTailList(&diskData->FlushContext.CurrList, listEntry); }
+#ifndef __REACTOS__ + // ReactOS hits this assert, because CurrIrp can already be freed at this point + // and it's possible that NextIrp has the same pointer value NT_ASSERT(diskData->FlushContext.CurrIrp != diskData->FlushContext.NextIrp); +#endif diskData->FlushContext.CurrIrp = diskData->FlushContext.NextIrp; diskData->FlushContext.NextIrp = NULL;
@@ -1678,7 +1682,7 @@ Return Value: irpSp->MajorFunction = IRP_MJ_SCSI; irpSp->Parameters.Scsi.Srb = srb;
- IoSetCompletionRoutine(FlushContext->CurrIrp, DiskFlushComplete, (PVOID)SyncCacheStatus, TRUE, TRUE, TRUE); + IoSetCompletionRoutine(FlushContext->CurrIrp, DiskFlushComplete, (PVOID)(ULONG_PTR)SyncCacheStatus, TRUE, TRUE, TRUE);
TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_SCSI, "DiskFlushDispatch: sending srb flush on irp %p\n", FlushContext->CurrIrp));
@@ -1728,7 +1732,7 @@ Return Value: #ifdef _MSC_VER #pragma warning(suppress:4311) // pointer truncation from 'PVOID' to 'NTSTATUS' #endif - NTSTATUS SyncCacheStatus = (NTSTATUS) Context; + NTSTATUS SyncCacheStatus = (NTSTATUS)(ULONG_PTR)Context;
TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, "DiskFlushComplete: %p %p\n", Fdo, Irp));
diff --git a/drivers/storage/class/disk_new/pnp.c b/drivers/storage/class/disk_new/pnp.c index 2023a00abb2..f124d96be85 100644 --- a/drivers/storage/class/disk_new/pnp.c +++ b/drivers/storage/class/disk_new/pnp.c @@ -132,7 +132,9 @@ Return Value: queryTable[0].EntryContext = &(rootPartitionMountable); queryTable[0].DefaultType = (REG_DWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_NONE;
+#ifdef _MSC_VER #pragma prefast(suppress:6309, "We don't have QueryRoutine so Context doesn't make any sense") +#endif status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, diskKey, queryTable,