SetupDiOpenDevRegKey
HKEY
SetupDiOpenDevRegKey(
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
IN DWORD Scope,
IN DWORD HwProfile,
IN DWORD KeyType,
IN REGSAM samDesired
);
SetupDiOpenDevRegKey opens a registry storage key for device-specific
configuration information and returns a handle to the key.
Parameters
-
DeviceInfoSet
-
Supplies a handle to the device information set containing information about
the device instance whose registry configuration storage key is to be opened.
-
DeviceInfoData
-
Supplies a pointer to an SP_DEVINFO_DATA structure indicating the device
instance for which to open the registry key.
-
Scope
-
Specifies the scope of the registry key to open. The scope determines where
the information is stored. The key opened can be global or hardware
profile-specific. Can be one of the following values:
-
DICS_FLAG_GLOBAL
-
Open a key to store global configuration information. On Windows NT this opens
the key associated with the device instance that has the form:
HKLM\SYSTEM\CurrentControlSet\Control\Class\ClassGUID\InstanceID.
where classGUID is the GUID representing the device’s class and InstanceID
is a base-10, four-digit ordinal representing this device instance within the
list of device instances for this class.
On Windows 95 the key has the following form:
HKLM\SYSTEM\CurrentControlSet\Services\Class\ClassName\InstanceID.
where ClassName is the name representing the device’s class and InstanceID
is a base-10, four-digit ordinal representing this device instance within the
list of device instances for this class.
-
DICS_FLAG_CONFIGSPECIFIC
-
Open a key to store hardware profile-specific configuration information. This
key has a path identical to the one opened by SPDICS_FLAG_GLOBAL, except that
it is rooted at one of the hardware-profile specific branches, instead of HKEY_LOCAL_MACHINE.
-
HwProfile
-
Specifies the hardware profile to open a key for, if Scope is set to
SPDICS_FLAG_CONFIGSPECIFIC. If HwProfile is 0, the key for the current
hardware profile is opened. If Scope is SPDICS_FLAG_GLOBAL, this
parameter is ignored.
-
KeyType
-
Specifies the type of registry storage key to open. Can be one of the
following values:
-
DIREG_DEV
-
Open a hardware registry key for the device. This is the key for storage of
driver-independent configuration information. This key is in the Device
Instance key of the Enum branch.
-
DIREG_DRV
-
Open a software, or driver, registry key for the device. This key is located
in the Class branch.
-
samDesired
-
Specifies the access you require for this key.
Return Value
If the function is successful, it returns a handle to an opened registry key
where private configuration data pertaining to this device instance can be
stored/retrieved.
If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error
information, call GetLastError.
Comments
Close the handle returned from this function by calling RegCloseKey.
The specified device instance must be registered before calling this function.
After creating the device instance with SetupDiCreateDeviceInfo, call SetupDiRegisterDeviceInfo
to register it.
See Also
SetupDiCreateDeviceInfo, SetupDiCreateDevRegKey,
SetupDiGetHwProfileList, SetupDiRegisterDeviceInfo