CM_Open_Class_KeyW function

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(
  LPGUID         ClassGuid,
  LPCWSTR        pszClassName,
  REGSAM         samDesired,
  REGDISPOSITION Disposition,
  PHKEY          phkClass,
  ULONG          ulFlags
);

Parameters

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.

pszClassName

Reserved. Must be set to NULL.

samDesired

The registry security access for the key to be opened.

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.

phkClass

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

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

   
Windows version 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