Share via


Registry.LocalMachine Pole

Definice

Obsahuje konfigurační data pro místní počítač. Toto pole čte základní klíč registru systému Windows HKEY_LOCAL_MACHINE.

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 vytiskne jejich názvy na obrazovku. OpenSubKey Pomocí metody vytvořte instanci konkrétního podklíče, který vás zajímá. K manipulaci s tímto klíčem pak můžete použít jiné operace v nástroji 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í si nárokují, které hardwarové prostředky. Program systém Windows NT Diagnostics (Winmsdp.exe) může o svém obsahu informovat ve snadno čitelné podobě.

SAM Databáze adresářových služeb s informacemi o zabezpečení pro účty uživatelů a skupin a pro domény v systému Windows 2000 Server (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íč je používán pouze subsystémem zabezpečení systému 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í, služby systému Windows 2000 a chování operačního systému.

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

Platí pro