IGroupPolicyObject2::GetRegistryKeyPath method

The GetRegistryKeyPath method retrieves a path to the root of the registry key for the specified GPO section.

Syntax


HRESULT GetRegistryKeyPath(
  [in]   DWORD dwSection,
  [out]  LPOLESTR pszRegistryKeyPath,
  [in]   int cchMaxLength
);

Parameters

dwSection [in]

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

ValueMeaning
GPO_SECTION_USER

User section

GPO_SECTION_MACHINE

Computer section

 

pszRegistryKeyPath [out]

Pointer to a buffer that receives the path to registry key for the requested section. The returned path is the root of the registry, not the Policies subkey.

cchMaxLength [in]

Specifies the size, in characters, of the pszRegistryKeyPath buffer.

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

This method was introduced because the HKEY parameter in GetRegistryKey cannot be marshalled.

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

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

Gpedit2.h

DLL

Gpedit.dll

IID

IID_IGroupPolicyObject2 is defined as 7E37D5E7-263D-45CF-842B-96A95C63E46C

See also

Group Policy Overview
Group Policy Interfaces
IGroupPolicyObject2

 

 

Show:
© 2014 Microsoft