SetupDiOpenClassRegKeyEx

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


Version
Available in Microsoft Windows 2000 and later versions of Windows.
Header
Setupapi.h (include Setupapi.h)
Library
Contained in Setupapi.lib. Link to Setupapi.lib.

좋은 웹페이지 즐겨찾기