Registry.LocalMachine フィールドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Registry.LocalMachine フィールドの意味・解説 

Registry.LocalMachine フィールド

ローカル コンピュータの構成データが格納されます。このフィールドには、Windows レジストリの基本キー HKEY_LOCAL_MACHINE が読み込まれます。

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

Public Shared ReadOnly LocalMachine
 As RegistryKey
Dim value As RegistryKey

value = Registry.LocalMachine
public static readonly RegistryKey LocalMachine
public:
static initonly RegistryKey^ LocalMachine
public static final RegistryKey LocalMachine
public static final var
 LocalMachine : RegistryKey
解説解説

LocalMachine には 5 つのキーが格納されています。

Hardware

コンピュータ内の物理ハードウェア、デバイス ドライバによるハードウェアの使用法、およびカーネル モード ドライバをユーザー モード コードにリンクするマップと関連データを記述します。このキーのデータはすべて、システムを起動するたびに再作成されます。Description サブキーには、実際のコンピュータ ハードウェアが記述されます。DeviceMap サブキーには、さまざまなデータが特定のドライバ クラスに固有の形式で格納されています。ResourceMap サブキーには、どのデバイス ドライバがどのハードウェア リソースを要求するかが記述されます。Windows NT 診断プログラム (Winmsdp.exe) は、このキーの内容を読みやすい形式で記述したレポートを作成します。

SAM

ユーザー アカウントおよびグループ アカウントのセキュリティ情報と、Windows 2000 サーバーのドメインのセキュリティ情報のディレクトリ サービス データベースです。SAM とは、ディレクトリ サービス データベースであるセキュリティ アカウント マネージャ (Security Account Manager) の略称です。

Security

特定のユーザーの権限など、ローカル セキュリティ ポリシーが格納されます。Windows 2000 セキュリティ サブシステムだけがこのキーを使用します。

Software

コンピュータ別ソフトウェア データベースです。このキーには、ローカル コンピュータにインストールされているソフトウェアに関するデータと、さまざまな構成データの各種項目が格納されています。

System

システムの起動、デバイス ドライバの読み込み、Windows 2000 サービス、およびその他のオペレーティング システムの動作を制御します。

通常、CurrentUser と LocalMachine に類似データが存在する場合には、CurrentUser のデータが優先されます。ただし、このキーの値は、Registry.LocalMachine のデータを置換ではなく拡張することもできます。デバイス ドライバ読み込みエントリなどの一部の項目が Registry.LocalMachine の外にある場合、これらの項目は無効です。

使用例使用例

このキーのサブキーを取得し、これらのサブキーの名前を画面に出力する方法の例を次に示します。必要な特定のサブキーのインスタンスを作成するには、OpenSubKey メソッドを使用します。次に、RegistryKey で別の演算を使用して、そのキーを操作します。

Imports System
Imports Microsoft.Win32

Class Reg
    
    Public Shared Sub Main()
        
        ' Create a RegistryKey, which will access the HKEY_LOCAL_MACHINE
        ' key in the registry of this machine.
        Dim rk As RegistryKey = Registry.LocalMachine
        
        ' Print out the keys.
        PrintKeys(rk)
    End Sub    
    
    Shared Sub PrintKeys(rkey As
 RegistryKey)
        
        ' Retrieve all the subkeys for the specified key.
        Dim names As String()
 = rkey.GetSubKeyNames()
        
        Dim icount As Integer
 = 0
        
        Console.WriteLine("Subkeys of " & rkey.Name)
        Console.WriteLine("-----------------------------------------------")
        
        ' Print the contents of the array to the console.
        Dim s As String
        For Each s In  names
            Console.WriteLine(s)
            
            ' The following code puts a limit on the number
            ' of keys displayed.  Comment it out to print the
            ' complete list.
            icount += 1            
            If icount >= 10 Then
                Exit For
            End If
        Next s
    End Sub
End Class
using System;
using Microsoft.Win32;

class Reg {
    public static void Main()
 {

        // Create a RegistryKey, which will access the HKEY_LOCAL_MACHINE
        // key in the registry of this machine.
         RegistryKey rk = Registry.LocalMachine;

        // Print out the keys.
        PrintKeys(rk);
    }

    static void PrintKeys(RegistryKey rkey)
 {

        // Retrieve all the subkeys for the specified key.
        String [] names = rkey.GetSubKeyNames();

        int icount = 0;

        Console.WriteLine("Subkeys of " + rkey.Name);
        Console.WriteLine("-----------------------------------------------");

        // Print the contents of the array to the console.
        foreach (String s in names) {
            Console.WriteLine(s);

            // The following code puts a limit on the number
            // of keys displayed.  Comment it out to print the
            // complete list.
            icount++;
            if (icount >= 10)
                break;
        }
    }
} 
using namespace System;
using namespace Microsoft::Win32;
void PrintKeys( RegistryKey ^ rkey )
{
   
   // Retrieve all the subkeys for the specified key.
   array<String^>^names = rkey->GetSubKeyNames();
   int icount = 0;
   Console::WriteLine( "Subkeys of {0}", rkey->Name );
   Console::WriteLine( "-----------------------------------------------"
 );
   
   // Print the contents of the array to the console.
   System::Collections::IEnumerator^ enum0 = names->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      String^ s = safe_cast<String^>(enum0->Current);
      Console::WriteLine( s );
      
      // The following code puts a limit on the number
      // of keys displayed.  Comment it out to print the
      // complete list.
      icount++;
      if ( icount >= 10 )
            break;
   }
}

int main()
{
   
   // Create a RegistryKey, which will access the HKEY_LOCAL_MACHINE
   // key in the registry of this machine.
   RegistryKey ^ rk = Registry::LocalMachine;
   
   // Print out the keys.
   PrintKeys( rk );
}

import System.*;
import Microsoft.Win32.*;

class Reg
{
    public static void main(String[]
 args)
    {
        // Create a RegistryKey, which will access the HKEY_LOCAL_MACHINE
        // key in the registry of this machine.
        RegistryKey rk = Registry.LocalMachine;
        // Print out the keys.
        PrintKeys(rk);
    } //main

    static void PrintKeys(RegistryKey rKey)
    {
        // Retrieve all the subkeys for the specified key.
        String names[] = rKey.GetSubKeyNames();
        int iCount = 0;

        Console.WriteLine("Subkeys of " + rKey.get_Name());
        Console.WriteLine("-----------------------------------------------");
        // Print the contents of the array to the console.
        String s = null;
        for (int iCtr = 0; iCtr < names.get_Length();
 iCtr++) {
            s = names[iCtr];
            Console.WriteLine(s);
            // The following code puts a limit on the number
            // of keys displayed.  Comment it out to print the
            // complete list.
            iCount++;
            if (iCount >= 10) {
                break;
            }
        }
    } //PrintKeys
} //Reg
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

Registry.LocalMachine フィールドのお隣キーワード
検索ランキング

   

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



Registry.LocalMachine フィールドのページの著作権

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

©2026 GRAS Group, Inc.RSS