All of the settings you change in Winecfg, with exception of
the drive settings, are ultimately stored in the registry.
In Windows, this is a central repository for the configuration
of applications and the operating system. Likewise, Wine
implements a registry and some settings not found in Winecfg
can be changed within it. (There's actually more of a chance
you'll need to dip into the registry to change an applications'
settings than Wine itself.)
Now, the fact that Wine itself uses the registry to store settings
has been controversial. Some people argue that it's too much like
Windows. To counter this, there's several things to consider.
First, it's impossible to avoid implementing a registry simply
because applications expect to be able to store their settings there.
In order for Wine to store and access settings in a separate
configuration file would require a separate set of code to basically
do the same thing as the Win32 API's Wine already implements.
Finally, unlike Windows, the Wine registry is written in plain text
and can be changed using your favorite text editor. While most sane
system administrators (and Wine developers) curse madly at the twisted
nature of the Windows registry, it is still necessary for Wine to
support it somehow.
Okay.. with that out of the way, let's dig into the registry a bit
to see how it's laid out. The Windows registry is an elaborate tree
structure, and not even most Windows programmers are fully aware of
how the registry is laid out, with its different "hives" and numerous
links between them; a full coverage is out of the scope of
this document. But here are the basic registry keys you might
need to know about for now:
HKEY_LOCAL_MACHINE
This fundamental root key (in win9x it's stored in the
hidden file system.dat) contains
everything pertaining to the current Windows
installation. This is often abbreviated HKLM.
HKEY_USERS
This fundamental root key (in win9x it's stored in the
hidden file user.dat) contains
configuration data for every user of the installation.
HKEY_CLASSES_ROOT
This is a link to HKEY_LOCAL_MACHINE\Software\Classes.
It contains data describing things like file
associations, OLE document handlers, and COM classes.
HKEY_CURRENT_USER
This is a link to HKEY_USERS\your_username, i.e., your
personal configuration.
Now, what you're probably wondering is how that translates
into Wine's structure. The registry layout described above
actually lives in three different files within each user's
~/.wine directory:
system.reg
This file contains HKEY_LOCAL_MACHINE.
user.reg
This file contains HKEY_CURRENT_USER.
userdef.reg
This file contains HKEY_USERS\.Default (i.e. the default
user settings).
These files are automatically created by
wineprefixcreate the first time you use
Wine. A set of global settings is stored in the
c:\windows\inf\wine.inf and is processed by the
rundll32.exe program. The first time you run
Wine the wine.inf file gets processed to
populate the initial registry. For more details, check
out the wineprefixcreate script to see how
it's all done. After updating Wine, wineprefixcreate
can also be used to update the default registry entries.
Like we mentioned, you can edit those .reg files using whatever text
editor you want. Just make sure Wine isn't running when you do
it, otherwise all of the changes will be lost.
An easier way to access and change the registry is with the
tool regedit. Similar to the Windows
program it replaces, regedit serves to provide a system level
view of the registry containing all of the keys. Simply run
regedit and it should pop up. You'll
immediately notice that the cryptic keys displayed in the text file
are organized in a hierarchical fashion.
To navigate through the registry, click on the keys on the
left to drill down deeper. To delete a key, click on it and
choose "Delete" from the Edit menu. To add a key or value,
locate where you want to put it and choose "New" from the
Edit menu. Likewise, you modify an existing key by highlighting
it in the right-hand window pane and choosing "Modify" from the
Edit menu. Another way to perform these same actions is to
right-click on the key or value.
Of particular interest to Wine users are the settings stored in
HKEY_CURRENT_USER\Software\Wine. Most of
the settings you change within winecfg are written to this area
of the registry.
With the above file structure, it is possible for a system
administrator to configure the system so that a system Wine
installation (and applications) can be shared by all the
users, and still let the users all have their own personalized
configuration. An administrator can, after having installed
Wine and any Windows application software he wants the users
to have access to, copy the resulting
system.reg and
over to the global registry files (which we assume will reside in
/usr/local/etc here), with:
cd ~root/.wine
cp system.reg /usr/local/etc/wine.systemreg
and perhaps even symlink these back to the administrator's
account, to make it easier to install apps system-wide later:
ln -sf /usr/local/etc/wine.systemreg system.reg
You might be tempted to do the same for user.reg
as well, however that file contains user specific settings.
Every user should have their own copy of that file along with
the permissions to modify it.
You'll want to pay attention to drive mappings. If
you're sharing the system.reg file you'll want to make sure
the registry settings are compatible with the drive mappings
in ~/.wine/dosdevices
of each individual user. As a general rule of thumb, the closer
you keep your drive mappings to the default configuration
provided by wineprefixcreate, the easier
this will be to manage. You may or may not be able to share
some or all of the actual "c:" drive you
originally installed the application to. Some applications
require the ability to write specific settings to the drive,
especially those designed for Windows 95/98/ME.
Note that the tools/wineinstall script
used to do some of this if you installed Wine source as root, however
it no longer does.
A final word of caution: be careful with what you do with the
administrator account - if you do copy or link the administrator's
registry to the global registry, any user might be able to read the
administrator's preferences, which might not be good if
sensitive information (passwords, personal information, etc)
is stored there. Only use the administrator account to install
software, not for daily work; use an ordinary user account for
that.