RegistryHive 列挙体とは? わかりやすく解説

RegistryHive 列挙体

外部コンピュータ最上位ノードの有効値を表します

名前空間: Microsoft.Win32
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration RegistryHive
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum RegistryHive
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum class RegistryHive
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum RegistryHive
SerializableAttribute 
ComVisibleAttribute(true) 
public enum RegistryHive
メンバメンバ
 メンバ説明
ClassesRoot別のコンピュータの HKEY_CLASSES_ROOT 基本キー表します。この値を OpenRemoteBaseKey メソッドに渡すと、このノードリモートから開くことができます。 
CurrentConfig別のコンピュータの HKEY_CURRENT_CONFIG 基本キー表します。この値を OpenRemoteBaseKey メソッドに渡すと、このノードリモートから開くことができます。 
CurrentUser別のコンピュータの HKEY_CURRENT_USER 基本キー表します。この値を OpenRemoteBaseKey メソッドに渡すと、このノードリモートから開くことができます。 
DynData別のコンピュータの HKEY_DYN_DATA 基本キー表します。この値を OpenRemoteBaseKey メソッドに渡すと、このノードリモートから開くことができます。 
LocalMachine別のコンピュータの HKEY_LOCAL_MACHINE 基本キー表します。この値を OpenRemoteBaseKey メソッドに渡すと、このノードリモートから開くことができます。 
PerformanceData別のコンピュータの HKEY_PERFORMANCE_DATA 基本キー表します。この値を OpenRemoteBaseKey メソッドに渡すと、このノードリモートから開くことができます。 
Users別のコンピュータの HKEY_USERS 基本キー表します。この値を OpenRemoteBaseKey メソッドに渡すと、このノードリモートから開くことができます。 
解説解説
使用例使用例

リモート コンピュータレジストリ キー開き、そのキーの値を列挙する方法次のコード例示しますリモート コンピュータは、リモート レジストリ サービス実行している必要がありますプログラム呼び出すときにリモート コンピュータ名をコマンドライン引数として指定します

Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports System.Security.Permissions
Imports Microsoft.Win32

<Assembly: RegistryPermissionAttribute( _
    SecurityAction.RequestMinimum, _
    Read := "HKEY_CURRENT_USER\Environment")>
<Assembly: SecurityPermissionAttribute( _
    SecurityAction.RequestMinimum, UnmanagedCode := True)>

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
using System;
using System.IO;
using System.Security.Permissions;
using Microsoft.Win32;

[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum,
    Read = @"HKEY_CURRENT_USER\Environment")]
[assembly: SecurityPermissionAttribute(SecurityAction.RequestMinimum,
    UnmanagedCode = true)]

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();
    }
}
using namespace System;
using namespace System::IO;
using namespace System::Security::Permissions;
using namespace Microsoft::Win32;

[assembly:RegistryPermissionAttribute(SecurityAction::RequestMinimum,
Read="HKEY_CURRENT_USER\\Environment")];
[assembly:SecurityPermissionAttribute(SecurityAction::RequestMinimum,
UnmanagedCode=true)];
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();
}

import System.*;
import System.IO.*;
import System.Security.Permissions.*;
import Microsoft.Win32.*;

/** @assembly RegistryPermissionAttribute(SecurityAction.RequestMinimum, 
    Read = "HKEY_CURRENT_USER\\Environment")
 */
/** @assembly SecurityPermissionAttribute(SecurityAction.RequestMinimum, 
    UnmanagedCode = true)
 */
class RemoteKey
{
    public static void main(String[]
 args)
    {
        RegistryKey environmentKey;
        String remoteName;
        // Check that an argument was specified when the 
        // program was invoked.
        if (args.get_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().get_Name(), 
                e.get_Message());
            return;
        }

        // Print the values.
        Console.WriteLine("\nThere are {0} values for {1}.",
 
            Convert.ToString(environmentKey.get_ValueCount()), 
            environmentKey.get_Name());
        for (int iCtr = 0; iCtr < environmentKey.GetValueNames().get_Length();
            iCtr++) {
            String valueName = (String)environmentKey.GetValueNames().
                get_Item(iCtr);
            Console.WriteLine("{0,-20}: {1}", valueName, 
                environmentKey.GetValue(valueName).ToString());
        }

        // Close the registry key.
        environmentKey.Close();
    } //main
} //RemoteKey
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Microsoft.Win32 名前空間
OpenRemoteBaseKey
RegistryKey



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「RegistryHive 列挙体」の関連用語

RegistryHive 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RegistryHive 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS