OpenDeviceKey (Windows CE 5.0)
This function opens the device registry key specified by the ActiveKey parameter. The caller of OpenDeviceKey is responsible for closing the registry handle it returns.
HKEY OpenDeviceKey( LPCTSTR ActiveKey);
Parameters
- ActiveKey
[in] Pointer to the registry key for which to obtain the handle.
Return Values
If successful, this function returns a handle to the device registry key specified by the ActiveKey parameter. If the function is not successful, it returns INVALID_HANDLE_VALUE. To obtain extended error information, call GetLastError.
Remarks
Device drivers loaded by ActivateDeviceEx or ActivateDevice receive a registry key name as the first argument, which is the pContext parameter, of their initialization routine, XXX_Init (Device Manager) This key is created and owned by the Device Manager, but contains a pointer to the device registry key used in the call to ActivateDeviceEx or ActivateDevice. The device registry key can be opened directly using OpenDeviceKey. For example, a device driver might be loaded because it is described in HKEY_LOCAL_MACHINE\Drivers\Builtin\<Driver Name>. The driver's XXX_Init function receives a pointer to its activation key, for example, HKEY_LOCAL_MACHINE\Active\04. The activation key's Key value would be Drivers\Builtin\<Driver Name>.
Using OpenDeviceKey is preferable to reading the Key value, defined as DEVLOAD_DEVKEY_VALNAME, from the activation key because the contents of the activation key are dependent on the implementation of the Device Manager.
Requirements
OS Versions: Windows CE 3.0 and later.
Header: Devload.h.
Link Library: Coredll.lib.
See Also
ActivateDevice | ActivateDeviceEx | XXX_Init (Device Manager)
Send Feedback on this topic to the authors