Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Speichert die Konfigurationsinformationen für den lokalen Computer. Dieses Feld liest den Basisschlüssel HKEY_LOCAL_MACHINE der Windows-Registrierung.
Namespace: Microsoft.Win32
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Shared ReadOnly LocalMachine As RegistryKey
'Usage
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
Hinweise
LocalMachine enthält fünf Schlüssel:
Hardware
Beschreibt die physische Hardware im Computer, die Verwendung dieser Hardware durch die Gerätetreiber sowie Zuordnungen und zugehörige Daten, die Treiber für den Kernelmodus mit Code im Benutzermodus verbinden. Sämtliche Daten dieses Schlüssels werden bei jedem Systemstart neu erstellt. Der Unterschlüssel Description beschreibt die eigentliche Computerhardware. Der Unterschlüssel DeviceMap enthält diverse Daten in speziellen Formaten für bestimmte Treiberklassen. Der Unterschlüssel ResourceMap beschreibt, welcher Gerätetreiber für welche Hardwareressourcen zuständig ist. Mit dem Diagnoseprogramm von Windows NT (Winmsdp.exe) kann ein übersichtlicher Bericht über den Inhalt erstellt werden.
SAM
Die Verzeichnisdienstdatenbank mit Sicherheitsinformationen über Benutzer- und Gruppenkonten und Domänen unter Windows 2000 Server. SAM steht für Security Account Manager (Sicherheitskontenverwaltung) und wird auch als Verzeichnisdienstdatenbank bezeichnet.
Security
Enthält die lokale Sicherheitsrichtlinie, z. B. bestimmte Benutzerrechte. Dieser Schlüssel wird nur vom Sicherheitssubsystem von Windows 2000 verwendet.
Software
Die Softwaredatenbank für einen Computer. Dieser Schlüssel enthält Daten über die auf diesem Computer installierte Software sowie verschiedene Konfigurationsdaten.
System
Steuert den Systemstart, das Laden der Gerätetreiber, die Windows 2000-Dienste und das Verhalten des Betriebssystems.
Wenn unter CurrentUser und LocalMachine ähnliche Daten vorhanden sind, haben die Daten in CurrentUser Vorrang. Werte in diesem Schlüssel können Daten in Registry.LocalMachine ergänzen, nicht jedoch ersetzen. Darüber hinaus sind einige Elemente, z. B. Einträge für das Laden der Gerätetreiber, außerhalb von Registry.LocalMachine bedeutungslos.
Beispiel
Im folgenden Beispiel wird das Abrufen von Unterschlüsseln aus diesem Schlüssel veranschaulicht. Die Namen werden dann auf dem Bildschirm ausgegeben. Erstellen Sie mit der OpenSubKey-Methode eine Instanz des betreffenden Unterschlüssels. Mit den weiteren Operationen von RegistryKey können Sie diesen Schlüssel verändern.
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
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0