Hives, root keys and value types
How the registry is organised: the five root keys you see in Regedit, the hive files on disk behind them, per-user versus per-machine settings, 32-bit redirection and the data types a value can hold.
The five root keys
Regedit shows five root keys. Only two of them, HKEY_LOCAL_MACHINE and HKEY_USERS, are real containers of loaded hives. The other three are views or links into them, which is why the same setting can appear in two places.
HKEY_LOCAL_MACHINE (HKLM)
Settings for the whole computer, whoever signs in. Changing HKLM needs administrator rights. Its main subkeys and where they come from:
| Subkey | Hive file | What it holds |
|---|---|---|
HKLM\SYSTEM | %SystemRoot%\System32\config\SYSTEM | Boot configuration, drivers and services (CurrentControlSet\Services), networking, Terminal Server, Lsa, Control settings. |
HKLM\SOFTWARE | %SystemRoot%\System32\config\SOFTWARE | Installed software, Windows components, machine policies (SOFTWARE\Policies), Uninstall and Run keys. |
HKLM\SAM | %SystemRoot%\System32\config\SAM | Local user and group database. Protected: only SYSTEM can read it. |
HKLM\SECURITY | %SystemRoot%\System32\config\SECURITY | Local security policy and LSA secrets. Protected: only SYSTEM can read it. |
HKLM\HARDWARE | None (volatile) | Hardware detected at boot. Rebuilt every start, never saved to disk. |
HKLM\BCD00000000 | \Boot\BCD on the system partition | Boot Configuration Data. Edit it with bcdedit, not Regedit. |
CurrentControlSet is a link to one of the numbered control sets (ControlSet001, ...). HKLM\SYSTEM\Select records which one is current.
HKEY_USERS (HKU)
Every user profile that is loaded right now, one subkey per security identifier (SID): signed-in users, services running as a user, and the built-in accounts S-1-5-18 (LocalSystem), S-1-5-19 (LocalService) and S-1-5-20 (NetworkService). Each user also has a <SID>_Classes subkey.
HKU\.DEFAULT is the profile of the LocalSystem account (file config\DEFAULT). It is not the template for new users. New profiles are copied from C:\Users\Default\NTUSER.DAT, which you edit by loading it as a hive (see the NTUSER.DAT lesson).
HKEY_CURRENT_USER (HKCU)
A link to HKU\<SID of the signed-in user>. It is loaded from the user's %USERPROFILE%\NTUSER.DAT at sign-in and saved back at sign-out. The user's class registrations come from %LOCALAPPDATA%\Microsoft\Windows\UsrClass.dat. Users can change most of HKCU without admin rights, except HKCU\SOFTWARE\Policies, which only Group Policy and admins write.
When a script runs as SYSTEM (for example from Intune, Configuration Manager or a scheduled task), HKCU is the SYSTEM account's profile, not the signed-in user's. Write per-user settings through HKU\<SID>, Active Setup, or a script that runs in the user's context.
HKEY_CLASSES_ROOT (HKCR)
A merged view of HKLM\SOFTWARE\Classes (machine-wide) and HKCU\SOFTWARE\Classes (per user). File associations, ProgIDs and COM registrations live here. When both define the same key, the user's version wins. Write to the specific HKLM or HKCU path, not to HKCR, so you know which one you changed.
HKEY_CURRENT_CONFIG (HKCC)
A link to HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current. Rarely used on modern Windows.
Policy keys and "tattooing"
Group Policy Administrative Templates write to four policy branches: HKLM\SOFTWARE\Policies, HKCU\SOFTWARE\Policies, HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies and HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies. Windows removes values in these branches when the GPO no longer applies. A setting written anywhere else (for example by Group Policy Preferences or an old custom ADM template) stays behind after the GPO is removed, which admins call "tattooing".
A value under a Policies key always wins over the same preference set in the UI. That is why Settings shows "Some settings are managed by your organization".
32-bit and 64-bit views (WOW6432Node)
On 64-bit Windows, 32-bit programs that open HKLM\SOFTWARE are redirected to HKLM\SOFTWARE\WOW6432Node. That is why an installed 32-bit application's settings and Uninstall entry appear under WOW6432Node. Tools let you choose the view: reg.exe ... /reg:32 or /reg:64, and in PowerShell [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine','Registry32'). Microsoft's registry redirector article lists which keys are redirected and which are shared.
Value types
| Type | Holds | Example |
|---|---|---|
REG_SZ | A text string | SharedComputerLicensing = "1" |
REG_EXPAND_SZ | Text with environment variables expanded when read | %SystemRoot%\System32\... |
REG_MULTI_SZ | A list of strings | FSLogix VHDLocations |
REG_DWORD | A 32-bit number. Regedit shows it in hexadecimal unless you pick Decimal | PortNumber = 3389 |
REG_QWORD | A 64-bit number | Large counters and sizes |
REG_BINARY | Raw bytes | Hardware and UI state blobs |
REG_NONE | No defined type | Markers whose presence is what matters |
Each key also has a "(Default)" unnamed value. Microsoft documents the size limits (key names up to 255 characters, value names up to 16,383 characters) and recommends storing large data in files instead of the registry.
Hive files, logs and backups on disk
The machine hives live in %SystemRoot%\System32\config next to their transaction logs (.LOG1, .LOG2). They are always open while Windows runs, so you can't copy them with Explorer: use reg save, a Volume Shadow Copy, or a backup product (see Backup and restore).