From 96eb96dfb613e4c745db6bd1f53a92fe7e2290fc Mon Sep 17 00:00:00 2001 From: karlf Date: Thu, 11 Aug 2016 13:28:13 -0700 Subject: Updated for "Windows 10 Anniversary Update" (Version 1607) --- storage/class/disk/src/disk.c | 21 ++++++++++++++++----- storage/class/disk/src/disk.vcxproj | 4 ++-- storage/class/disk/src/disk.vcxproj.Filters | 8 ++++---- storage/class/disk/src/geometry.c | 4 ++-- storage/class/disk/src/pnp.c | 3 ++- 5 files changed, 26 insertions(+), 14 deletions(-) (limited to 'storage/class/disk/src') diff --git a/storage/class/disk/src/disk.c b/storage/class/disk/src/disk.c index 3d4d19b4..05f0d6d3 100644 --- a/storage/class/disk/src/disk.c +++ b/storage/class/disk/src/disk.c @@ -1550,6 +1550,7 @@ Return Value: PIO_STACK_LOCATION irpSp = NULL; PSTOR_ADDR_BTL8 storAddrBtl8; PSRBEX_DATA_SCSI_CDB16 srbExDataCdb16; + NTSTATUS SyncCacheStatus = STATUS_SUCCESS; // // Fill in the srb fields appropriately @@ -1623,7 +1624,7 @@ Return Value: TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_SCSI, "DiskFlushDispatch: sending sync cache\n")); - ClassSendSrbSynchronous(Fdo, srb, NULL, 0, TRUE); + SyncCacheStatus = ClassSendSrbSynchronous(Fdo, srb, NULL, 0, TRUE); } // @@ -1669,7 +1670,7 @@ Return Value: irpSp->MajorFunction = IRP_MJ_SCSI; irpSp->Parameters.Scsi.Srb = srb; - IoSetCompletionRoutine(FlushContext->CurrIrp, DiskFlushComplete, NULL, TRUE, TRUE, TRUE); + IoSetCompletionRoutine(FlushContext->CurrIrp, DiskFlushComplete, (PVOID)SyncCacheStatus, TRUE, TRUE, TRUE); TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_SCSI, "DiskFlushDispatch: sending srb flush on irp %p\n", FlushContext->CurrIrp)); @@ -1700,7 +1701,9 @@ Arguments: Fdo - The device object which requested the completion routine Irp - The irp that is being completed - Context - The flush group context + Context - If disk had write cache enabled and SYNC CACHE command was sent as 1st part of FLUSH processing + then context must carry the completion status of SYNC CACHE request, + else context must be set to STATUS_SUCCESS. Return Value: @@ -1713,8 +1716,7 @@ Return Value: NTSTATUS status; PFUNCTIONAL_DEVICE_EXTENSION fdoExt; PDISK_DATA diskData; - - UNREFERENCED_PARAMETER(Context); + NTSTATUS SyncCacheStatus = (NTSTATUS) Context; TracePrint((TRACE_LEVEL_VERBOSE, TRACE_FLAG_GENERAL, "DiskFlushComplete: %p %p\n", Fdo, Irp)); @@ -1741,6 +1743,15 @@ Return Value: // NT_ASSERT(status != STATUS_MORE_PROCESSING_REQUIRED); + // + // If sync cache failed earlier, final status of the flush request needs to be failure + // even if SRB_FUNCTION_FLUSH srb request succeeded + // + if (NT_SUCCESS(status) && + (!NT_SUCCESS(SyncCacheStatus))) { + Irp->IoStatus.Status = status = SyncCacheStatus; + } + // // Complete the flush requests tagged to this one // diff --git a/storage/class/disk/src/disk.vcxproj b/storage/class/disk/src/disk.vcxproj index 1f52e370..bc5efddb 100644 --- a/storage/class/disk/src/disk.vcxproj +++ b/storage/class/disk/src/disk.vcxproj @@ -19,12 +19,12 @@ - {0900F953-9DAF-4C58-9137-45A2DEC9C62C} + {C4E8B1CC-0131-442C-8EB8-8E84F938878A} $(MSBuildProjectName) false Debug Win32 - {6222553B-2B65-4267-9522-973010FB316D} + {1257A10C-96B8-46FB-9FFD-6726981343C7} diff --git a/storage/class/disk/src/disk.vcxproj.Filters b/storage/class/disk/src/disk.vcxproj.Filters index 1a2af052..5c982e78 100644 --- a/storage/class/disk/src/disk.vcxproj.Filters +++ b/storage/class/disk/src/disk.vcxproj.Filters @@ -3,19 +3,19 @@ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;* - {9D58AF57-E3D3-492B-A93C-CD4BD860C101} + {5312DB94-F2AD-4908-9DC6-C3525D0469E6} h;hpp;hxx;hm;inl;inc;xsd - {5021C225-A54E-4A00-A24F-A0AEC3B6B92A} + {1EA3AD8C-6E4B-4964-A3D1-62178CDEC868} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml - {2092A6B9-C332-464C-B263-00060DE1B3E0} + {2A5B4A49-7B7B-4C84-9F4D-4B3B50FFA526} inf;inv;inx;mof;mc; - {2F3C9ECA-BD6F-472C-915B-51096E28B70C} + {48E85F2C-8024-453C-8D4D-AFA7E6BB0AB7} diff --git a/storage/class/disk/src/geometry.c b/storage/class/disk/src/geometry.c index 911a33a4..a852c092 100644 --- a/storage/class/disk/src/geometry.c +++ b/storage/class/disk/src/geometry.c @@ -1358,8 +1358,8 @@ Return Value: // ISSUE-2000/5/24-henrygab - figure out if there's a way to keep // removals from happening while doing this. // - - for(deviceObject = DriverObject->DeviceObject, unmatchedDiskCount = 0; + unmatchedDiskCount = 0; + for(deviceObject = DriverObject->DeviceObject; deviceObject != NULL; #pragma prefast(suppress:28175, "Need to access the opaque field to scan through the list of disks") deviceObject = deviceObject->NextDevice) { diff --git a/storage/class/disk/src/pnp.c b/storage/class/disk/src/pnp.c index bb3a33c5..5eb333e7 100644 --- a/storage/class/disk/src/pnp.c +++ b/storage/class/disk/src/pnp.c @@ -122,9 +122,10 @@ Return Value: LEAVE; } - queryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + queryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_TYPECHECK; queryTable[0].Name = L"RootPartitionMountable"; queryTable[0].EntryContext = &(rootPartitionMountable); + queryTable[0].DefaultType = (REG_DWORD << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT) | REG_NONE; #pragma prefast(suppress:6309, "We don't have QueryRoutine so Context doesn't make any sense") status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, -- cgit v1.3.1