SetupDiOpenClassRegKey function

The SetupDiOpenClassRegKey function opens the setup class registry key or a specific class's subkey.

Syntax


HKEY SetupDiOpenClassRegKey(
  _In_opt_ const GUID   *ClassGuid,
  _In_           REGSAM samDesired
);

Parameters

ClassGuid [in, optional]

A pointer to the GUID of the setup class whose key is to be opened. This parameter is optional and can be NULL. If this parameter is NULL, the root of the setup class tree (HKLM\SYSTEM\CurrentControlSet\Control\Class) is opened.

samDesired [in]

The registry security access for the key to be opened. For information about registry security access values of type REGSAM, see the Microsoft Windows SDK documentation.

Return value

If the function is successful, it returns a handle to an opened registry key where information about this setup class can be stored/retrieved.

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.

This function does not create a registry key if it does not already exist.

The handle returned from this function must be closed by calling RegCloseKey.

To open the interface class registry key or a specific interface class subkey, call SetupDiOpenClassRegKeyEx.

Requirements

Target platform

Desktop
For universal, call CM_Open_Class_Key

Version

Available in Microsoft Windows 2000 and later versions of Windows.

Header

Setupapi.h (include Setupapi.h)

Library

Setupapi.lib

DLL

Setupapi.dll

See also

SetupDiOpenClassRegKeyEx
SetupDiOpenDevRegKey

 

 

Send comments about this topic to Microsoft

Show: