Microsoft Docs

Registry Functions

This section describes the functions used to access and manipulate the Windows registry. The registry is a hierarchical database that stores configuration settings and options for the operating system and for applications that opt to use it.

Overview

The registry is organized into keys and values. Keys are like folders, and values are like files that contain data. The Win32 API provides a set of functions to:

Key Registry Functions

Opening and Closing Keys

You must open a registry key before you can access its values or subkeys. The RegOpenKeyEx function is commonly used for this purpose.

Querying Registry Values

To retrieve the data associated with a registry value, use RegQueryValueEx.

Setting Registry Values

You can create new values or modify existing ones using RegSetValueEx.

Enumerating Keys and Values

To list the subkeys or values within a registry key, you can use the enumeration functions.

Function Description
RegEnumKeyEx Enumerates subkeys of the specified registry key.
RegEnumValue Enumerates the values of the specified registry key.

Registry Hives

The registry is composed of several root keys, also known as hives. Some of the most common ones include:

These predefined handles can be passed as the hKey parameter to functions like RegOpenKeyEx.

See Also