windows registry

References

Jolanta Thomassen's thesis Peter Norris' masters thesis

Summary

In my journey to learn a bit more about computer science, it might be nice to learn how to play with the registry

The registry is a big dictionary

The registry contains

Files

The registry files are in Windows/system32/config The database files are called hives

Info specific to certain users are in NTUSER.dat and the USRCLASS.dat hives

Hives are made up of 4-KB sections called bins

Hbins are in turn made up of different sections, called cells

Interestingly, the size of a key is negative If the key is deleted, then its size is made positive

Unlike keys, value cells don't contain pointers to other cells

Registry Redirection

On 64-bit Windows, some registry calls by 32-bit apps are redirected to a different hive

Registry Virtualization

Registry modifications that have a global aspect on the system will be written to a virtual store

History

The Registry's purpose is to replace the config and init files that Windows 3.1 used

Poorly Understood

There is no full listing of what actions by a user or the OS impact which Registry keys, and how they do so

Logging

The Registry acts as a log file

Persistence

One of the reasons that the Registry gets used in malware is that the Registry has persistence across reboots and logins

ex. It lets the system remember that you've plugged in a certain device before

ex. It remembers your settings for apps, if you don't use the defaults

ex. It remembers recently accessed files

Note: not all apps create a presence in the registry

Different Versions

The binary structure of the registry has been more-or-less unchanged across different versions of Windows

Registry Editor

The GUI

Parts of the registry visible in the editor are volatile

In the local machine system hive, there's a key called CurrentControlSet

HKEY_CLASSES_ROOT

File System Tunneling

An OS's ability to hold onto file system metadata

Microsoft Knowledge Base

Prefetch Files (.pf)

Dynamic Linked Library (.dll)

Dwords

These are 32-bit binary values

Volume Shadew Copies

HKEY Current USER

Settings for the person currently logged in

Software/Policies/Microsoft/Windows/Explorer

To get rid of internet suggestions when you search something in explorer

Software/Microsoft/Windows/CurrentVersion/Explorer/Serialize

If the Serialize folder/key doesn't already exist, create it, and add two dwords

For some reason Windows delays the startup of certain apps; in particular, when I put apps in the startup folder, it delays them (like emacs and Neptune)

HKey Classes Root

This is a really cool part of the registry — you can use it to edit the right-click menu that appears when you right click a file or blank space in Windows Explorer

It controls

There are a bunch of keys in here that are all a dot followed by an extension: ex: .txt

ShellNew

If this appears in a .extension key, it will cause right clicking a blank space in Explorer and going to "new" on the menu, to give "create a new .extension file" as an option

Shell

This is the subkey for what happens when you right click on a particular file type

Wildcard

The asterisk is a wildcard, and corresponds to every file type

Directory

This controls what happens when you right-click a folder

Background

This subkey controls what happens when you click on the blank space in a folder

HKey Local Machine

HKey Users