ILocalRegistry4.GetLocalRegistryRootEx(UInt32, UInt32, String) Метод

Определение

Возвращает локальный корень реестра.

public:
 int GetLocalRegistryRootEx(System::UInt32 dwRegType, [Runtime::InteropServices::Out] System::UInt32 % pdwRegRootHandle, [Runtime::InteropServices::Out] System::String ^ % pbstrRoot);
int GetLocalRegistryRootEx(unsigned int dwRegType, [Runtime::InteropServices::Out] unsigned int & pdwRegRootHandle, [Runtime::InteropServices::Out] std::wstring const & & pbstrRoot);
public int GetLocalRegistryRootEx (uint dwRegType, out uint pdwRegRootHandle, out string pbstrRoot);
abstract member GetLocalRegistryRootEx : uint32 * uint32 * string -> int
Public Function GetLocalRegistryRootEx (dwRegType As UInteger, ByRef pdwRegRootHandle As UInteger, ByRef pbstrRoot As String) As Integer

Параметры

dwRegType
UInt32

[in] Значение __VsLocalRegistryType, указывающее куст реестра.

pdwRegRootHandle
UInt32

[in] Значение __VsLocalRegistryRootHandle, указывающее маркер корня реестра.

pbstrRoot
String

[out] Указатель на строку, которая содержит корневой элемент локального реестра.

Возвращаемое значение

Int32

Если метод завершается успешно, возвращает значение S_OK. В противном случае функция возвращает код ошибки.

Примеры

ILocalRegistry4* pLocalRegistry = /* Get the local registry */  
VSLOCALREGISTRYROOTHANDLE hKey = RegHandle_Invalid;  
BSTR bstrPath = NULL;  
if( SUCCEEDED( pLocalRegistry->GetRegistryRootEx(  
    RegType_UserSettings, &hKey, &bstrPath ) ) )  
{  
    HKEY hkUser = NULL;  
    LONG lr = RegOpenKeyEx( hKey, bstrPath, 0, KEY_READ, &hkUser );  
    if( ERROR_SUCCESS == lr )  
    {  
        // Query values as needed  
        RegCloseKey( hkUser );  
    }  
    SysFreeString(bstrPath);  
}  

Комментарии

GetLocalRegistryRootEx следует использовать для всего нового кода, который требует доступа к корню реестра. Метод позволяет разместить элементы конфигурации для каждого компьютера в реестре с другим ключом реестра и (или) путем.

Соответствующая служба — SID_SLocalRegistry

Этот интерфейс является потокобезопасным и может быть вызван из фонового потока напрямую или с помощью упакованного указателя.

Применяется к