registry

Section: Tcl Built-In Commands (n)
Updated: 8.0
Index Return to Main Contents
 

NAME

registry - Manipulate OS/2 profiles ("INI-files") or the Windows registry  

SYNOPSIS

package require registry 1.0

registry option keyName ?arg arg ...?  

DESCRIPTION

The registry package provides a general set of operations for manipulating OS/2 profiles (on OS/2) or the Windows registry (on Windows). The package implements the registry Tcl command. This command is only supported on the OS/2 and Windows platforms, with some differences in semantics. Warning: this command should be used with caution as corrupted system profiles or registry can leave your system in an unusable state.

KeyName is the name of a registry key. Registry keys must be one of the following forms:

\\hostname\rootname\keypath (Windows)
rootname\keypath (OS/2 and Windows)
rootname (OS/2 and Windows)

Hostname specifies the name of any valid Windows host that exports its registry.
On OS/2, the rootname component must be one of USER (User profile OS2.INI), SYSTEM (System profile, OS2SYS.INI) or BOTH (only for querying, get information from either the User or System Profile). The keypath may contain backslash (\) characters. The resultant string is one key though, as OS/2 profiles have a fixed number of levels: applications which have keys which are set to values.
On Windows, the rootname component must be one of HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, or HKEY_CURRENT_CONFIG. The keypath can be one or more registry key names separated by backslash (\) characters.

Option indicates what to do with the registry key name. Any unique abbreviation for option is acceptable. In OS/2 profile parlance, the term for keyName below would be Application Name and the term for valueName would be Key Name. The valid options on both OS/2 and Windows are:

registry delete keyName ?valueName?
If the optional valueName argument is present, the specified value under keyName will be deleted from the registry. If the optional valueName is omitted, the specified key (Application) and any subkeys (Windows only) or values (Keys) beneath it in the profile / registry hierarchy will be deleted. On OS/2, if the specified Key is the last for the specified Application, the entire Application will be deleted, since no Applications without Keys can exist in the profiles. If the key could not be deleted then an error is generated. If the key did not exist, the command has no effect.
registry get keyName valueName ?asType?
Returns the data associated with the value (Key) valueName under the key (Application) keyName. If either the key (Application) or the value (Key) does not exist, then an error is generated. The asType argument is only applicable to OS/2, since the profiles don't store data as a particular type, so the querying application determines how it is seen. For more details on the format of the returned data, see SUPPORTED TYPES, below.
registry keys keyName ?pattern?
If pattern isn't specified, returns a list of names of all the Keys in the Application keyName (OS/2) or subkeys of keyName (Windows). If pattern is specified, only those names matching pattern are returned. Matching is determined using the same rules as for string match. If the specified keyName does not exist, then an error is generated.
registry set keyName ?valueName data ?type??
The ?valueName data ?type?? part is only optional on Windows from a functional perspective; the OS/2 version will not complain and will report success, but an Application without any Keys is not possible. On Windows, If valueName isn't specified, creates the key keyName if it doesn't already exist. If valueName is specified, creates the key (Application) keyName and value (Key) valueName if necessary. The contents of valueName are set to data with the type indicated by type. If type isn't specified, the type string (OS/2) or sz (Windows) is assumed. For more details on the data and type arguments, see SUPPORTED TYPES below.
registry type keyName valueName
Returns the type of the value (Key) valueName in the key (Application) keyName. For more information on the possible types, see SUPPORTED TYPES, below.
registry values keyName ?pattern?
If pattern isn't specified, returns a list of names of all the values of keyName. If pattern is specified, only those names matching pattern are returned. Matching is determined using the same rules as for string match.

On OS/2, the following options (all terminology in OS/2 profile paralance) are additionally supported to fit in more with the organisation of the profiles. This saves you computational effort in Tcl eg. to extract only Keys for one Application, but at the expense of portability between Windows and OS/2.

registry apps profile ?pattern?
If pattern isn't specified, returns a list of names of all the Applications in the specified profile. If pattern is specified, only those names matching pattern are returned. Matching is determined using the same rules as for string match. If the specified profile does not exist, then it is created.
registry appkeys appName ?pattern?
If pattern isn't specified, returns a list of names of all the Keys in the specified Application appName (OS/2). If pattern is specified, only those names matching pattern are returned. Matching is determined using the same rules as for string match. If the specified keyName does not exist, then an error is generated.
registry appset appName keyName data ?type?
Creates the Application appName and Key keyName if necessary. The contents of keyName are set to data with the type indicated by type. If type isn't specified, the type string is assumed. For more details on the data and type arguments, see SUPPORTED TYPES below.
 

SUPPORTED TYPES

Each value (Key) under a key (Application) in the profile / registry contains some data of a particular type in a type-specific representation. The registry command converts between this internal representation and one that can be manipulated by Tcl scripts. In most cases, the data is simply returned as a Tcl string. The type indicates the intended use for the data, but does not actually change the representation. For some types, the registry command returns the data in a different form to make it easier to manipulate. The following types are recognized by the registry command:

OS/2

binary
The registry value contains arbitrary binary data. The data is represented exactly in Tcl, including any embedded nulls.
long
The registry value contains a little-endian 32-bit number. The data is represented in Tcl as a decimal string. For compatibility in scripts, the type dword (as for Windows) is also allowed.
string
The registry value contains a null-terminated string. The data is represented in Tcl as a string. For compatibility in scripts, the type sz (as for Windows) is also allowed.

Windows

binary
The registry value contains arbitrary binary data. The data is represented exactly in Tcl, including any embedded nulls.
none
The registry value contains arbitrary binary data with no defined type. The data is represented exactly in Tcl, including any embedded nulls.
sz
The registry value contains a null-terminated string. The data is represented in Tcl as a string.
expand_sz
The registry value contains a null-terminated string that contains unexpanded references to environment variables in the normal Windows style (for example, "%PATH%"). The data is represented in Tcl as a string.
dword
The registry value contains a little-endian 32-bit number. The data is represented in Tcl as a decimal string.
dword_big_endian
The registry value contains a big-endian 32-bit number. The data is represented in Tcl as a decimal string.
link
The registry value contains a symbolic link. The data is represented exactly in Tcl, including any embedded nulls.
multi_sz
The registry value contains an array of null-terminated strings. The data is represented in Tcl as a list of strings.
resource_list
The registry value contains a device-driver resource list. The data is represented exactly in Tcl, including any embedded nulls.

In addition to the symbolically named types listed above, unknown types are identified using a 32-bit integer that corresponds to the type code returned by the system interfaces. In this case, the data is represented exactly in Tcl, including any embedded nulls.  

PORTABILITY ISSUES

The registry command is only available on OS/2 and Windows.  

KEYWORDS

registry


 

Index

NAME
SYNOPSIS
DESCRIPTION
SUPPORTED TYPES
PORTABILITY ISSUES
KEYWORDS

This document was created by man2html, using the manual pages.
Time: 00:29:15 GMT, February 16, 2023