SetupDiDeleteDevRegKey function (setupapi.h)

The SetupDiDeleteDevRegKey function deletes specified user-accessible registry keys that are associated with a device information element.

Syntax

WINSETUPAPI BOOL SetupDiDeleteDevRegKey(
  [in] HDEVINFO         DeviceInfoSet,
  [in] PSP_DEVINFO_DATA DeviceInfoData,
  [in] DWORD            Scope,
  [in] DWORD            HwProfile,
  [in] DWORD            KeyType
);

Parameters

[in] DeviceInfoSet

A handle to the device information set that contains a device information element that represents the device for which to delete registry keys. The device information set must not contain remote elements.

[in] DeviceInfoData

A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet.

[in] Scope

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.

[in] 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.

[in] KeyType

The type of registry storage key to delete. Can be one of the following values:

DIREG_DEV

Delete the device's hardware key.

DIREG_DRV

Delete the device's software key.

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.

Remarks

The caller of this function must be a member of the Administrators group.

The DeviceInfoSet must only contain elements on the local computer.

Requirements

Requirement Value
Minimum supported client Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Desktop
Header setupapi.h (include Setupapi.h)
Library Setupapi.lib
DLL Setupapi.dll

See also

SetupDiCreateDevRegKey

SetupDiGetHwProfileList