IGroupPolicyObject::GetRegistryKey method (gpedit.h)

The GetRegistryKey method retrieves a handle to the root of the registry key for the specified GPO section.

Syntax

HRESULT GetRegistryKey(
  [in]  DWORD dwSection,
  [out] HKEY  *hKey
);

Parameters

[in] dwSection

Specifies the GPO section. This parameter can be one of the following values.

GPO_SECTION_ROOT

Root section

GPO_SECTION_MACHINE

Computer section

[out] hKey

Receives a handle to the registry key. This handle is opened with all access rights. For more information, see Registry Key Security and Access Rights.

Return value

If the method succeeds, the return value is S_OK. Otherwise, the method returns one of the COM error codes defined in the Platform SDK header file WinError.h. If the registry information is not loaded, the method returns E_FAIL.

Remarks

The registry handle is a handle to the root of the registry key. To get or set values in the Policies key, first call the RegOpenKey function to open the Software
Policies key.

When you have finished using the registry handle, call the RegCloseKey function to close the handle.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header gpedit.h
DLL Gpedit.dll

See also

Group Policy Interfaces

Group Policy Overview

IGroupPolicyObject