4.2. Using the Registry and Regedit

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 the settings of an application 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 are 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 APIs Wine already implements.

4.2.1. Registry Structure

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:


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.


This fundamental root key (in win9x it's stored in the hidden file user.dat) contains configuration data for every user of the installation.


This is a link to HKEY_LOCAL_MACHINE\Software\Classes. It contains data describing things like file associations, OLE document handlers, and COM classes.


This is a link to HKEY_USERS\your_username, i.e., your personal configuration.

4.2.2. Registry Files

Now, what you're probably wondering is how that translates into Wine structure. The registry layout described above actually lives in three different files within each user's ~/.wine directory:


This file contains HKEY_LOCAL_MACHINE.


This file contains HKEY_CURRENT_USER.


This file contains HKEY_USERS\.Default (i.e. the default user settings).

These files are automatically created the first time you use Wine. A set of global settings is stored in the wine.inf file 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. The registry is also updated automatically if wine.inf changes, for instance when upgrading to a newer Wine version.

Note: Older Wine versions (before 1.0) required you to run the wineprefixcreate command manually to upgrade your settings. This is no longer necessary.

It is not advisable to edit these files to modify the registry as they are managed by Wine internally. Use regedit.exe, reg.exe or any program which uses the standard registry functions.

4.2.3. Using Regedit

An easy way to access and change the registry is with the regedit tool. Similar to the Windows program it replaces, regedit serves to provide a system level view of the registry containing all of the keys. When you start it, 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.

4.2.4. System Administration Tips

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, 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.