The registry is a hierarchical database, used to store various system and software information in Windows. It is available in Windows 95 and Windows NT. It contains installation data, and is updated by installers and system programs. The Erlang installer updates the registry by adding data that Erlang needs.
The registry contains keys and values. Keys are like the directories in a file system, they form a hierarchy. Values are like files, they have a name and a value, and also a type.
Paths to keys are left to right, with sub-keys to the right and backslash
between keys. (Remember that backslashes must be doubled in Erlang strings.)
Case is preserved but not significant.
Example:
There are six entry points in the Windows registry, top level keys. They can be
abbreviated in the
Abbrev. Registry key ======= ============ hkcr HKEY_CLASSES_ROOT current_user HKEY_CURRENT_USER hkcu HKEY_CURRENT_USER local_machine HKEY_LOCAL_MACHINE hklm HKEY_LOCAL_MACHINE users HKEY_USERS hku HKEY_USERS current_config HKEY_CURRENT_CONFIG hkcc HKEY_CURRENT_CONFIG dyn_data HKEY_DYN_DATA hkdd HKEY_DYN_DATA
The key above could be written as
The
Under a key, any number of named values can be stored. They have name, and types, and data.
Currently, the
There is also a "default" value, which has the empty string as name. It is read and
written with the atom
Some registry values are stored as strings with references to environment variables,
e.g.
For additional information on the Windows registry consult the Win32 Programmer's Reference.
Changes the current key to another key. Works like cd. The key can be specified as a relative path or as an absolute path, starting with \\.
Creates a key, or just changes to it, if it is already there. Works
like a combination of
The registry must have been opened in write-mode.
Closes the registry. After that, the
Returns the path to the current key. This is the equivalent of
Note that the current key is stored in the driver, and might be invalid (e.g. if the key has been removed).
Deletes the current key, if it is valid. Calls the Win32 API
function
Deletes a named value on the current key. The atom
The registry must have been opened in write-mode.
Expands a string containing environment variables between percent characters. Anything between two % is taken for a environment variable, and is replaced by the value. Two consecutive % is replaced by one %.
A variable name that is not in the environment, will result in an error.
Convert an POSIX errorcode to a string (by calling
Opens the registry for reading or writing. The current key will be the root
(
Use
Sets the named (or default) value to value. Calls the Win32
API function
The registry must have been opened in write-mode.
Returns a list of subkeys to the current key. Calls the Win32
API function
Avoid calling this on the root keys, it can be slow.
Retrieves the named value (or default) on the current key.
Registry values of type
Retrieves a list of all values on the current key. The values
have types corresponding to the registry types, see
Win32 Programmer's Reference (from Microsoft)
The Windows 95 Registry (book from O'Reilly)