DxgkDdiNotifySurpriseRemoval routine

Called by the operating system after a user disconnected an external display device without notifying the system.

Can optionally be implemented by Windows Display Driver Model (WDDM) 1.2 and later display miniport drivers.



_Check_return_ NTSTATUS* DxgkDdiNotifySurpriseRemoval(
  _In_ PVOID                      MiniportDeviceContext,
{ ... }


MiniportDeviceContext [in]

A handle to a context block associated with a display adapter. The display miniport driver's DxgkDdiAddDevice function previously provided this handle to the DirectX graphics kernel subsystem.

RemovalType [in]

A value of type DXGK_SURPRISE_REMOVAL_TYPE that identifies the type of surprise removal event.

Return value

Returns STATUS_SUCCESS if software resources were cleaned up for RemovalType = DxgkRemovalHibernation. If the driver instead returns an error code, the operating system will attempt to reboot the system, as described in the following Remarks section.


The operating system calls DxgkDdiNotifySurpriseRemoval only if the display miniport driver indicates support by setting the SupportSurpriseRemovalInHibernation member of the DXGK_DRIVERCAPS structure to 1.

Note  This function is called only if the disconnected external display device was in hibernation mode. This is indicated by RemovalType = DxgkRemovalHibernation, the only available value.

If the display miniport driver returns STATUS_SUCCESS, the DirectX graphics kernel subsystem will continue to remove the external display adapter from the graphics stack and will call other driver-implemented DxgkDdiXxx kernel-mode functions to release all resources. In this case, the driver must complete its cleanup of software resources in response to calls from the operating system but must not touch or clean any hardware settings. If no other hardware is using the driver, the operating system will unload the driver.

If the driver returns an error code, does not set DXGK_DRIVERCAPS.SupportSurpriseRemovalInHibernation, or does not implement this function, the DirectX graphics kernel subsystem will not call any more driver-implemented DxgkDdiXxx functions and will attempt to reboot the system. In this case, the resource that was allocated before the external display device was disconnected will not be released.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Target platform


Dispmprt.h (include Dispmprt.h)



See also




Send comments about this topic to Microsoft