RegistryHive 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
외세의 최상위 노드에 사용할 수 있는 값을 나타냅니다.
public enum class RegistryHive
[System.Serializable]
public enum RegistryHive
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum RegistryHive
[<System.Serializable>]
type RegistryHive =
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type RegistryHive =
Public Enum RegistryHive
- 상속
- 특성
필드
| Name | 값 | Description |
|---|---|---|
| ClassesRoot | -2147483648 | 다른 컴퓨터의 HKEY_CLASSES_ROOT 기본 키를 나타냅니다. 이 값을 메서드에 전달하여 OpenRemoteBaseKey(RegistryHive, String) 이 노드를 원격으로 열 수 있습니다. |
| CurrentUser | -2147483647 | 다른 컴퓨터의 HKEY_CURRENT_USER 기본 키를 나타냅니다. 이 값을 메서드에 전달하여 OpenRemoteBaseKey(RegistryHive, String) 이 노드를 원격으로 열 수 있습니다. |
| LocalMachine | -2147483646 | 다른 컴퓨터의 HKEY_LOCAL_MACHINE 기본 키를 나타냅니다. 이 값을 메서드에 전달하여 OpenRemoteBaseKey(RegistryHive, String) 이 노드를 원격으로 열 수 있습니다. |
| Users | -2147483645 | 다른 컴퓨터의 HKEY_USERS 기본 키를 나타냅니다. 이 값을 메서드에 전달하여 OpenRemoteBaseKey(RegistryHive, String) 이 노드를 원격으로 열 수 있습니다. |
| PerformanceData | -2147483644 | 다른 컴퓨터의 HKEY_PERFORMANCE_DATA 기본 키를 나타냅니다. 이 값을 메서드에 전달하여 OpenRemoteBaseKey(RegistryHive, String) 이 노드를 원격으로 열 수 있습니다. |
| CurrentConfig | -2147483643 | 다른 컴퓨터의 HKEY_CURRENT_CONFIG 기본 키를 나타냅니다. 이 값을 메서드에 전달하여 OpenRemoteBaseKey(RegistryHive, String) 이 노드를 원격으로 열 수 있습니다. |
| DynData | -2147483642 | 다른 컴퓨터의 HKEY_DYN_DATA 기본 키를 나타냅니다. 이 값을 메서드에 전달하여 OpenRemoteBaseKey(RegistryHive, String) 이 노드를 원격으로 열 수 있습니다. |
예제
다음 코드 예제에서는 원격 컴퓨터에서 레지스트리 키를 열고 키의 값을 열거하는 방법을 보여 있습니다. 원격 컴퓨터가 원격 레지스트리 서비스를 실행해야 합니다. 프로그램을 호출할 때 원격 컴퓨터의 이름을 명령줄 인수로 지정합니다.
using namespace System;
using namespace System::IO;
using namespace System::Security::Permissions;
using namespace Microsoft::Win32;
int main( int argc, char *argv[] )
{
RegistryKey ^ environmentKey;
// Check that an argument was specified when the
// program was invoked.
if ( argc == 1 )
{
Console::WriteLine( "Error: The name of the remote computer "
"must be specified as input on the command line." );
return -1;
}
try
{
// Open HKEY_CURRENT_USER\Environment on a remote computer.
environmentKey = RegistryKey::OpenRemoteBaseKey( RegistryHive::CurrentUser, gcnew String(argv[ 1 ]) )->OpenSubKey( "Environment" );
}
catch ( IOException^ e )
{
Console::WriteLine( "{0}: {1}", e->GetType()->Name, e->Message );
return -1;
}
// Print the values.
Console::WriteLine( "\nThere are {0} values for {1}.", environmentKey->ValueCount.ToString(), environmentKey->Name );
array<String^>^valueNames = environmentKey->GetValueNames();
for ( int i = 0; i < environmentKey->ValueCount; i++ )
{
Console::WriteLine( "{0,-20}: {1}", valueNames[ i ], environmentKey->GetValue( valueNames[ i ] )->ToString() );
}
// Close the registry key.
environmentKey->Close();
}
using System;
using System.IO;
using System.Security.Permissions;
using Microsoft.Win32;
class RemoteKey
{
static void Main(string[] args)
{
RegistryKey environmentKey;
string remoteName;
// Check that an argument was specified when the
// program was invoked.
if(args.Length == 0)
{
Console.WriteLine("Error: The name of the remote " +
"computer must be specified when the program is " +
"invoked.");
return;
}
else
{
remoteName = args[0];
}
try
{
// Open HKEY_CURRENT_USER\Environment
// on a remote computer.
environmentKey = RegistryKey.OpenRemoteBaseKey(
RegistryHive.CurrentUser, remoteName).OpenSubKey(
"Environment");
}
catch(IOException e)
{
Console.WriteLine("{0}: {1}",
e.GetType().Name, e.Message);
return;
}
// Print the values.
Console.WriteLine("\nThere are {0} values for {1}.",
environmentKey.ValueCount.ToString(),
environmentKey.Name);
foreach(string valueName in environmentKey.GetValueNames())
{
Console.WriteLine("{0,-20}: {1}", valueName,
environmentKey.GetValue(valueName).ToString());
}
// Close the registry key.
environmentKey.Close();
}
}
Imports System.IO
Imports System.Security.Permissions
Imports Microsoft.Win32
Public Class RemoteKey
Shared Sub Main(commandLineArgs As String())
Dim environmentKey As RegistryKey
' Check that an argument was specified when the
' program was invoked.
If commandLineArgs.Length = 0 Then
Console.WriteLine("Error: The name of the remote " & _
"computer must be specified as input on the " & _
"command line.")
Return
End If
Try
' Open HKEY_CURRENT_USER\Environment on a remote computer.
environmentKey = RegistryKey.OpenRemoteBaseKey( _
RegistryHive.CurrentUser, _
commandLineArgs(0)).OpenSubKey("Environment")
Catch ex As IOException
Console.WriteLine("{0}: {1}", _
ex.GetType().Name, ex.Message)
Return
End Try
' Print the values.
Console.WriteLine("\nThere are {0} values For {1}.", _
environmentKey.ValueCount.ToString(), environmentKey.Name)
For Each valueName As String In environmentKey.GetValueNames()
Console.WriteLine("{0,-20}: {1}", valueName, _
environmentKey.GetValue(valueName).ToString())
Next
' Close the registry key.
environmentKey.Close()
End Sub
End Class
설명
RegistryHive 값은 외래(원격) 컴퓨터에서 요청된 키의 최상위 노드를 나타내기 위해 메서드에서 사용됩니다 OpenRemoteBaseKey . OpenRemoteBaseKey 메서드를 사용하여 열 수 있는 노드는 이러한 최상위 수준 RegistryKeys중 하나여야 합니다. 사용자에게 적절한 권한이 있는 한 식별된 노드의 하위 키에 대한 추가 액세스는 메서드를 RegistryKey사용하여 사용할 수 있습니다.