Platform SDK: Hardware

SetupDiOpenClassRegKeyEx

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

HKEY SetupDiOpenClassRegKeyEx(
  CONST LPGUID ClassGuid,  
  REGSAM samDesired,
  DWORD Flags,
  PCTSTR MachineName, 
  PVOID Reserved
 );

Parameters

ClassGuid
[in] An optional pointer to the GUID of the class for which the registry key is to be opened. If this parameter is NULL, the function opens the root of the class tree, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class.
samDesired
[in] Specifies the required access to the key.
Flags
[in] Specifies the kind of registry key to be opened. This parameter can be one of the following values.
Value Meaning
DIOCR_INSTALLER Open a setup class key. If the ClassGuid parameter 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] An optional pointer to a string containing the name of a remote computer on which to open the specified key.
Reserved
Reserved. Must be NULL.

Return Values

If the function succeeds, the return value is a handle to an opened registry key where information pertaining to this setup class can be stored or retrieved.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

Remarks

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

To close the handle returned from this function, call the RegCloseKey function.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Setupapi.h.
  Library: Use Setupapi.lib.

See Also

Device Management Overview, Device Management Functions, SetupDiCreateDeviceInterfaceRegKey, SetupDiOpenDeviceInterfaceRegKey