[PATCH v4] mountmgr.sys: Introduce StorageDeviceSeekPenaltyProperty

Zebediah Figura (she/her) zfigura at codeweavers.com
Sat May 15 12:19:26 CDT 2021


On 5/3/21 12:10 PM, David Koolhoven wrote:
> 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 at koolhoven-home.net>
> ---
> v4: Spoof there is no penalty. Add detection later.
> ---
>   dlls/mountmgr.sys/device.c | 13 +++++++++++++
>   include/ntddstor.h         |  9 ++++++++-
>   2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
> index 04e8fe3c0f5..2ba82537728 100644
> --- a/dlls/mountmgr.sys/device.c
> +++ b/dlls/mountmgr.sys/device.c
> @@ -1894,6 +1894,19 @@ 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" );
> +        memset( irp->AssociatedIrp.SystemBuffer, 0, irpsp->Parameters.DeviceIoControl.OutputBufferLength );

Should it be OutputBufferLength or sizeof(DEVICE_SEEK_PENALTY_DESCRIPTOR)?

> +        descriptor = irp->AssociatedIrp.SystemBuffer;
> +        descriptor->Version = sizeof(DEVICE_SEEK_PENALTY_DESCRIPTOR);

This statement looks wrong; if it's really correct it'd be nice to see 
tests. (That would probably be nice anyway. kernel32:volume would 
probably be a reasonable place for them.)

> +        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;
> diff --git a/include/ntddstor.h b/include/ntddstor.h
> index b8c4bb73b0d..836def413fe 100644
> --- a/include/ntddstor.h
> +++ b/include/ntddstor.h
> @@ -214,7 +214,8 @@ typedef enum _STORAGE_QUERY_TYPE {
>   
>   typedef enum _STORAGE_PROPERTY_ID {
>       StorageDeviceProperty = 0,
> -    StorageAdapterProperty
> +    StorageAdapterProperty = 1,
> +    StorageDeviceSeekPenaltyProperty = 7,
>   } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
>   
>   typedef struct _STORAGE_PROPERTY_QUERY {
> @@ -272,6 +273,12 @@ typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
>       USHORT                      BusMinorVersion;
>   } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
>   
> +typedef struct _DEVICE_SEEK_PENALTY_DESCRIPTOR {
> +    ULONG                       Version;
> +    ULONG                       Size;
> +    BOOLEAN                     IncursSeekPenalty;
> +} DEVICE_SEEK_PENALTY_DESCRIPTOR, *PDEVICE_SEEK_PENALTY_DESCRIPTOR;
> +
>   #ifdef __cplusplus
>   }
>   #endif
> 



More information about the wine-devel mailing list