CM_Uninstall_DevNode function (cfgmgr32.h)

The CM_Uninstall_DevNode function removes all persistent state associated with a device instance.

Syntax

CMAPI CONFIGRET CM_Uninstall_DevNode(
  [in] DEVNODE dnDevInst,
  [in] ULONG   ulFlags
);

Parameters

[in] dnDevInst

Device instance handle that is bound to the local machine.

[in] ulFlags

Reserved. Must be set to zero.

Return value

If the operation succeeds, the function returns CR_SUCCESS. Otherwise, it returns one of the CR_-prefixed error codes defined in Cfgmgr32.h.

Remarks

This function uninstalls the device without sending an IRP_MN_QUERY_REMOVE_DEVICE request or calling class installers or co-installers. If your application will run only on a Target Platform of Desktop, instead of calling CM_Uninstall_DevNode, the application should uninstall the device by calling SetupDiCallClassInstaller with the DIF_REMOVE code, or by calling DiUninstallDevice.

Use the following sequence to call this function:

  1. Check if CM_Get_DevNode_Status returns success. This means that the device is present.
  2. If the device is present, call CM_Query_And_Remove_SubTree.
  3. Call CM_Uninstall_DevNode.

Requirements

Requirement Value
Minimum supported client Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Universal
Header cfgmgr32.h (include Cfgmgr32.h)
Library Cfgmgr32.lib; OneCoreUAP.lib on Windows 10
DLL CfgMgr32.dll

See also

SetupDiCallClassInstaller