HKEY
SetupDiCreateDevRegKey(
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData,
IN DWORD Scope,
IN DWORD HwProfile,
IN DWORD KeyType,
IN HINF InfHandle, /* optional */
IN PCTSTR InfSectionName /* optional */
);
SetupDiCreateDevRegKey creates 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 created.
DeviceInfoData
Supplies a pointer to an SP_DEVINFO_DATA structure indicating the device instance for which to create the registry key.
Scope
Specifies the scope of the registry key to be created. The scope determines where the information is stored. The key created can be global or hardware profile-specific. Can be one of the following values:
DICS_FLAG_GLOBAL
Create 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
Create a key to store hardware profile-specific configuration information. This key has a path identical to the one created when SPDICS_FLAG_GLOBAL is set, except that it is rooted at one of the hardware-profile specific branches, instead of HKEY_LOCAL_MACHINE.
HwProfile
Specifies the hardware profile for which to create a key if HwProfileFlags is set to SPDICS_FLAG_CONFIGSPECIFIC. If HwProfile is 0, the key for the current hardware profile is created. If HwProfileFlags is SPDICS_FLAG_GLOBAL, HwProfile is ignored.
KeyType
Specifies the type of registry storage key to create. Can be one of the following values:
DIREG_DEV
Create 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
Create a software, or driver, registry key for the device. This key is located in the Class branch.
InfHandle
Supplies the handle of an open INF file that contains an Install section to be executed for the newly-created key. If this parameter is specified, InfSectionName must be specified as well.
InfSectionName
Supplies the name of an Install section in the INF file specified by InfHandle. This section is executed for the newly created key. If this parameter is specified, InfHandle must be specified as well.
Return Value
If the function is successful, it returns a handle to the newly-created registry key where private configuration data pertaining to this device instance can be stored/retrieved. If the function fails, it returns INVALID_HANDLE_VALUE. Call GetLastError to get extended error information.
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, SetupDiGetHwProfileList, SetupDiOpenDevRegKey, SetupDiRegisterDeviceInfo