[USBSTOR][SCSIPORT] Use STORAGE_ADAPTER_DESCRIPTOR from WIN8

This way, these drivers are more compatible with classpnp and cdrom used
by ReactOS (and don't fire asserts)
This commit is contained in:
Victor Perevertkin 2020-12-06 01:57:56 +03:00
parent 139e8f5308
commit cbe88e287f
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
4 changed files with 63 additions and 27 deletions

View file

@ -335,7 +335,7 @@ FdoHandleQueryProperty(
goto completeIrp;
}
if (ioStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR))
if (ioStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8))
{
// buffer too small
PSTORAGE_DESCRIPTOR_HEADER DescriptorHeader = Irp->AssociatedIrp.SystemBuffer;
@ -343,8 +343,8 @@ FdoHandleQueryProperty(
>= sizeof(STORAGE_DESCRIPTOR_HEADER));
// return required size
DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
DescriptorHeader->Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
DescriptorHeader->Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
Irp->IoStatus.Information = sizeof(STORAGE_DESCRIPTOR_HEADER);
status = STATUS_SUCCESS;
@ -352,14 +352,14 @@ FdoHandleQueryProperty(
}
// get adapter descriptor, information is returned in the same buffer
PSTORAGE_ADAPTER_DESCRIPTOR adapterDescriptor = Irp->AssociatedIrp.SystemBuffer;
PSTORAGE_ADAPTER_DESCRIPTOR_WIN8 adapterDescriptor = Irp->AssociatedIrp.SystemBuffer;
// fill out descriptor
// NOTE: STORAGE_ADAPTER_DESCRIPTOR may vary in size, so it's important to zero out
// NOTE: STORAGE_ADAPTER_DESCRIPTOR_WIN8 may vary in size, so it's important to zero out
// all unused fields
*adapterDescriptor = (STORAGE_ADAPTER_DESCRIPTOR) {
.Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR),
.Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR),
*adapterDescriptor = (STORAGE_ADAPTER_DESCRIPTOR_WIN8) {
.Version = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8),
.Size = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8),
.MaximumTransferLength = portExt->PortCapabilities.MaximumTransferLength,
.MaximumPhysicalPages = portExt->PortCapabilities.MaximumPhysicalPages,
.AlignmentMask = portExt->PortCapabilities.AlignmentMask,
@ -373,7 +373,7 @@ FdoHandleQueryProperty(
};
// store returned length
Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR);
Irp->IoStatus.Information = sizeof(STORAGE_ADAPTER_DESCRIPTOR_WIN8);
status = STATUS_SUCCESS;
completeIrp:

View file

@ -50,6 +50,23 @@
#define LUNEX_REQUEST_PENDING 0x0020
#define SCSI_PORT_SCAN_IN_PROGRESS 0x8000
// we need this to be compatible with ReactOS' classpnp (which is compiled with NTDDI_WIN8)
typedef struct _STORAGE_ADAPTER_DESCRIPTOR_WIN8 {
ULONG Version;
ULONG Size;
ULONG MaximumTransferLength;
ULONG MaximumPhysicalPages;
ULONG AlignmentMask;
BOOLEAN AdapterUsesPio;
BOOLEAN AdapterScansDown;
BOOLEAN CommandQueueing;
BOOLEAN AcceleratedTransfer;
UCHAR BusType;
USHORT BusMajorVersion;
USHORT BusMinorVersion;
UCHAR SrbType;
UCHAR AddressType;
} STORAGE_ADAPTER_DESCRIPTOR_WIN8, *PSTORAGE_ADAPTER_DESCRIPTOR_WIN8;
typedef enum _SCSI_PORT_TIMER_STATES
{