DxgkCbWriteDeviceSpace routine

The DxgkCbWriteDeviceSpace function writes to a device configuration space or the expansion ROM of a display adapter.

Syntax


DXGKCB_WRITE_DEVICE_SPACE DxgkCbWriteDeviceSpace;

NTSTATUS DxgkCbWriteDeviceSpace(
  _In_   HANDLE DeviceHandle,
  _In_   ULONG DataType,
  _In_   PVOID Buffer,
  _In_   ULONG Offset,
  _In_   ULONG Length,
  _Out_  PULONG BytesWritten
)
{ ... }

Parameters

DeviceHandle [in]

A handle that represents a display adapter. The display miniport driver previously obtained this handle in the DeviceHandle member of the DXGKRNL_INTERFACE structure that was passed to DxgkDdiStartDevice.

DataType [in]

The type of write transaction to be performed. This parameter must be one of the following values, which are defined in Dispmprt.h:

DXGK_WHICHSPACE_BRIDGE

Write to the parent bus device's configuration space.

DXGK_WHICHSPACE_CONFIG

Write to the display adapter's configuration space.

DXGK_WHICHSPACE_MCH

Write to the configuration space of a memory controller hub that is a peer to the adapter's parent bus.

DXGK_WHICHSPACE_ROM

Write to the display adapter's expansion ROM.

Buffer [in]

A pointer to a buffer that supplies the data to be written to the configuration space.

Offset [in]

The offset, in bytes, into the configuration space, at which the write transaction begins.

Length [in]

The number of bytes to be written.

BytesWritten [out]

A pointer to a ULONG-typed variable that receives the number of bytes actually written.

Return value

DxgkCbWriteDeviceSpace returns one of the following values:

Return codeDescription
STATUS_SUCCESS

The function succeeded.

STATUS_INVALID_PARAMETER

The DeviceHandle, DataType, or Buffer parameter is invalid.

STATUS_UNSUCCESSFUL

The function was unable to write the data.

 

Examples

The following code example writes a value of a specific size to the PCI configuration space.


ULONG
WritePciConfig(
    PVOID pHwDeviceExt,
    ULONG ulAddress,
    PVOID pValue,
    ULONG ulSize
    )
{
    if ((ulSize <= 0) || (ulSize > sizeof(PCI_COMMON_CONFIG)))
        return(0);
    if (!pHwDeviceExt) {
        return 0;
    }
    else {
        PHW_DEVICE_EXTENSION pHwDevExt = (PHW_DEVICE_EXTENSION)pHwDeviceExt;
        HANDLE DeviceHandle = pHwDevExt->ddiCallback.DeviceHandle;
        ULONG ulSizeRet = 0;
        NTSTATUS status = pHwDevExt->ddiCallback.DxgkCbWriteDeviceSpace( DeviceHandle,
  DXGK_WHICHSPACE_CONFIG,
  pValue,
  ulAddress,
  ulSize,
  &ulSizeRet);
        return (status == STATUS_SUCCESS)?ulSizeRet:0;
    }
}

Requirements

Version

Available in Windows Vista and later versions of the Windows operating systems.

Header

Dispmprt.h (include Dispmprt.h)

IRQL

PASSIVE_LEVEL

See also

DxgkCbReadDeviceSpace

 

 

Send comments about this topic to Microsoft

Mostrar:
© 2014 Microsoft