DxgkCbGetHandleData routine

The DxgkCbGetHandleData function retrieves the private data that is associated with an allocation.

Syntax


DXGKCB_GETHANDLEDATA DxgkCbGetHandleData;

VOID* APIENTRY CALLBACK DxgkCbGetHandleData(
  _In_  const DXGKARGCB_GETHANDLEDATA *pData
)
{ ... }

Parameters

pData [in]

[in] A pointer to a DXGKARGCB_GETHANDLEDATA structure that describes the allocation data to retrieve.

Return value

DxgkCbGetHandleData returns a buffer that contains the private data for the allocation.

If DxgkCbGetHandleData returns a NULL pointer, the Microsoft DirectX graphics kernel subsystem was unable to resolve the handle that is supplied in the hObject member of the DXGKARGCB_GETHANDLEDATA structure to private data because, for example, of the following possible reasons:

  • An invalid handle was received from the user-mode display driver because of a malicious attack or some other bug.
  • Allocations had lifetime issues.

If a NULL pointer is returned, the display miniport driver should fail its currently running DDI function with STATUS_INVALID_HANDLE.

Remarks

When the DirectX graphics kernel subsystem calls the display miniport driver's DxgkDdiCreateAllocation function to create handles to allocations, the display miniport driver can create private data for each allocation handle. The display miniport driver can subsequently call the DxgkCbGetHandleData function to retrieve private data for each graphics subsystem-specific handle. Therefore, the display miniport driver is not required to maintain a private allocation handle table.

If the DeviceSpecific bit-field flag is set in the Flags member of the DXGKARGCB_GETHANDLEDATA structure that pData points to, DxgkCbGetHandleData returns the device-specific data that is associated with the device-specific handle that the driver returned from the call to its DxgkDdiOpenAllocation function. Note that the DeviceSpecific bit-field flag is valid only if the display miniport driver also sets the Type member of DXGKARGCB_GETHANDLEDATA to the DXGK_HANDLE_ALLOCATION enumeration value for the handle in the hObject member of DXGKARGCB_GETHANDLEDATA.

Examples

The following code example shows an implementation of DxgkDdiOpenAllocation in which DxgkCbGetHandleData is called.


NTSTATUS
DxgkDdiOpenAllocation(
    VOID    *InterfaceContext,
    CONST DXGKARG_OPENALLOCATION    *pDDIDAData)
{
    DWORD dwIdx;
    DXGKRNL_INTERFACE              *pCallback;
    PR2D3DDevice                    pR2D3DDev;
    PHW_DEVICE_EXTENSION            pAdapter;

    pR2D3DDev = (PR2D3DDevice)InterfaceContext;
    pAdapter  = (PHW_DEVICE_EXTENSION)pR2D3DDev->pAdapter;
    pCallback = &(pAdapter->ddiCallback);

    for (dwIdx=0; dwIdx < pDDIDAData->NumAllocations; dwIdx++) {
        DXGKARGCB_GETHANDLEDATA  getHandleData = {0};
        R2AllocationInfo*  pAllocInfo;

        getHandleData.hObject = pDDIDAData->pOpenAllocation[dwIdx].hAllocation;
        getHandleData.Type    = DXGK_HANDLE_ALLOCATION;
        pAllocInfo = (PR2AllocationInfo)pCallback->DxgkCbGetHandleData(&getHandleData);
        pDDIDAData->pOpenAllocation[dwIdx].hDeviceSpecificAllocation = (HANDLE)pAllocInfo;
        pAllocInfo->vidMemData.hAllocation = pDDIDAData->pOpenAllocation[dwIdx].hAllocation;
    }
    return STATUS_SUCCESS;
}

Requirements

Version

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

Header

D3dkmddi.h (include D3dkmddi.h)

IRQL

< DISPATCH_LEVEL

See also

DXGKARGCB_GETHANDLEDATA
DxgkDdiCreateAllocation
DxgkDdiOpenAllocation

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft