PFND3DDDI_UNLOCK callback function

The Unlock function unlocks a resource or a surface within the resource that was previously locked by the Lock function.


PFND3DDDI_UNLOCK Pfnd3dddiUnlock;

HRESULT Pfnd3dddiUnlock(
  HANDLE hDevice,
  const D3DDDIARG_UNLOCK *Arg2



A handle to the display device (graphics context).


pData [in]

A pointer to a D3DDDIARG_UNLOCK structure that describes the resource or surface within the resource to unlock.

Return value

Unlock returns one of the following values:

Return code Description
S_OK The resource is successfully unlocked.
E_OUTOFMEMORY Unlock could not allocate the required memory for it to complete.
E_INVALIDARG The resource that D3DDDIARG_UNLOCK describes was not locked by a previous call to the driver's Lock function.


These comments are analogous to the description in the Remarks section of the Lock reference page.

The user-mode display driver must call the Microsoft Direct3D runtime's pfnUnlockCb function after Unlock is called. In this pfnUnlockCb call, the user-mode display driver passes an allocation handle. Before calling pfnUnlockCb, the user-mode display driver must first map the surface to an appropriate allocation.

The runtime calls the user-mode display driver's Unlock function to unlock preallocated system memory surfaces as well. The runtime sets the NotifyOnly bit-field flag in the Flags member of the D3DDDIARG_UNLOCK structure that is pointed to by pData to differentiate Unlock calls that unlock preallocated system memory from other Unlock calls. If the user-mode display driver's Lock function called pfnLockCb to lock the system memory allocation that corresponds to the surface, it must also call pfnUnlockCb. Not calling pfnUnlockCb stops the coordination between the runtime, the user-mode display driver, and the display miniport driver.


Minimum supported client Available in Windows Vista and later versions of the Windows operating systems.
Target Platform Universal
Header d3dumddi.h (include D3dumddi.h)

See also