CM_Open_Class_KeyW function (cfgmgr32.h)

The CM_Open_Class_Key function opens the device setup class registry key, the device interface class registry key, or a specific subkey of a class.

Syntax

CMAPI CONFIGRET CM_Open_Class_KeyW(
  [in, optional] LPGUID         ClassGuid,
  [in, optional] LPCWSTR        pszClassName,
  [in]           REGSAM         samDesired,
  [in]           REGDISPOSITION Disposition,
  [out]          PHKEY          phkClass,
  [in]           ULONG          ulFlags
);

Parameters

[in, optional] ClassGuid

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 is opened.

[in, optional] pszClassName

Reserved. Must be set to NULL.

[in] samDesired

The registry security access for the key to be opened.

[in] Disposition

Specifies how the registry key is to be opened. May be one of the following values:

RegDisposition_OpenAlways

Open the key if it exists. Otherwise, create the key.

RegDisposition_OpenExisting

Open the key only if it exists.

[out] phkClass

Pointer to an HKEY that will receive the opened key upon success.

[in] ulFlags

Open class key flags:

CM_OPEN_CLASS_KEY_INSTALLER

The key to be opened is for a device setup class.

CM_OPEN_CLASS_KEY_INTERFACE

The key to be opened is for a device interface class.

Return value

If the operation succeeds, the function returns CR_SUCCESS. Otherwise, it returns one of the CR_-prefixed error codes defined in Cfgmgr32.h.

Remarks

Close the handle returned from this function by calling RegCloseKey.

Requirements

Requirement Value
Minimum supported client Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Desktop
Header cfgmgr32.h (include Cfgmgr32.h)
Library Cfgmgr32.lib

See also

CM_Delete_Class_Key

SetupDiOpenClassRegKeyEx