Export (0) Print
Expand All
Expand Minimize

SetupDiOpenClassRegKeyEx function

The SetupDiOpenClassRegKeyEx function opens the device setup class registry key, the device interface class registry key, or a specific class's subkey. This function opens the specified key on the local computer or on a remote computer.

Syntax


HKEY SetupDiOpenClassRegKeyEx(
  _In_opt_    const GUID   *ClassGuid,
  _In_        REGSAM samDesired,
  _In_        DWORD  Flags,
  _In_opt_    PCTSTR MachineName,
  _Reserved_  PVOID  Reserved
);

Parameters

ClassGuid [in, optional]

A pointer to the GUID of the class whose registry key is to be opened. This parameter is optional and can be NULL. If this parameter is NULL, the root of the 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.

Flags [in]

The type of registry key to be opened, which is specified by one of the following:

DIOCR_INSTALLER

Open a setup class key. If ClassGuid is NULL, open the root key of the class installer branch.

DIOCR_INTERFACE

Open an interface class key. If ClassGuid is NULL, open the root key of the interface class branch.

MachineName [in, optional]

Optionally points to a string that contains the name of a remote computer on which to open the specified key.

Reserved

Reserved. Must be NULL.

Return value

SetupDiOpenClassRegKeyEx 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.

SetupDiOpenClassRegKeyEx does not create a registry key if it does not already exist.

Callers of this function must close the handle returned from this function by calling RegCloseKey.

Requirements

Target platform

Desktop

Version

Available in Microsoft Windows 2000 and later versions of Windows.

Header

Setupapi.h (include Setupapi.h)

Library

Setupapi.lib

See also

SetupDiCreateDeviceInterfaceRegKey
SetupDiOpenDevRegKey

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft