SRB_CLOSE_STREAM

The class driver sends this request to close a stream.

Return Value

The minidriver should set one of the following as the status in the SRB:

STATUS_SUCCESS
Indicates successful completion of the command.

STATUS_NOT_IMPLEMENTED
Indicates that the function is not supported by the minidriver.

STATUS_IO_DEVICE_ERROR
Indicates that a hardware failure occurred.

Comments

The class driver provides a HW_STREAM_OBJECT buffer in pSrb->StreamObject, with pSrb->StreamObject->StreamNumber set to the number of the stream to be closed. The pSrb pointer points to a HW_STREAM_REQUEST_BLOCK structure. StreamNumber corresponds to the offset of the stream within the HW_STREAM_DESCRIPTOR structure that the minidriver provides in response to a SRB_GET_STREAM_INFO request.

If the minidriver successfully closes the stream, the minidriver returns STATUS_SUCCESS. Otherwise, it returns an appropriate error status.

When the SRB_CLOSE_STREAM command is received by the minidriver, the responding minidriver routine should:

  1. Free any resources allocated by the minidriver when the stream was opened.

  2. Stop referencing the clock if a clock was used for the stream.

  3. Reset the stream state to Stop.

Note that a stream could be closed arbitrarily while streaming if an associated user-mode application crashes. Therefore, you must release all outstanding resources for the stream, complete all pending SRBs for the stream, and put the stream back into a quiescent state.