Output Buffer Size

The miniport driver's IMiniport::DataRangeIntersection method copies the structure that specifies the negotiated data format into a buffer that is allocated by the caller. The method's OutputBufferLength parameter specifies the buffer's size in bytes. Note that the size of the format structure varies with the selected format. In order to avoid writing past the end of the buffer, the DataRangeIntersection method should first verify that the allocated buffer is big enough to contain the format.

For a mono or stereo format, the minimum size for the output buffer is either sizeof(KSDATAFORMAT_WAVEFORMATEX) or sizeof(KSDATAFORMAT_DSOUND), depending on whether a WAVEFORMATEX or DirectSound format has been selected.

If the wave format supports more than two channels, the WAVEFORMATEX structure that is embedded at the end of theKSDATAFORMAT_WAVEFORMATEX structure expands to occupy an additional number of bytes that is equal to the difference

sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)