KsDeviceSetBusData function

The KsDeviceSetBusData function writes data to the bus on which the specified AVStream device resides.


ULONG KsDeviceSetBusData(
  _In_ PKSDEVICE Device,
  _In_ ULONG     DataType,
  _In_ PVOID     Buffer,
  _In_ ULONG     Offset,
  _In_ ULONG     Length


Device [in]

A pointer to a KSDEVICE structure. This routine attempts to write data to the bus on which this device resides.

DataType [in]

This parameter indicates the type of bus data to be written. Zero corresponds to configuration space. For further information, see the discussion of WhichSpace in the reference page for IRP_MN_READ_CONFIG.

Buffer [in]

A pointer to a buffer that contains the data to write to the bus. Number of bytes in the buffer must be equal or greater than Length.

Offset [in]

This parameter contains the byte offset into the space specified by DataType where data is written.

Length [in]

This parameter specifies the number of bytes of data to write to the bus from Buffer.

Return value

KsDeviceSetBusData returns the number of bytes actually written to the bus. In the case of an error, the routine returns zero. See details below in the Remarks section.


This function performs differently depending on the driver for the bus on which the specified device resides. If the bus driver supports the bus interface standard (usually PCI), call this function at either IRQL = PASSIVE_LEVEL or DISPATCH_LEVEL. After such a call, KsDeviceSetBusData returns the actual number of bytes written to the requested space.

If the bus driver does not support the bus interface standard, AVStream communicates with the bus driver using IoCallDriver. In this case, call KsDeviceSetBusData at IRQL = PASSIVE_LEVEL. The return value is either zero, in the case of failure, or equal to Length if the data was written successfully.

Drivers running on Windows 2000 and later can make this call at IRQL = DISPATCH_LEVEL. However, to ensure compatibility, minidriver writers may want to restrict use of KsDeviceSetBusData to IRQL = PASSIVE_LEVEL.


Target platform



Available in Microsoft Windows XP and later operating systems and DirectX 8.0 and later DirectX versions.


Ks.h (include Ks.h)




See Remarks section.

See also




Send comments about this topic to Microsoft