ILocalRegistry4.GetLocalRegistryRootEx(UInt32, UInt32, String) Método

Definição

Retorna a raiz do Registro local.

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

Parâmetros

dwRegType
UInt32

no Um __VsLocalRegistryType valor que especifica o hive do registro.

pdwRegRootHandle
UInt32

no Um __VsLocalRegistryRootHandle valor que especifica o identificador raiz do registro.

pbstrRoot
String

fora Ponteiro para uma cadeia de caracteres que contém a raiz do Registro local.

Retornos

Int32

Se o método for bem-sucedido, retornará S_OK. Se falhar, retornará um código de erro.

Exemplos

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);  
}  

Comentários

GetLocalRegistryRootEx deve ser usado para todo o novo código que requer acesso à raiz do registro. O método permite colocar as partes de configuração por computador do registro em uma chave de registro e/ou caminho diferente.

O serviço correspondente está SID_SLocalRegistry

Essa interface é thread-safe e pode ser chamada a partir de um thread em segundo plano diretamente ou usando um ponteiro marshaled.

Aplica-se a