Bagikan melalui


Registry.LocalMachine Bidang

Definisi

Berisi data konfigurasi untuk komputer lokal. Bidang ini membaca HKEY_LOCAL_MACHINE kunci dasar registri 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 

Nilai Bidang

Contoh

Contoh berikut menunjukkan cara mengambil subkey kunci ini, dan mencetak namanya ke layar. OpenSubKey Gunakan metode untuk membuat instans subkunci tertentu yang diminati. Anda kemudian dapat menggunakan operasi RegistryKey lain untuk memanipulasi kunci tersebut.

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

Keterangan

LocalMachine berisi lima kunci:

Perangkat keras Menjelaskan perangkat keras fisik di komputer, cara driver perangkat menggunakan perangkat keras tersebut, dan pemetaan serta data terkait yang menautkan driver mode kernel dengan kode mode pengguna. Semua data dalam kunci ini dibuat ulang setiap kali sistem dimulai. Subkunci Deskripsi menjelaskan perangkat keras komputer yang sebenarnya. Subkunci DeviceMap berisi data lain-lain dalam format khusus untuk kelas driver tertentu. Subkunci ResourceMap menjelaskan driver perangkat mana yang mengklaim sumber daya perangkat keras mana. Program Diagnostik Windows NT (Winmsdp.exe) dapat melaporkan isinya dalam bentuk yang mudah dibaca.

SAM Database layanan direktori informasi keamanan untuk akun pengguna dan grup, dan untuk domain di Windows 2000 Server (SAM adalah Manajer Akun Keamanan, yang dikenal sebagai database layanan direktori).

Keamanan Berisi kebijakan keamanan lokal, seperti hak pengguna tertentu. Kunci ini hanya digunakan oleh subsistem keamanan Windows 2000.

Perangkat Lunak Database perangkat lunak per komputer. Kunci ini berisi data tentang perangkat lunak yang diinstal di komputer lokal, bersama dengan berbagai item data konfigurasi lainnya.

Startup sistem Kontrol Sistem, pemuatan driver perangkat, layanan Windows 2000, dan perilaku sistem operasi.

Menurut konvensi, jika data serupa ada di bawah CurrentUser dan di bawah LocalMachine, data diutamakan CurrentUser . Namun, nilai dalam kunci ini juga dapat memperluas (daripada mengganti) data di Registry.LocalMachine. Selain itu, beberapa item (seperti entri pemuatan driver perangkat) tidak ada artinya jika terjadi di luar Registry.LocalMachine.

Berlaku untuk