MSDN原文地址
Windows Driver Kit: Device Installation
CM_Locate_DevNode
The CM_Locate_DevNode function obtains a device instance handle to the device node that is associated with a specified device instance identifier, on the local machine.
CM_Locate_DevNode 函数获得设备节点的设备实例句柄,关联本机指定的设备实例标识符。
CMAPI CONFIGRET WINAPI
CM_Locate_DevNode(
OUT PDEVINST pdnDevInst,
IN DEVINSTID pDeviceID, OPTIONAL
IN ULONG ulFlags
);
Parameters
- pdnDevInst
- A pointer to a device instance handle that CM_Locate_DevNode retrieves. The retrieved handle is bound to the local machine.
- 指向CM_Locate_DevNode 取得的设备实例句柄。这个句柄限制在本机。
- pDeviceID
- A pointer to a NULL-terminated string representing a device instance identifier. If this value is NULL, or if it points to a zero-length string, the function retrieves a device instance handle to the device at the root of the device tree.
- 指向一个以NULL结尾的字符串,象征设备实例描述符。如果这个值为NULL,或者指向一个零长度的字符串,函数取得的设备实例句柄是设备树的根设备。
- ulFlags
- A variable of ULONG type that supplies one of the following flag values that apply if the caller supplies a device instance identifier:
- CM_LOCATE_DEVNODE_NORMAL
- The function retrieves the device instance handle for the specified device only if the device is currently configured in the device tree.
- 仅仅是currently configured
- CM_LOCATE_DEVNODE_PHANTOM
- The function retrieves a device instance handle for the specified device if the device is currently configured in the device tree or the device is a nonpresent device that is not currently configured in the device tree.
currently configured 或者 nonpresent device
- CM_LOCATE_DEVNODE_CANCELREMOVE
- The function retrieves a device instance handle for the specified device if the device is currently configured in the device tree or in the process of being removed from the device tree. If the device is in the process of being removed, the function cancels the removal of the device.
- 正在被移除的设备,如果设备正在被移除,这个函数取消移除动作。
- CM_LOCATE_DEVNODE_NOVALIDATION
- Not used.
Return Value
If the operation succeeds, CM_Locate_DevNode returns CR_SUCCESS. Otherwise, the function returns one of the CR_Xxx error codes that are defined in cfgmgr32.h.
Comments
For information about using device instance handles that are bound to the local machine, see CM_Get_Child.
Requirements
Versions: The CM_Locate_DevNode function is available in Microsoft Windows 2000 and later versions of Windows.
Headers: Declared in cfgmgr32.h. Include cfgmgr32.h.
See Also
CM_Get_Child, CM_Locate_DevNode_Ex