Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / share / tcl / help / tcl / files / registry
1 NAME
2 registry - Manipulate the Windows registry
3
4 SYNOPSIS
5 package require registry 1.1
6
7 registry option keyName ?arg arg ...?
8
9
10 DESCRIPTION
11 The registry package provides a general set of operations for manipu-
12 lating the Windows registry. The package implements the registry Tcl
13 command. This command is only supported on the Windows platform.
14 Warning: this command should be used with caution as a corrupted reg-
15 istry can leave your system in an unusable state.
16
17 KeyName is the name of a registry key. Registry keys must be one of
18 the following forms:
19
20 \\hostname\rootname\keypath
21
22 rootname\keypath
23
24 rootname
25
26 Hostname specifies the name of any valid Windows host that exports its
27 registry. The rootname component must be one of HKEY_LOCAL_MACHINE,
28 HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_CURRENT_CONFIG,
29 HKEY_PERFORMANCE_DATA, or HKEY_DYN_DATA. The keypath can be one or
30 more registry key names separated by backslash (\) characters.
31
32 Option indicates what to do with the registry key name. Any unique
33 abbreviation for option is acceptable. The valid options are:
34
35 registry broadcast keyName ?-timeout milliseconds?
36 Sends a broadcast message to the system and running programs to
37 notify them of certain updates. This is necessary to propagate
38 changes to key registry keys like Environment. The timeout
39 specifies the amount of time, in milliseconds, to wait for
40 applications to respond to the broadcast message. It defaults
41 to 3000. The following example demonstrates how to add a path
42 to the global Environment and notify applications of the change
43 without requiring a logoff/logon step (assumes admin privi-
44 leges):
45 set regPath {HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment}
46 set curPath [registry get $regPath "Path"]
47 registry set $regPath "Path" "$curPath;$addPath"
48 registry broadcast "Environment"
49
50 registry delete keyName ?valueName?
51 If the optional valueName argument is present, the specified
52 value under keyName will be deleted from the registry. If the
53 optional valueName is omitted, the specified key and any subkeys
54 or values beneath it in the registry hierarchy will be deleted.
55 If the key could not be deleted then an error is generated. If
56 the key did not exist, the command has no effect.
57
58 registry get keyName valueName
59 Returns the data associated with the value valueName under the
60 key keyName. If either the key or the value does not exist,
61 then an error is generated. For more details on the format of
62 the returned data, see SUPPORTED TYPES, below.
63
64 registry keys keyName ?pattern?
65 If pattern isn't specified, returns a list of names of all the
66 subkeys of keyName. If pattern is specified, only those names
67 matching pattern are returned. Matching is determined using the
68 same rules as for string match. If the specified keyName does
69 not exist, then an error is generated.
70
71 registry set keyName ?valueName data ?type??
72 If valueName isn't specified, creates the key keyName if it
73 doesn't already exist. If valueName is specified, creates the
74 key keyName and value valueName if necessary. The contents of
75 valueName are set to data with the type indicated by type. If
76 type isn't specified, the type sz is assumed. For more details
77 on the data and type arguments, see SUPPORTED TYPES below.
78
79 registry type keyName valueName
80 Returns the type of the value valueName in the key keyName. For
81 more information on the possible types, see SUPPORTED TYPES,
82 below.
83
84 registry values keyName ?pattern?
85 If pattern isn't specified, returns a list of names of all the
86 values of keyName. If pattern is specified, only those names
87 matching pattern are returned. Matching is determined using the
88 same rules as for string match.
89
90
91 SUPPORTED TYPES
92 Each value under a key in the registry contains some data of a particu-
93 lar type in a type-specific representation. The registry command con-
94 verts between this internal representation and one that can be manipu-
95 lated by Tcl scripts. In most cases, the data is simply returned as a
96 Tcl string. The type indicates the intended use for the data, but does
97 not actually change the representation. For some types, the registry
98 command returns the data in a different form to make it easier to
99 manipulate. The following types are recognized by the registry com-
100 mand:
101
102 binary The registry value contains arbitrary binary data.
103 The data is represented exactly in Tcl, including any
104 embedded nulls.
105
106 none The registry value contains arbitrary binary data with
107 no defined type. The data is represented exactly in
108 Tcl, including any embedded nulls.
109
110 sz The registry value contains a null-terminated string.
111 The data is represented in Tcl as a string.
112
113 expand_sz The registry value contains a null-terminated string
114 that contains unexpanded references to environment
115 variables in the normal Windows style (for example,
116 "%PATH%"). The data is represented in Tcl as a
117 string.
118
119 dword The registry value contains a little-endian 32-bit
120 number. The data is represented in Tcl as a decimal
121 string.
122
123 dword_big_endian The registry value contains a big-endian 32-bit num-
124 ber. The data is represented in Tcl as a decimal
125 string.
126
127 link The registry value contains a symbolic link. The data
128 is represented exactly in Tcl, including any embedded
129 nulls.
130
131 multi_sz The registry value contains an array of null-termi-
132 nated strings. The data is represented in Tcl as a
133 list of strings.
134
135 resource_list The registry value contains a device-driver resource
136 list. The data is represented exactly in Tcl, includ-
137 ing any embedded nulls.
138
139 In addition to the symbolically named types listed above, unknown types
140 are identified using a 32-bit integer that corresponds to the type code
141 returned by the system interfaces. In this case, the data is repre-
142 sented exactly in Tcl, including any embedded nulls.
143
144 PORTABILITY ISSUES
145 The registry command is only available on Windows.
146
147 EXAMPLE
148 Print out how double-clicking on a Tcl script file will invoke a Tcl
149 interpreter:
150 package require registry
151 set ext .tcl
152
153 # Read the type name
154 set type [registry get HKEY_CLASSES_ROOT\\$ext {}]
155 # Work out where to look for the command
156 set path HKEY_CLASSES_ROOT\\$type\\Shell\\Open\\command
157 # Read the command!
158 set command [registry get $path {}]
159
160 puts "$ext opens with $command"
161
162
163 KEYWORDS