DXGKCB_GETHANDLEDATA callback function

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



VOID * DxgkcbGethandledata(



This callback function has no parameters.

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.


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.


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

    VOID    *InterfaceContext,
    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;


Minimum supported client Available in Windows Vista and later versions of the Windows operating systems.
Target Platform Desktop
Header d3dkmddi.h (include D3dkmddi.h)

See Also