SetupDiOpenDeviceInterfaceRegKey function

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(
  HDEVINFO                  DeviceInfoSet,
  PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  DWORD                     Reserved,
  REGSAM                    samDesired
);

Parameters

DeviceInfoSet

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

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.

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

   
Windows version 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