SetupDiDeleteDevRegKey

HKEY
    SetupDiDeleteDevRegKey(
        IN HDEVINFO  DeviceInfoSet,
        IN PSP_DEVINFO_DATA  DeviceInfoData,
        IN DWORD
  Scope,
        IN DWORD  HwProfile,
        IN DWORD
  KeyType
        );

SetupDiDeleteDevRegKey deletes the specified registry key(s) associated with a device information element.

Parameters
DeviceInfoSet
Supplies a handle to the device information set containing the device instance whose registry configuration storage key is to be deleted.
DeviceInfoData
Supplies a pointer to an SP_DEVINFO_DATA structure indicating the device instance for which to delete registry key(s).
Scope
Specifies the scope of the registry key to delete. The scope indicates where the information is located. The key can be global or hardware profile-specific. Can be one of the following values:
DICS_FLAG_GLOBAL
Delete the key that stores global configuration information.
DICS_FLAG_CONFIGSPECIFIC
Delete the key that stores hardware profile-specific configuration information.
HwProfile
If Scope is set to DICS_FLAG_CONFIGSPECIFIC, the HwProfile parameter specifies the hardware profile for which to delete the registry key. If HwProfile is 0, the key for the current hardware profile is deleted. If HwProfile is 0xFFFFFFFF, the registry key for all hardware profiles is deleted.
KeyType
Specifies the type of registry storage key to delete. Can be one of the following values:
DIREG_DEV
Delete the 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
Delete a software, or driver, registry key for the device. This key is located in the Class branch.
DIREG_BOTH
Delete both the hardware and software keys for the device.
Return Value

The function returns TRUE if it is successful. Otherwise it returns FALSE and the logged error can be retrieved with a call to GetLastError.

See Also

SetupDiCreateDevRegKey, SetupDiGetHwProfileList