閱讀英文

共用方式為


Registry.LocalMachine 欄位

定義

包含本機電腦的組態資料。 這個欄位會讀取 Windows 登錄主要機碼 HKEY_LOCAL_MACHINE。

public static readonly Microsoft.Win32.RegistryKey LocalMachine;

欄位值

範例

下列範例示範如何擷取此機碼的子機碼,並將其名稱列印到畫面。 OpenSubKey使用方法來建立感興趣的特定子機碼實例。 然後,您可以在 中使用 RegistryKey 其他作業來操作該索引鍵。

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

備註

LocalMachine 包含五個索引鍵:

硬體描述計算機中的實體硬體、設備驅動器使用該硬體的方式,以及對應與核心模式驅動程式與使用者模式程式代碼連結的相關數據。 每次啟動系統時,都會重新建立此金鑰中的所有數據。 Description 子機碼描述實際的計算機硬體。 DeviceMap 子機碼包含特定驅動程式類別的特定格式其他數據。 ResourceMap 子機碼描述哪些設備驅動器會宣告哪些硬體資源。 Windows NT 診斷程式 (Winmsdp.exe) 可以在容易閱讀的窗體中報告其內容。

SAM 使用者和組帳戶安全性資訊的目錄服務資料庫,以及 Windows 2000 Server (SAM 中的網域目錄服務資料庫,稱為目錄服務資料庫) 。

安全性包含本機安全策略,例如特定用戶權力。 此金鑰僅供 Windows 2000 安全性子系統使用。

軟體 每部計算機軟體資料庫。 此金鑰包含有關安裝在本機電腦上的軟體數據,以及其他組態數據的各種專案。

系統控制系統啟動、裝置驅動程式載入、Windows 2000 服務和作業系統行為。

依照慣例,如果 類似數據存在於和 底下CurrentUserLocalMachine,則數據CurrentUser會優先使用。 不過,此機碼中的值也可以擴充 (,而不是取代 Registry.LocalMachine 中的) 數據。 此外,某些專案 (例如設備驅動器載入專案,) 在 Registry.LocalMachine 外部發生,則沒有意義。

適用於