The CM_Disable_DevNode function disables a device.
Syntax
CMAPI CONFIGRET CM_Disable_DevNode(
  [in] DEVINST dnDevInst,
  [in] ULONG   ulFlags
);
Parameters
[in] dnDevInst
绑定到本地计算机的设备实例句柄。
[in] ulFlags
Disable flags:
CM_DISABLE_UI_NOT_OK
如果尝试禁用设备失败,请不要向用户显示任何界面。
CM_DISABLE_PERSIST (Windows 10 及更高版本的 Windows)
在重新启动时禁用设备。
Return value
如果作成功,该函数将返回CR_SUCCESS。 Otherwise, it returns one of the CR_-prefixed error codes defined in Cfgmgr32.h.
Remarks
By default, CM_Disable_DevNode disables a device at one time, but after reboot the device is enabled again. Starting in Windows 10, you can specify the CM_DISABLE_PERSIST flag to disable the device across reboots.
Requirements
| Requirement | Value | 
|---|---|
| 最低支持的客户端 | Microsoft Windows 2000 及更高版本的 Windows 中可用。 | 
| Target Platform | Universal | 
| Header | cfgmgr32.h (包括 Cfgmgr32.h) | 
| Library | Cfgmgr32.lib;Windows 10 上的 OneCoreUAP.lib | 
| DLL | CfgMgr32.dll |