Windows Registry is a collection of configurations, values, and properties of windows applications as well as the windows operating system which is organized and stored in a hierarchical manner in a singular repository.
Whenever a new program gets installed in the Windows system, an entry is made in the Windows Registry with its attributes such as size, version, location in the storage, etc.
Because, this information has been stored in the database, not only the operating system is aware of the resources utilized, other applications can also benefit from this information since they are aware of any conflicts that may arise if certain resources or files were to co-exist.
- What is the Windows Registry & How it Works?
- History of Windows Registry
- The relevance of Windows Registry with respect to other operating systems
- What are the benefits of the Windows Registry?
- How does Windows Registry Works?
- How to access the Windows Registry?
- Is it Safe to edit Registry Editor?
- Let’s explore the structure of the Windows Registry
- Common Root Keys in Windows Registry
- i. HKEY_CLASSES_ROOT
- ii. HKEY_LOCAL_MACHINE
- iii. HKEY_CURRENT_CONFIG
- iv. HKEY_CURRENT_USER
- v. HKEY_USERS
What is the Windows Registry & How it Works?
The Windows Registry is really the heart of the way Windows works. It is the only operating system that uses this approach of a central registry. If we were to visualize, every part of the operating system has to interact with the Windows Registry right from the booting sequence to something as simple as renaming the file’s name.
Simply put, it is just a database similar to that of a library card catalog, where the entries in the registry are like a stack of cards stored in the card catalog. A registry key would be a card and a registry value would be the important information written on that card. The Windows operating system uses the registry to store a bunch of information that’s used to control and manage our system and software. This can be anything from PC hardware information to user preferences and file types. Almost any form of configuration that we do to a Windows system involves editing the registry.
History of Windows Registry
In the initial versions of Windows, application developers had to include in a separate .ini file extension along with the executable file. This .ini file contained all the settings, properties and configuration required for the given executable program to function properly. However, this proved very inefficient due to the redundancy of certain information and it also posed a security threat to the executable program. As a result, a new implementation of standardized, centralized as well as secure technology was an apparent necessity.
With the advent of Windows 3.1, a bare-bones version of this demand was met with a central database common to all the applications and system called the Windows Registry.
This tool, however, was very limited, since the applications could only store certain configuration information of an executable. Over the years, Windows 95 and Windows NT further developed on this foundation, introduced centralization as the core feature in the newer version of Windows Registry.
That said, storing information in Windows Registry is an option for software developers. So, if a software application developer were to create a portable application, he is not required to add information to the registry, local storage with the configuration, properties, and values can be created and successfully shipped.
The relevance of Windows Registry with respect to other operating systems
Windows is the only operating system that uses this approach of a central registry. If we were to visualize, every part of the operating system has to interact with the Windows Registry right from the booting sequence to the renaming of a file name.
All other operating systems such as iOS, Mac OS, Android, and Linux continue to use text files as a way of configuring the operating system and modifying the operating system behavior.
In most of the Linux variants, the configuration files are saved in the .txt format, this becomes an issue when we have to work with the text files since all the .txt files are considered as critical system files. So if we try to open the text files in these operating systems, we wouldn’t be able to view it. These operating systems try to hide it as a security measure since all the system files such as configurations of the network card, firewall, operating system, graphical user interface, video cards interface, etc. are saved in the ASCII format.
To circumvent this issue both macOS, as well as iOS, deployed a completely different approach to the text file extension by implementing .plist extension, which contains all of the system as well as application configuration information but still the benefits of having a singular registry far outweigh the simple change of file extension.
What are the benefits of the Windows Registry?
Because Every part of the operating system continuously communicates with the Windows Registry, it must be stored in very fast storage. Hence, this database was designed for extremely fast reads and writes as well as efficient storage.
If we were to open and check the size of the registry database, it would typically hover between 15 – 20 megabytes which make it small enough to be always loaded into the RAM (Random Access Memory) that co-incidentally is the fastest storage available for the operating system.
Since the registry needs to be loaded in memory at all times, if the size of the registry is large it won’t leave enough room for all other applications to run smoothly or run at all. This would be detrimental to the performance of the operating system, hence the Windows Registry is designed with a core objective of being highly efficient.
If there are multiple users interacting with the same device and there are a number of applications that they use are common, the reinstallation of the same applications twice or multiple times would be a waste of rather expensive storage. Windows registry excels in these scenarios where the application configuration is shared among various users.
This not only reduces the total storage used but also gives its users access to make changes to the application’s configuration from one single interaction port. This also saves time since the user doesn’t have to manually go to every local storage .ini file.
Multi-User scenarios are very common in enterprise setups, here, there is a strong need for user privilege access. Since not all the information or resources can be shared with everyone, the need for privacy-based user access was easily implemented through the centralized windows registry. Here the network administrator reserves the right to withhold or allow based on the work undertaken. This made the singular database versatile as well made it robust since the updates can be undertaken simultaneously with remote access to all of the registries of multiple devices in the network.
How does Windows Registry Works?
Let’s explore the basics elements of the Windows Registry before we start getting our hands dirty.
The Windows Registry is made up of two basic elements called the Registry Key which is a container object or simply put they are like a folder that has various types of files stored in them and Registry Values which are non-container objects that are like files that could be of any format.
You should also know: How to Take Full Control or Ownership of Windows Registry Keys
How to access the Windows Registry?
We can access and configure the Windows Registry using a Registry Editor tool, Microsoft includes a free registry editing utility along with every version of its Windows Operating System.
This Registry Editor can be accessed by typing “Regedit” in the Command Prompt or by simply typing “Regedit” in the search or run box from the Start menu. This editor is the portal to access the Windows registry, and it helps us to explore and make changes to the registry. The registry is the umbrella term used by various database files located within the directory of the Windows installation.
Is it Safe to edit Registry Editor?
If you don’t know what you’re doing then it is dangerous to play around Registry configuration. Whenever you edit the Registry, make sure you follow the correct instructions and only change what you’re instructed to change.
If you knowingly or accidentally delete something in the Windows Registry then it could alter your system’s configuration which could either lead to Blue Screen of Death or Windows won’t boot.
So it is generally recommended to backup Windows Registry before making any changes to it. You can also create a system restore point (which automatically backup the Registry) that can be used if you ever need to alter the Registry settings back to normal. But if you only what you’re told then it shouldn’t be any problem. In case you need to know how to restore Windows Registry then this tutorial explains how to do so easily.
Let’s explore the structure of the Windows Registry
There is a user in an inaccessible storage location that exists for only the operating system’s access.
These Keys are loaded on to the RAM during the system boot stage and are constantly being communicated within a certain interval of time or when a certain system-level event or events take place.
A certain portion of these registry keys gets stored in the hard disk. These keys that are stored in the hard disk are called hives. This section of the registry contains registry keys, registry subkeys, and registry values. Depending on the level of the privilege a user has been granted, he would be to access certain parts of these keys.
The keys that are at the peak of the hierarchy in the registry that begins with HKEY are considered to be hives.
In the Editor, the hives are located on the left side of the screen when all the keys are viewed without expanding. These are the registry keys that appear as folders.
Let’s explore the structure of the windows registry key and its subkeys:
Example of a key name – “HKEY_LOCAL_MACHINE\SYSTEM\Input\Break\loc_0804”
Here the “loc_0804” refers to the subkey “Break” refers to the subkey “Input” which refers to the subkey “SYSTEM” of the HKEY_LOCAL_MACHINE root key.
Common Root Keys in Windows Registry
Each of the following keys is its own individual hive, which comprises more keys within the top-level key.
This registry hive HKEY_CLASSES_ROOT is the gateway for any action or event to take place in the Windows operating system. Suppose we want to access some mp3 files in the Downloads folder. The operating system runs its query through this to take the required actions.
The moment you access the HKEY_CLASSES_ROOT hive, it is really easy to get overwhelmed looking at such a massive list of extension files. However, these are the very registry keys that make windows function fluidly
Following are some of the examples of HKEY_CLASSES_ROOT hive registry keys,
HKEY_CLASSES_ROOT\.otf HKEY_CLASSES_ROOT\.htc HKEY_CLASSES_ROOT\.img HKEY_CLASSES_ROOT\.mhtml HKEY_CLASSES_ROOT\.png HKEY_CLASSES_ROOT\.dll
Whenever we double-click and open a file lets say a photo, the system sends the query through the HKEY_CLASSES_ROOT where the instructions on what to do when such a file is requested are clearly given. So the system ends up opening a photo viewer displaying the requested image.
In the above example, the registry makes a call to the keys stored in the HKEY_CLASSES_ROOT\.jpg key. The HKEY_CLASSES_ROOT hive is a collective data found in both the HKEY_LOCAL_MACHINE hive (HKEY_LOCAL_MACHINE\Software\Classes) as well as the HKEY_CURRENT_USER hive (HKEY_CURRENT_USER\Software\Classes). So when the registry key exists in two locations it creates conflicts. So the data found in HKEY_CURRENT_USER\Software\Classes is used in HKEY_ CLASSES_ ROOT. It can be accessed by opening the HKEY_CLASSES key on the left side of the screen.
This is one of the several registry hives that stores all the settings that are specific to the local computer. This is a global key where the information stored cannot be edited by any user or program. Due to the global nature of this subkey, all the information stored in this storage is in the form of a virtual container running on the RAM continuously. The majority of the configuration information for the software users have installed and the Windows operating system itself is occupied in HKEY_LOCAL_MACHINE. All of the currently detected hardware is stored in the HKEY_LOCAL_MACHINE hive.
Also know how to: Fix Regedit.exe Crashes when searching through Registry
This registry key is further divided into 7 sub-keys:
1. SAM (Security Accounts Manager) – It is a registry key file that stores users’ passwords in a secured format (in LM hash and NTLM hash). A hash function is a form of encryption used to protect the users’ account information.
It is a locked file that is located in the system at C:\WINDOWS\system32\config, which cannot be moved or copied when the operating system is running.
Windows uses the Security Accounts Manager registry key file to authenticate users while they log into their Windows accounts. Whenever a user logs in, Windows uses a series of hash algorithms to calculate a hash for the password that has been entered. If the entered password’s hash is equal to the password hash inside the SAM registry file, users will be allowed to access their account. This also a file that most of the hackers target while performing an attack.
2. Security (not accessible except by administrator) – This registry key is local to the account of the administrative user who is logged in to the current system. If the system is managed by any organization the users cannot access this file unless administrative access has been explicitly given to a user. If we were to open this file without administrative privilege it would be blank. Now, if our system is connected to an administrative network, this key will default to the local system security profile established and actively managed by the organization. This key is linked to the SAM, so upon successful authentication, depending on the privilege level of the user, a variety of local and group policies are applied.
3. System (critical boot process and other kernel functions) – This subkey contains important information related to the entire system such as computer name, currently mounted hardware devices, filesystem and what kind of automated actions can be taken in a certain event, say there is Blue screen of death due to CPU overheating, there is a logical procedure that the computer will automatically start taking in such an event. This file is only accessible by users with sufficient administrative privileges. When the system boots this is where all the logs get dynamically get saved and read upon. Various system parameters such as alternative configurations which are known as control sets.
4. Software All the Third-party software configurations such as plug and play drivers are stored here. This subkey contains software and Windows settings linked to the preexisting hardware profile that can be changed by various applications and system installers. Software developers get to limit or allow what information gets accessed by the users when their software is being used, this can be set using the “Policies” subkey that enforces the general usage policies on applications and system services that include the system certificates that is used to authenticate, authorize or disallow certain systems or services.
5. Hardware which is a subkey that is created dynamically during the system boot
6. Components system-wide device-specific component configuration information can be found here
7. BCD.dat (in the \boot folder in the system partition) which is a critical file that the system reads and starts executing during the system boot sequence by loading the registry to the RAM.
The main reason for the existence of this subkey is to store video as well as network settings. That could be all the information pertaining to the video card such as the resolution, refresh rate, aspect ratio, etc. as well as the network
It is also a registry hive, part of the Windows Registry, and which stores information about the hardware profile currently being used. HKEY_CURRENT_CONFIG is actually a pointer to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\HardwareProfiles\Currentregistry key, This is simply a pointer to the currently active hardware profile listed under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\HardwareProfiles key.
So HKEY_ CURRENT_CONFIG helps us to view and modify the configuration of the current user’s hardware profile, which we can do as an administrator in any of the three locations as listed above since they are all the same.
Part of the registry hives that contains store settings as well as configuration information for Windows and software that are specific to the currently logged-in user. For example, a variety of registry values in the registry keys are located in the HKEY_CURRENT_USER hive control user-level settings such as the keyboard layout, printers installed, desktop wallpaper, display settings, mapped network drives, and more.
Many of the settings you configure within various applets in the Control Panel are stored in the HKEY_CURRENT_USER registry hive. Because the HKEY_CURRENT_USER hive is user-specific, on the same computer, the keys and values contained in it will differ from user to user. This is unlike most other registry hives that are global, meaning they retain the same information across all users in Windows.
Clicking on the left side of the screen on the registry editor will give us access to HKEY_CURRENT_USER. As a security measure, the information stored on HKEY_CURRENT_USER is just a pointer to key positioned under the HKEY_USERS hive as our security identifier. Changes made to either of the areas will take effect immediately.
This contains subkeys corresponding to the HKEY_CURRENT_USER keys for each user profile. This is also one of many registry hives that we have in the Windows Registry.
All the user-specific configuration data is logged here, for everyone who is actively using the device that kind information is stored under HKEY_USERS. All the user-specific information stored on the system that corresponds to a particular user is stored under the HKEY_USERS hive, we can uniquely identify the users utilizing the security identifier or the SID that logs all the configuration changes made by the user.
All of these active users whose account exist in the HKEY_USERS hive depending on the privilege granted by the system administrator would be able to access the shared resources such as printers, local network, local storage drives, desktop background, etc. Their account has certain registry keys and corresponding registry values stored under the current user’s SID.
In terms of forensic information each SID stores a huge amount of data on every user as it makes a log of every event and action get undertaken under the user’s account. This includes the User’s Name, the number of times the user logged onto the computer, the date and time of the last login, the date and time the last password was changed, number of failed logins, and so on. Additionally, it also contains the registry information for when Windows loads and sits at the login prompt.
Recommended: Fix The Registry editor has stopped working
The registry keys for the default user are stored in the file ntuser.dat within the profile, that we would have to load this as a hive using regedit to add settings for the default user.
Types of data we can expect to find in the Windows Registry
All of the above-discussed keys and subkeys will have the configurations, values, and properties saved in any of the following data types, usually, it is a combination of the following data types that makes up our entire windows registry.
- String values such as Unicode which is a computing industry standard for the consistent encoding, representation, and handling of text expressed in most of the world’s writing systems.
- Binary data
- Unsigned integers
- Symbolic links
- Multi-string values
- Resource list (Plug and Play hardware)
- Resource descriptor (Plug and Play hardware)
- 64-bit integers
Windows Registry has been nothing less of a revolution, which not only minimized the security risk that came by using text files as a file extension to save the system and application configuration but it also reduced the number of configuration or .ini files that the application developers had to ship with their software product. The benefits of having a centralized repository to store frequently accessed data by both the system as well as the software that runs on the system are very evident.
The ease of use as well as the access to various customizations and settings in one central place has also made windows the preferred platform for desktop applications by various software developers. This is very evident if you compare the sheer volume of available desktop software applications of windows to Apple’s macOS. To summarize, we discussed how the Windows Registry works and its file structure and the significance of various registry key configurations as well as to use the registry editor to the complete effect.