Documentation update.
[wine] / documentation / registry.sgml
1   <sect1 id="registry">
2     <title>The Registry</title>
3
4       <para>
5         written by Ove Kåven
6       </para>
7       <para>
8       (Extracted from <filename>wine/documentation/registry</filename>)
9       </para>
10
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>
20
21     <sect2>
22       <title>Registry structure</title>
23   
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>
32
33
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>
77
78     <sect2>
79       <title>Using a Windows registry</title>
80   
81       <para>
82         If you point Wine at an existing MS Windows installation (by
83         setting the appropriate directories in
84         <filename>wine.conf</filename> or
85         <filename>.winerc</filename>), then Wine is able to load
86         registry data from it. However, Wine will not save anything to
87         the real Windows registry, but rather to its own registry
88         files (see below). Of course, if a particular registry value
89         exists in both the Windows registry and in the Wine registry,
90         then Wine will use the latter.
91       </para>
92       <para>
93         Occasionally, Wine may have trouble loading the Windows
94         registry. Usually, this is because the registry is
95         inconsistent or damaged in some way. If that becomes a
96         problem, you may want to download the
97         <filename>regclean.exe</filename> from the MS website and use
98         it to clean up the registry. Alternatively, you can always use
99         <filename>regedit.exe</filename> to export the registry data
100         you want into a text file, and then import it in Wine.
101       </para>
102     </sect2>
103
104     <sect2>
105       <title>Wine registry data files</title>
106   
107       <para>
108         In the user's home directory, there is a subdirectory named
109         <filename>.wine</filename>, where Wine will try to save its
110         registry by default. It saves into four files, which are:
111       </para>
112
113       <variablelist>
114         <varlistentry>
115           <term><filename>system.reg</filename></term>
116           <listitem>
117             <para>
118               This file contains HKEY_LOCAL_MACHINE.
119             </para>
120           </listitem>
121         </varlistentry>          
122         <varlistentry>
123           <term><filename>user.reg</filename></term>
124           <listitem>
125             <para>
126               This file contains HKEY_CURRENT_USER.
127             </para>
128           </listitem>
129         </varlistentry>          
130         <varlistentry>
131           <term><filename>userdef.reg</filename></term>
132           <listitem>
133             <para>
134               This file contains HKEY_USERS\.Default (i.e. the default
135               user settings).
136             </para>
137           </listitem>
138         </varlistentry>          
139         <varlistentry>
140           <term><filename>wine.userreg</filename></term>
141           <listitem>
142             <para>
143               Wine saves HKEY_USERS to this file (both current and
144               default user), but does not load from it, unless
145               <filename>userdef.reg</filename> is missing.
146             </para>
147           </listitem>
148         </varlistentry>
149       </variablelist>
150       <para>
151         All of these files are human-readable text files, so unlike
152         Windows, you can actually use an ordinary text editor on them
153         if you must.
154       </para>
155       <para>
156         In addition to these files, Wine can also optionally load from
157         global registry files residing in the same directory as the
158         global <filename>wine.conf</filename> (i.e.
159         <filename>/usr/local/etc</filename> if you compiled from
160         source). These are:
161       </para>
162
163       <variablelist>
164         <varlistentry>
165           <term><filename>wine.systemreg</filename></term>
166           <listitem>
167             <para>Contains HKEY_LOCAL_MACHINE.</para>
168           </listitem>
169         </varlistentry>
170         <varlistentry>
171           <term><filename>wine.userreg</filename></term>
172           <listitem>
173             <para>Contains HKEY_USERS.</para>
174           </listitem>
175         </varlistentry>
176       </variablelist>
177     </sect2>
178
179     <sect2>
180       <title>System administration</title>
181   
182       <para>
183         With the above file structure, it is possible for a system
184         administrator to configure the system so that a system Wine
185         installation (and applications) can be shared by all the
186         users, and still let the users all have their own personalized
187         configuration. An administrator can, after having installed
188         Wine and any Windows application software he wants the users
189         to have access to, copy the resulting
190         <filename>system.reg</filename> and
191         <filename>wine.userreg</filename> over to the global registry
192         files (which we assume will reside in
193         <filename>/usr/local/etc</filename> here), with:
194       </para>
195       <screen>
196 cd ~/.wine
197 cp system.reg /usr/local/etc/wine.systemreg
198 cp wine.userreg /usr/local/etc/wine.userreg
199       </screen>
200       <para>
201         and perhaps even symlink these back to the administrator's
202         account, to make it easier to install apps system-wide later:
203       </para>
204       <screen>
205 ln -sf /usr/local/etc/wine.systemreg system.reg
206 ln -sf /usr/local/etc/wine.userreg wine.userreg
207       </screen>
208       <para>
209         Note that the <filename>tools/wineinstall</filename> script
210         already does all of this for you, if you install Wine as root.
211         If you then install Windows applications while logged in as
212         root, all your users will automatically be able to use them.
213         While the application setup will be taken from the global
214         registry, the users' personalized configurations will be saved
215         in their own home directories.
216       </para>
217       <para>
218         But be careful with what you do with the administrator account
219         - if you do copy or link the administrator's registry to the
220         global registry, any user might be able to read the
221         administrator's preferences, which might not be good if
222         sensitive information (passwords, personal information, etc)
223         is stored there. Only use the administrator account to install
224         software, not for daily work; use an ordinary user account for
225         that.
226       </para>
227     </sect2>
228
229     <sect2>
230       <title>The default registry</title>
231
232       <para>
233         A Windows registry contains many keys by default, and some of
234         them are necessary for even installers to operate correctly.
235         The keys that the Wine developers have found necessary to
236         install applications are distributed in a file called
237         <filename>winedefault.reg</filename>. It is automatically
238         installed for you if you use the
239         <filename>tools/wineinstall</filename> script, but if you want
240         to install it manually, you can do so by using the
241         <command>regapi</command> tool. You can find more information
242         about this in the
243         <filename>documentation/no-windows</filename> document in the
244         Wine distribution.
245       </para>
246     </sect2>
247
248     <sect2>
249       <title>The [registry] section</title>
250
251       <para>
252         With the above information fresh in mind, let's look at the
253         <filename>wine.conf</filename>/<filename>.winerc</filename>
254         options for handling the registry.
255       </para>
256
257       <variablelist>
258         <varlistentry>
259           <term>LoadGlobalRegistryFiles</term>
260           <listitem>
261             <para>
262               Controls whether to try to load the global registry
263               files, if they exist.
264             </para>
265           </listitem>
266         </varlistentry>
267         <varlistentry>
268           <term>LoadHomeRegistryFiles</term>
269           <listitem>
270             <para>
271               Controls whether to try to load the user's registry
272               files (in the <filename>.wine</filename> subdirectory of
273               the user's home directory).
274             </para>
275           </listitem>
276         </varlistentry>
277         <varlistentry>
278           <term>LoadWindowsRegistryFiles</term>
279           <listitem>
280             <para>
281               Controls whether Wine will attempt to load registry data
282               from a real Windows registry in an existing MS Windows
283               installation.
284             </para>
285           </listitem>
286         </varlistentry>
287         <varlistentry>
288           <term>WritetoHomeRegistryFiles</term>
289           <listitem>
290             <para>
291               Controls whether registry data will be written to the
292               user's registry files. (Currently, there is no
293               alternative, so if you turn this off, Wine cannot save
294               the registry on disk at all; after you exit Wine, your
295               changes will be lost.)
296             </para>
297           </listitem>
298         </varlistentry>
299         <varlistentry>
300           <term>UseNewFormat</term>
301           <listitem>
302             <para>
303               This option is obsolete. Wine now always use the new
304               format; support for the old format was removed a while
305               ago.
306             </para>
307           </listitem>
308         </varlistentry>
309         <varlistentry>
310           <term>PeriodicSave</term>
311           <listitem>
312             <para>
313               If this option is set to a nonzero value, it specifies
314               that you want the registry to be saved to disk at the
315               given interval. If it is not set, the registry will only
316               be saved to disk when the wineserver terminates.
317             </para>
318           </listitem>
319         </varlistentry>
320         <varlistentry>
321           <term>SaveOnlyUpdatedKeys</term>
322           <listitem>
323             <para>
324               Controls whether the entire registry is saved to the
325               user's registry files, or only subkeys the user have
326               actually changed. Considering that the user's registry
327               will override any global registry files and Windows
328               registry files, it usually makes sense to only save
329               user-modified subkeys; that way, changes to the rest of
330               the global or Windows registries will still affect the
331               user.
332             </para>
333           </listitem>
334         </varlistentry>
335       </variablelist>
336     </sect2>
337   </sect1>
338
339 <!-- Keep this comment at the end of the file
340 Local variables:
341 mode: sgml
342 sgml-parent-document:("configuring.sgml" "chapter" "sect1" "")
343 End:
344 -->