CM_Uninstall_DevNode function

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

Syntax

CMAPI CONFIGRET CM_Uninstall_DevNode(
  DEVNODE dnDevInst,
  ULONG   ulFlags
);

Parameters

dnDevInst

Device instance handle that is bound to the local machine.

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

   
Windows version 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