Allows programs which demand support for StorageDeviceSeekPenaltyProperty to function.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51065 Signed-off-by: David Koolhoven david@koolhoven-home.net --- v6: Padding was noticed, this ensures padding is consistent. --- dlls/mountmgr.sys/device.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 04e8fe3c0f5..8e18ed7ff22 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -1894,6 +1894,23 @@ static NTSTATUS query_property( struct disk_device *device, IRP *irp )
break; } + case StorageDeviceSeekPenaltyProperty: + { + DEVICE_SEEK_PENALTY_DESCRIPTOR *descriptor; + FIXME( "Faking StorageDeviceSeekPenaltyProperty data with no penalty\n" ); + if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(DEVICE_SEEK_PENALTY_DESCRIPTOR)) { + status = STATUS_INVALID_PARAMETER; + break; + } + memset( irp->AssociatedIrp.SystemBuffer, 0, sizeof(DEVICE_SEEK_PENALTY_DESCRIPTOR) ); + descriptor = irp->AssociatedIrp.SystemBuffer; + descriptor->Version = sizeof(DEVICE_SEEK_PENALTY_DESCRIPTOR); + descriptor->Size = sizeof(DEVICE_SEEK_PENALTY_DESCRIPTOR); + descriptor->IncursSeekPenalty = FALSE; + status = STATUS_SUCCESS; + irp->IoStatus.Information = sizeof(DEVICE_SEEK_PENALTY_DESCRIPTOR); + break; + } default: FIXME( "Unsupported property %#x\n", query->PropertyId ); status = STATUS_NOT_SUPPORTED;
Helps test for compatibility with SeekPenaltyQueryProperty.
Signed-off-by: David Koolhoven david@koolhoven-home.net --- dlls/kernel32/tests/volume.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index ed3897a6b94..019f764019c 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -654,6 +654,40 @@ static void test_disk_query_property(void) CloseHandle(handle); }
+static void test_disk_query_seek_penalty_property(void) +{ + STORAGE_PROPERTY_QUERY query = {0}; + DEVICE_SEEK_PENALTY_DESCRIPTOR descriptor = {0}; + HANDLE handle; + DWORD error; + DWORD size; + BOOL ret; + + handle = CreateFileA("\\.\PhysicalDrive0", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + 0, 0); + if (handle == INVALID_HANDLE_VALUE) + { + win_skip("can't open \\.\PhysicalDrive0 %#x\n", GetLastError()); + return; + } + + query.PropertyId = (STORAGE_PROPERTY_ID)StorageDeviceSeekPenaltyProperty; + query.QueryType = PropertyStandardQuery; + + SetLastError(0xdeadbeef); + ret = DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY, &query, sizeof(query), &descriptor, sizeof(descriptor), + &size, NULL); + error = GetLastError(); + /* Only should complete on Win7 and Win10 */ + ok((ret) || (ret == ERROR_NOT_SUPPORTED), "expect ret %#x, got %#x\n", TRUE, ret); + ok((error == 0xdeadbeef) || (error == ERROR_NOT_SUPPORTED), "expect err %#x, got err %#x\n", 0xdeadbeef, error); + ok(size == sizeof(descriptor), "got size %d\n", size); + ok(descriptor.Version == sizeof(descriptor), "got descriptor.Version %d\n", descriptor.Version); + ok(descriptor.Size >= sizeof(descriptor), "got descriptor.Size %d\n", descriptor.Size); + + CloseHandle(handle); +} + static void test_GetVolumePathNameA(void) { char volume_path[MAX_PATH], cwd[MAX_PATH], expect_path[MAX_PATH]; @@ -1645,6 +1679,7 @@ START_TEST(volume) test_enum_vols(); test_disk_extents(); test_disk_query_property(); + test_disk_query_seek_penalty_property(); test_GetVolumePathNamesForVolumeNameA(); test_GetVolumePathNamesForVolumeNameW(); test_cdrom_ioctl();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91123
Your paranoid android.
=== build (build log) ===
../wine/dlls/kernel32/tests/volume.c:660:5: error: unknown type name ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ ../wine/dlls/kernel32/tests/volume.c:674:45: error: ‘StorageDeviceSeekPenaltyProperty’ undeclared (first use in this function) ../wine/dlls/kernel32/tests/volume.c:685:18: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:685:91: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:686:18: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:686:85: error: request for member ‘Size’ in something not a structure or union Makefile:83936: recipe for target 'dlls/kernel32/tests/volume.cross.o' failed Task: The exe32 Wine build failed
=== debiant2 (build log) ===
../wine/dlls/kernel32/tests/volume.c:660:5: error: unknown type name ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ ../wine/dlls/kernel32/tests/volume.c:674:45: error: ‘StorageDeviceSeekPenaltyProperty’ undeclared (first use in this function); did you mean ‘StorageDeviceProperty’? ../wine/dlls/kernel32/tests/volume.c:685:18: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:685:91: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:686:18: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:686:85: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1897:10: error: ‘StorageDeviceSeekPenaltyProperty’ undeclared (first use in this function); did you mean ‘StorageDeviceProperty’? ../wine/dlls/mountmgr.sys/device.c:1899:9: error: unknown type name ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ ../wine/dlls/mountmgr.sys/device.c:1901:75: error: ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ undeclared (first use in this function) ../wine/dlls/mountmgr.sys/device.c:1907:19: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1908:19: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1909:19: error: request for member ‘IncursSeekPenalty’ in something not a structure or union Task: The win32 Wine build failed
=== debiant2 (build log) ===
../wine/dlls/kernel32/tests/volume.c:660:5: error: unknown type name ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ ../wine/dlls/kernel32/tests/volume.c:674:45: error: ‘StorageDeviceSeekPenaltyProperty’ undeclared (first use in this function); did you mean ‘StorageDeviceProperty’? ../wine/dlls/kernel32/tests/volume.c:685:18: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:685:91: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:686:18: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/kernel32/tests/volume.c:686:85: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1897:10: error: ‘StorageDeviceSeekPenaltyProperty’ undeclared (first use in this function); did you mean ‘StorageDeviceProperty’? ../wine/dlls/mountmgr.sys/device.c:1899:9: error: unknown type name ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ ../wine/dlls/mountmgr.sys/device.c:1901:75: error: ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ undeclared (first use in this function) ../wine/dlls/mountmgr.sys/device.c:1907:19: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1908:19: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1909:19: error: request for member ‘IncursSeekPenalty’ in something not a structure or union Task: The wow64 Wine build failed
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91122
Your paranoid android.
=== debiant2 (build log) ===
../wine/dlls/mountmgr.sys/device.c:1897:10: error: ‘StorageDeviceSeekPenaltyProperty’ undeclared (first use in this function); did you mean ‘StorageDeviceProperty’? ../wine/dlls/mountmgr.sys/device.c:1899:9: error: unknown type name ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ ../wine/dlls/mountmgr.sys/device.c:1901:75: error: ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ undeclared (first use in this function) ../wine/dlls/mountmgr.sys/device.c:1907:19: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1908:19: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1909:19: error: request for member ‘IncursSeekPenalty’ in something not a structure or union Task: The win32 Wine build failed
=== debiant2 (build log) ===
../wine/dlls/mountmgr.sys/device.c:1897:10: error: ‘StorageDeviceSeekPenaltyProperty’ undeclared (first use in this function); did you mean ‘StorageDeviceProperty’? ../wine/dlls/mountmgr.sys/device.c:1899:9: error: unknown type name ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ ../wine/dlls/mountmgr.sys/device.c:1901:75: error: ‘DEVICE_SEEK_PENALTY_DESCRIPTOR’ undeclared (first use in this function) ../wine/dlls/mountmgr.sys/device.c:1907:19: error: request for member ‘Version’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1908:19: error: request for member ‘Size’ in something not a structure or union ../wine/dlls/mountmgr.sys/device.c:1909:19: error: request for member ‘IncursSeekPenalty’ in something not a structure or union Task: The wow64 Wine build failed