Windows Registry Routines

CAUTION:
When you are changing registry settings, Windows does not validate any of the values you write to it–any operation is allowed. Therefore, you must be very careful of what changes you make to the registry because no error messages will appear if you make a mistake. You should create a backup of your Windows registry before making any changes. Even better, back up your entire configuration, so that it could be restored in full in the event of a crash.

The library routines that follow enable you to create and query Windows Registry keys. Each routine can be called by either of two names. Use the DISPLAY_REG_* name when you want to work with the registry on the display host (this is the local host when the application is run with a standard runtime, and the thin client when the application is run with the thin client). Use the REG_* name when you want to work with the registry on the server host (the local host when the application is run with a standard runtime, and the application host when the application is run with the thin client).

If the routines are called from a non-Windows platform, they will return an error status code of -1.

The Windows Registry contains the hardware, software, and user preferences that determine the configuration of a particular PC. When a user makes changes to the desktop, file structure, system configuration or software, the changes are reflected in the registry. This information used to be contained in files like config.sys, autoexec.bat, win.ini, system.ini and control.ini, but the registry provides a single source for accessing all of a computer's settings.

Each setting in the registry has a handle or Key. Only two registry keys are actually stored on the hard disk: HKEY_LOCAL_MACHINE and HKEY_USERS. All other registry keys are aliases or branches of these two principal keys, or are created dynamically by Windows. For example, HKEY_CLASSES_ROOT is an alias of the branch HKEY_LOCAL_MACHINE\Software\Classes. In order to interact with these registry keys, the Windows Application Programmer's Interface (API) provides a series of functions that call the registry. Acucorp has created the library routines below to operate registry functions from within your COBOL program.

For security reasons, in thin client deployments several of the functions require user authorization before the action is performed. These functions include:

When one of these functions is called, a Security Information dialog is displayed and the user must select a Yes or No button to indicate whether the action may proceed. The security information dialog may look like this:


The Security Information Dialog