Export (0) Print
Expand All
Expand Minimize

SetupDiOpenClassRegKey function

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


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


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.


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.



Available in Microsoft Windows 2000 and later versions of Windows.


Setupapi.h (include Setupapi.h)



See also




Send comments about this topic to Microsoft

© 2014 Microsoft