Registry.LocalMachine Pole

Definice

Obsahuje konfigurační data pro místní počítač. Toto pole načte HKEY_LOCAL_MACHINE základního klíče registru Windows.

public: static initonly Microsoft::Win32::RegistryKey ^ LocalMachine;
public static readonly Microsoft.Win32.RegistryKey LocalMachine;
 staticval mutable LocalMachine : Microsoft.Win32.RegistryKey
Public Shared ReadOnly LocalMachine As RegistryKey 

Hodnota pole

Příklady

Následující příklad ukazuje, jak načíst podklíče tohoto klíče a vytisknout jejich názvy na obrazovku. Použijte metodu OpenSubKey k vytvoření instance konkrétního podklíče zájmu. K manipulaci s tímto klíčem pak můžete použít jiné operace RegistryKey .

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

Poznámky

LocalMachine obsahuje pět klíčů:

Hardware popisuje fyzický hardware v počítači, způsob, jakým ovladače zařízení používají tento hardware, a mapování a související data, která propojují ovladače režimu jádra s kódem uživatelského režimu. Všechna data v tomto klíči se znovu vytvoří při každém spuštění systému. Podklíč Popis popisuje skutečný hardware počítače. Podklíč DeviceMap obsahuje různá data ve formátech specifických pro konkrétní třídy ovladačů. Podklíč ResourceMap popisuje, které ovladače zařízení deklarují, které hardwarové prostředky. Program Windows NT Diagnostics (Winmsdp.exe) může hlásit obsah v snadno čitelné podobě.

Databáze adresářových služeb databáze bezpečnostních údajů pro účty uživatelů a skupin a pro domény v Windows 2000 Serveru (SAM je Správce účtů zabezpečení, označovaný jako databáze adresářových služeb).

Zabezpečení obsahuje místní zásady zabezpečení, například konkrétní uživatelská práva. Tento klíč používá pouze subsystém zabezpečení Windows 2000.

Software Databáze softwaru pro jednotlivé počítače. Tento klíč obsahuje data o softwaru nainstalovaném v místním počítači spolu s různými položkami různých konfiguračních dat.

Systém řídí spouštění systému, načítání ovladačů zařízení, Windows 2000 služeb a chování operačního systému.

Podle konvence platí, že pokud podobná data existují v CurrentUser rámci a pod LocalMachine, mají přednost data v CurrentUser dané oblasti. Hodnoty v tomto klíči však mohou také rozšířit (místo nahrazení) dat v Registry.LocalMachine. Některé položky (například položky načítání ovladačů zařízení) jsou také nesmyslné, pokud se vyskytují mimo Registry.LocalMachine.

Platí pro