Declare NtCreateFile(), NtOpenFile() and NtReadFile().
[wine.git] / documentation / registry.sgml
blob99252cee5f866bda56a7889aa75e492c29916cca
1 <sect1 id="registry">
2 <title>The Registry</title>
4 <para>
5 written by Ove Kåven
6 </para>
7 <para>
8 (Extracted from <filename>wine/documentation/registry</filename>)
9 </para>
11 <para>
12 After Win3.x, the registry became a fundamental part of Windows.
13 It is the place where both Windows itself, and all
14 Win95/98/NT/2000/whatever-compliant applications, store
15 configuration and state data. While most sane system
16 administrators (and Wine developers) curse badly at the twisted
17 nature of the Windows registry, it is still necessary for Wine
18 to support it somehow.
19 </para>
21 <sect2>
22 <title>Registry structure</title>
24 <para>
25 The Windows registry is an elaborate tree structure, and not
26 even most Windows programmers are fully aware of how the
27 registry is laid out, with its different "hives" and numerous
28 links between them; a full coverage is out of the scope of
29 this document. But here are the basic registry keys you might
30 need to know about for now.
31 </para>
34 <variablelist>
35 <varlistentry>
36 <term>HKEY_LOCAL_MACHINE</term>
37 <listitem>
38 <para>
39 This fundamental root key (in win9x, stored in the
40 hidden file <filename>system.dat</filename>) contains
41 everything pertaining to the current Windows
42 installation.
43 </para>
44 </listitem>
45 </varlistentry>
46 <varlistentry>
47 <term>HKEY_USERS</term>
48 <listitem>
49 <para>
50 This fundamental root key (in win9x, stored in the
51 hidden file <filename>user.dat</filename>) contains
52 configuration data for every user of the installation.
53 </para>
54 </listitem>
55 </varlistentry>
56 <varlistentry>
57 <term>HKEY_CLASSES_ROOT</term>
58 <listitem>
59 <para>
60 This is a link to HKEY_LOCAL_MACHINE\Software\Classes.
61 It contains data describing things like file
62 associations, OLE document handlers, and COM classes.
63 </para>
64 </listitem>
65 </varlistentry>
66 <varlistentry>
67 <term>HKEY_CURRENT_USER</term>
68 <listitem>
69 <para>
70 This is a link to HKEY_USERS\your_username, i.e., your
71 personal configuration.
72 </para>
73 </listitem>
74 </varlistentry>
75 </variablelist>
76 </sect2>
78 <sect2>
79 <title>Using a Windows registry</title>
81 <para>
82 If you point Wine at an existing MS Windows installation (by
83 setting the appropriate directories in
84 <filename>~/.wine/config</filename>, then Wine is able to load
85 registry data from it. However, Wine will not save anything to
86 the real Windows registry, but rather to its own registry
87 files (see below). Of course, if a particular registry value
88 exists in both the Windows registry and in the Wine registry,
89 then Wine will use the latter.
90 </para>
91 <para>
92 Occasionally, Wine may have trouble loading the Windows
93 registry. Usually, this is because the registry is
94 inconsistent or damaged in some way. If that becomes a
95 problem, you may want to download the
96 <filename>regclean.exe</filename> from the MS website and use
97 it to clean up the registry. Alternatively, you can always use
98 <filename>regedit.exe</filename> to export the registry data
99 you want into a text file, and then import it in Wine.
100 </para>
101 </sect2>
103 <sect2>
104 <title>Wine registry data files</title>
106 <para>
107 In the user's home directory, there is a subdirectory named
108 <filename>.wine</filename>, where Wine will try to save its
109 registry by default. It saves into four files, which are:
110 </para>
112 <variablelist>
113 <varlistentry>
114 <term><filename>system.reg</filename></term>
115 <listitem>
116 <para>
117 This file contains HKEY_LOCAL_MACHINE.
118 </para>
119 </listitem>
120 </varlistentry>
121 <varlistentry>
122 <term><filename>user.reg</filename></term>
123 <listitem>
124 <para>
125 This file contains HKEY_CURRENT_USER.
126 </para>
127 </listitem>
128 </varlistentry>
129 <varlistentry>
130 <term><filename>userdef.reg</filename></term>
131 <listitem>
132 <para>
133 This file contains HKEY_USERS\.Default (i.e. the default
134 user settings).
135 </para>
136 </listitem>
137 </varlistentry>
138 <varlistentry>
139 <term><filename>wine.userreg</filename></term>
140 <listitem>
141 <para>
142 Wine saves HKEY_USERS to this file (both current and
143 default user), but does not load from it, unless
144 <filename>userdef.reg</filename> is missing.
145 </para>
146 </listitem>
147 </varlistentry>
148 </variablelist>
149 <para>
150 All of these files are human-readable text files, so unlike
151 Windows, you can actually use an ordinary text editor on them
152 if you must.
153 </para>
154 <para>
155 In addition to these files, Wine can also optionally load from
156 global registry files residing in the same directory as the
157 global <filename>wine.conf</filename> (i.e.
158 <filename>/usr/local/etc</filename> if you compiled from
159 source). These are:
160 </para>
162 <variablelist>
163 <varlistentry>
164 <term><filename>wine.systemreg</filename></term>
165 <listitem>
166 <para>Contains HKEY_LOCAL_MACHINE.</para>
167 </listitem>
168 </varlistentry>
169 <varlistentry>
170 <term><filename>wine.userreg</filename></term>
171 <listitem>
172 <para>Contains HKEY_USERS.</para>
173 </listitem>
174 </varlistentry>
175 </variablelist>
176 </sect2>
178 <sect2>
179 <title>System administration</title>
181 <para>
182 With the above file structure, it is possible for a system
183 administrator to configure the system so that a system Wine
184 installation (and applications) can be shared by all the
185 users, and still let the users all have their own personalized
186 configuration. An administrator can, after having installed
187 Wine and any Windows application software he wants the users
188 to have access to, copy the resulting
189 <filename>system.reg</filename> and
190 <filename>wine.userreg</filename> over to the global registry
191 files (which we assume will reside in
192 <filename>/usr/local/etc</filename> here), with:
193 </para>
194 <screen>
195 cd ~/.wine
196 cp system.reg /usr/local/etc/wine.systemreg
197 cp wine.userreg /usr/local/etc/wine.userreg
198 </screen>
199 <para>
200 and perhaps even symlink these back to the administrator's
201 account, to make it easier to install apps system-wide later:
202 </para>
203 <screen>
204 ln -sf /usr/local/etc/wine.systemreg system.reg
205 ln -sf /usr/local/etc/wine.userreg wine.userreg
206 </screen>
207 <para>
208 Note that the <filename>tools/wineinstall</filename> script
209 already does all of this for you, if you install Wine source as root.
210 If you then install Windows applications while logged in as
211 root, all your users will automatically be able to use them.
212 While the application setup will be taken from the global
213 registry, the users' personalized configurations will be saved
214 in their own home directories.
215 </para>
216 <para>
217 But be careful with what you do with the administrator account
218 - if you do copy or link the administrator's registry to the
219 global registry, any user might be able to read the
220 administrator's preferences, which might not be good if
221 sensitive information (passwords, personal information, etc)
222 is stored there. Only use the administrator account to install
223 software, not for daily work; use an ordinary user account for
224 that.
225 </para>
226 </sect2>
228 <sect2>
229 <title>The default registry</title>
231 <para>
232 A Windows registry contains many keys by default, and some of
233 them are necessary for even installers to operate correctly.
234 The keys that the Wine developers have found necessary to
235 install applications are distributed in a file called
236 <filename>winedefault.reg</filename>. It is automatically
237 installed for you if you use the
238 <filename>tools/wineinstall</filename> script in the Wine source,
239 but if you want to install it manually, you can do so by using the
240 <command>regapi</command> tool to be found in the
241 <filename>programs/regapi/</filename>
242 directory in Wine source.
243 </para>
244 </sect2>
246 <sect2>
247 <title>The [registry] section</title>
249 <para>
250 With the above information fresh in mind, let's look at the
251 <filename>wine.conf</filename>/<filename>~/.wine/config</filename>
252 options for handling the registry.
253 </para>
255 <variablelist>
256 <varlistentry>
257 <term>LoadGlobalRegistryFiles</term>
258 <listitem>
259 <para>
260 Controls whether to try to load the global registry
261 files, if they exist.
262 </para>
263 </listitem>
264 </varlistentry>
265 <varlistentry>
266 <term>LoadHomeRegistryFiles</term>
267 <listitem>
268 <para>
269 Controls whether to try to load the user's registry
270 files (in the <filename>.wine</filename> subdirectory of
271 the user's home directory).
272 </para>
273 </listitem>
274 </varlistentry>
275 <varlistentry>
276 <term>LoadWindowsRegistryFiles</term>
277 <listitem>
278 <para>
279 Controls whether Wine will attempt to load registry data
280 from a real Windows registry in an existing MS Windows
281 installation.
282 </para>
283 </listitem>
284 </varlistentry>
285 <varlistentry>
286 <term>WritetoHomeRegistryFiles</term>
287 <listitem>
288 <para>
289 Controls whether registry data will be written to the
290 user's registry files. (Currently, there is no
291 alternative, so if you turn this off, Wine cannot save
292 the registry on disk at all; after you exit Wine, your
293 changes will be lost.)
294 </para>
295 </listitem>
296 </varlistentry>
297 <varlistentry>
298 <term>UseNewFormat</term>
299 <listitem>
300 <para>
301 This option is obsolete. Wine now always uses the new
302 format; support for the old format was removed a while
303 ago.
304 </para>
305 </listitem>
306 </varlistentry>
307 <varlistentry>
308 <term>PeriodicSave</term>
309 <listitem>
310 <para>
311 If this option is set to a nonzero value, it specifies
312 that you want the registry to be saved to disk at the
313 given interval. If it is not set, the registry will only
314 be saved to disk when the wineserver terminates.
315 </para>
316 </listitem>
317 </varlistentry>
318 <varlistentry>
319 <term>SaveOnlyUpdatedKeys</term>
320 <listitem>
321 <para>
322 Controls whether the entire registry is saved to the
323 user's registry files, or only subkeys the user have
324 actually changed. Considering that the user's registry
325 will override any global registry files and Windows
326 registry files, it usually makes sense to only save
327 user-modified subkeys; that way, changes to the rest of
328 the global or Windows registries will still affect the
329 user.
330 </para>
331 </listitem>
332 </varlistentry>
333 </variablelist>
334 </sect2>
335 </sect1>
337 <!-- Keep this comment at the end of the file
338 Local variables:
339 mode: sgml
340 sgml-parent-document:("configuring.sgml" "chapter" "sect1" "")
341 End: