Minidriver Flow of Control
The following set of steps is typically followed in initializing, using, and uninitializing streaming minidrivers. The following referenced commands and structures are described elsewhere in this documentation.
The steps followed in initializing, using, and uninitializing streaming minidrivers are- The hardware adapter supported by the minidriver is detected by the Plug and Play enumerator. The enumerator checks the registry to resolve any symbolic references and passes the request to the I/O subsystem.
- The I/O subsystem loads the minidriver and calls the minidriver's DriverEntry routine (see DriverEntry for Stream Class Minidrivers) where a HW_INITIALIZATION_DATA structure is allocated and initialized. A file object is created from the information in the DriverEntry routine.
- The minidriver's DriverEntry routine then calls the stream class driver's StreamClassRegisterMinidriver function and passes the HW_INITIALIZATION_DATA structure as a parameter. The HW_INITIALIZATION_DATA structure includes the addresses of minidriver functions that handle SRBs. This allows the minidriver to respond to SRBs sent by the class driver.
- During initialization, the stream class driver calls the function specified in the HW_INITIALIZATION_DATA structure's HwReceivePacket member (see StrMiniReceiveDevicePacket) with and SRB with the Command member set to SRB_INITIALIZE_DEVICE. The minidriver then initializes the hardware adapter.
- The stream class driver calls the function specified in the HW_INITIALIZATION_DATA structure's HwReceivePacket member with SRB_GET_STREAM_INFO. The minidriver then returns information on the streams it supports.
- The stream class driver calls the function specified in the HW_INITIALIZATION_DATA structure's HwReceivePacket member with SRB_OPEN_STREAM, with a HW_STREAM_OBJECT structure. The minidriver performs the necessary hardware action to open the specified stream.
- The stream class driver sends or requests data from the stream by passing a SRB_READ_DATA or SRB_WRITE_DATA command to the function specified in the ReceiveDataPacket member of the HW_STREAM_OBJECT structure for the stream.
- The stream class driver gets and sets properties and other control information for the stream by passing the appropriate stream request block (HW_STREAM_REQUEST_BLOCK) to the function specified in the ReceiveControlPacket member of the HW_STREAM_OBJECT structure for the stream.
- When the system is through using a stream, the stream class driver calls the function specified in the HW_INITIALIZATION_DATA structure's HwReceivePacket member with SRB_CLOSE_STREAM. The minidriver then closes the specified stream.
- When it is time to uninitialize the adapter, the stream class driver calls the function specified in the HW_INITIALIZATION_DATA structure's HwReceivePacket member with SRB_UNINITIALIZE_DEVICE. The minidriver then uninitializes the device.