The stream class driver uses the HW_STREAM_REQUEST_BLOCK structure to pass information to and from the minidriver, using minidriver provided callbacks.
typedef struct _HW_STREAM_REQUEST_BLOCK {
ULONG SizeOfThisPacket;
SRB_COMMAND Command;
NTSTATUS Status;
PHW_STREAM_OBJECT StreamObject;
PVOID HwDeviceExtension;
PVOID SRBExtension;
union _CommandData {
PKSSTREAM_HEADER DataBufferArray;
PHW_STREAM_DESCRIPTOR StreamBuffer;
KSSTATE StreamState;
PSTREAM_PROPERTY_DESCRIPTOR PropertyInfo;
PKSDATAFORMAT OpenFormat;
struct _PORT_CONFIGURATION_INFORMATION *ConfigInfo;
HANDLE MasterClockHandle;
DEVICE_POWER_STATE DeviceState;
PSTREAM_DATA_INTERSECT_INFO IntersectInfo;
} CommandData;
ULONG NumberOfBuffers;
ULONG TimeoutCounter;
ULONG TimeoutOriginal;
struct _HW_STREAM_REQUEST_BLOCK *NextSRB;
PIRP Irp;
ULONG Flags;
PVOID HwInstanceExtension;
union {
ULONG NumberOfBytesToTransfer;
ULONG ActualBytesTransferred;
};
PKSSCATTER_GATHER ScatterGatherBuffer
ULONG NumberOfPhysicalPages;
ULONG Reserved[2];
} HW_STREAM_REQUEST_BLOCK, *PHW_STREAM_REQUEST_BLOCK;
| Member | Command code | Description |
|---|---|---|
| DataBufferArray | SRB_READ_DATA | Pointer to an array of KSSTREAM_HEADER structures. The number of entries in this array is specified in NumberOfBuffers. Each KSSTREAM_HEADER describes one block of data. |
| StreamBuffer | SRB_GET_STREAM_INFO | Points to the HW_STREAM_DESCRIPTOR structure the minidriver fills in with a description of the kernel streaming semantics it supports.
The minidriver specifies the size of this buffer in the StreamDescriptorSize member of its PORT_CONFIGURATION_INFORMATION structure. |
| StreamState | SRB_GET_STREAM_STATE | The stream state. See KSPROPERTY_CONNECTION_STATE for details. |
| PropertyInfo | SRB_GET_DEVICE_PROPERTY | Points to the STREAM_PROPERTY_DESCRIPTOR structure that specifies the parameters for the property get or set operation. |
| OpenFormat | SRB_OPEN_STREAM | Pointer to the KSDATAFORMAT structure that specifies the format. |
| ConfigInfo | SRB_INITIALIZE_DEVICE | Pointer to the PORT_CONFIGURATION_INFORMATION structure used to initialize the device |
| MasterClockHandle | SRB_OPEN_MASTER_CLOCK | Handle for the clock object that now serves as the master clock. |
| DeviceState | SRB_CHANGE_POWER_STATE | Specifies the new power state. |
| IntersectInfo | SRB_GET_DATA_INTERSECTION | Pointer to a STREAM_DATA_INTERSECT_INFO structure that describes the parameters of this operation. |
| Value | Callback used |
|---|---|
| None | StrMiniReceiveDevicePacket |
| SRB_HW_FLAGS_STREAM_REQUEST | StrMiniReceiveStreamControlPacket |
| SRB_HW_FLAGS_DATA_TRANSFER | SRB_HW_FLAGS_STREAM_REQUEST | StrMiniReceiveStreamDataPacket |
SRB_HW_FLAGS_STREAM_REQUEST bit is set for stream-specific requests (which are passed to the minidriver's StrMiniReceiveStreamXxxPacket routines). The SRB_HW_FLAGS_DATA_TRANSFER bit is set for data transfer requests (which are passed to the minidriver's
typedef struct {
PHYSICAL_ADDRESS PhysicalAddress;
ULONG Length;
} KSSCATTER_GATHER, *PKSSCATTER_GATHER;
The array describes a scatter/gather list that can be used by the minidriver to do DMA. The memory does not need to be probed, locked, mapped, or flushed — the stream class driver performs these for the minidriver.
Declared in strmini.h. Include strmini.h.
The stream class driver passes pointers to HW_STREAM_REQUEST_BLOCK structures to the minidriver's StrMiniReceiveStreamDataPacket, StrMiniReceiveStreamControlPacket, and StrMiniReceiveDevicePacket routines.
The minidriver owns this stream request block until the request times out or it completes the request. The minidriver signals to the class driver that it has completed the request by calling StreamClassDeviceNotification(DeviceRequestComplete, pSrb->HwDeviceExtension, pSRB) for device-specific requests, or calling StreamClassStreamNotification(StreamRequestComplete, pSrb->StreamObject, pSrb) for stream-specific requests. (The minidriver can also complete a request by calling StreamClassCompleteRequestAndMarkQueueReady(pSrb). See that routine for details.)
If the class driver times out the request, it will call the minidriver's StrMiniRequestTimeout routine, which has the responsibility of terminating processing of the request. If the minidriver queues a request for later processing, it should set the TimeoutCounter member to zero, which will prevent the class driver from timing out the request. Once the minidriver is ready to resume processing the request, it should reset the TimeoutCounter member to the value of TimeoutOriginal.