SetupDiOpenDeviceInterfaceRegKey function (setupapi.h)

The SetupDiOpenDeviceInterfaceRegKey function opens the registry subkey that is used by applications and drivers to store information that is specific to a device interface.

Syntax

WINSETUPAPI HKEY SetupDiOpenDeviceInterfaceRegKey(
  [in] HDEVINFO                  DeviceInfoSet,
  [in] PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
       DWORD                     Reserved,
  [in] REGSAM                    samDesired
);

Parameters

[in] DeviceInfoSet

A pointer to a device information set that contains the device interface for which to open a registry subkey.

[in] DeviceInterfaceData

A pointer to an SP_DEVICE_INTERFACE_DATA structure that specifies the device interface. This pointer can be returned by SetupDiCreateDeviceInterface or SetupDiEnumDeviceInterfaces.

Reserved

Reserved. Must be zero.

[in] samDesired

The requested registry security access to the registry subkey. For information about registry security access values of type REGSAM, see the Microsoft Windows SDK documentation.

Return value

SetupDiOpenDeviceInterfaceRegKey returns a handle to the opened registry key. If the function fails, it returns INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

Remarks

Depending on the value that is passed in the samDesired parameter, it might be necessary for the caller of this function to be a member of the Administrators group.

Close the handle returned from by function by calling RegCloseKey.

Requirements

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

See also

SetupDiCreateDeviceInterface

SetupDiCreateDeviceInterfaceRegKey

SetupDiEnumDeviceInterfaces