Registry.LocalMachine Campo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Contiene i dati di configurazione per il computer locale. Questo campo legge la chiave di base del Registro di sistema 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
Valore del campo
Esempio
Nell'esempio seguente viene illustrato come recuperare le sottochiavi di questa chiave e stamparne i nomi sullo schermo. Utilizzare il OpenSubKey metodo per creare un'istanza della sottochiave specifica di interesse. È quindi possibile usare altre operazioni in RegistryKey per modificare tale chiave.
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
Commenti
LocalMachine contiene cinque chiavi:
Hardware Descrive l'hardware fisico nel computer, il modo in cui i driver di dispositivo usano l'hardware e i mapping e i dati correlati che collegano i driver in modalità kernel al codice in modalità utente. Tutti i dati in questa chiave vengono ricreati ogni volta che il sistema viene avviato. La sottochiave Description descrive l'hardware del computer effettivo. La sottochiave DeviceMap contiene dati esterni in formati specifici per specifiche classi di driver. La sottochiave ResourceMap descrive quali driver di dispositivo dichiarano quali risorse hardware. Il programma di diagnostica NT Windows (Winmsdp.exe) può segnalarne il contenuto in un modulo di facile lettura.
SAM Il database dei servizi directory delle informazioni di sicurezza per gli account utente e di gruppo e per i domini in Windows 2000 Server (SAM è il gestore account di sicurezza, noto come database dei servizi directory).
Sicurezza Contiene i criteri di sicurezza locali, ad esempio diritti utente specifici. Questa chiave viene usata solo dal sottosistema di sicurezza Windows 2000.
Software Il database software per computer. Questa chiave contiene i dati relativi al software installato nel computer locale, insieme a vari elementi di dati di configurazione vari.
System Controls system startup, device driver loading, Windows 2000 services e operating system behavior.
Per convenzione, se esistono dati simili in CurrentUser e in LocalMachine, i dati in CurrentUser hanno la precedenza. Tuttavia, i valori in questa chiave possono anche estendere (anziché sostituire) i dati in Registry.LocalMachine. Inoltre, alcuni elementi ,ad esempio le voci di caricamento del driver di dispositivo, non hanno significato se si verificano all'esterno di Registry.LocalMachine.