Work with Windows Registry via Embarcadero Delphi VCL App
Work with Windows Registry via Delphi VCL App

Work with Windows Registry via Embarcadero Delphi VCL App

What is Windows Registry? How can we use it?

The Windows operating system and its applications store various data and settings in special files or databases.

One of the ways to store application and operating system settings is to do it through configuration files (files with the .ini extension).

The system registry is a specific way for the Windows operating system and its applications to store settings. It is a specialized database that stores settings for current users, applications, hardware information, and more. Settings and parameters in the Windows registry can be stored in the string format (REG_SZ), as 32-bit integers (REG_DWORD), in the binary form (REG_BINARY), etc. To access registry settings in Windows, there is a special utility called Regedit (registry editor).

Windows registry

After launching this utility, we will see the following root sections in the left part of the registry editor.

Registry sections

The HKEY_CLASSES_ROOT section is used to store and manage file associations.

The HKEY_CURRENT_USER section contains settings for the current user, whose credentials were applied to get access to the system. It stores most settings for the installed programs. It is also a link to the user’s profile in HKEY_USERS.

The HKEY_LOCAL_MACHINE section stores settings for Windows and applications for all users.

The HKEY_USERS section stores settings for all users of the system.

The HKEY_CURRENT_CONFIG section contains settings for all installed hardware. 

NoDrives registry parameter to hide disks in Windows Explorer

Registry parameter values can be modified manually using the registry editor or via working with the registry from applications with the help of specialized libraries. In this article, we will show you how you can edit registry parameter values in the Windows operating system using an Embarcadero Delphi VCL application.

As an example, we will demonstrate how to hide disk partitions from the user in the explorer. You will also learn how to change the icon and name of the desired disk partition using the settings in the Windows registry.

To hide drives in the explorer, we will change the Nodrives registry parameter of the DWORD type

(Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer).

Read the continuation of this article



Sam Zekavati

Senior Software Engineer | Leader | Strategist | Innovator

6mo

Using the Windows Registry for application settings in 2024 is problematic due to several issues: it's a security risk as it can be targeted by malware, it's complex and fragile with small errors potentially causing significant issues, and it lacks portability since settings are tied to a specific Windows installation. Instead, better alternatives include using JSON, XML, or YAML configuration files, which are easy to read, edit, and transfer; environment variables, which are ideal for modern environments like Docker or cloud services; database storage for more complex configurations; and built-in application settings files provided by many frameworks, offering a structured and manageable way to handle settings.

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics