4.3. The Registry

written by Ove Kåven

(Extracted from wine/documentation/registry)

After Win3.x, the registry became a fundamental part of Windows. It is the place where both Windows itself, and all Win95/98/NT/2000/whatever-compliant applications, store configuration and state data. While most sane system administrators (and Wine developers) curse badly at the twisted nature of the Windows registry, it is still necessary for Wine to support it somehow.

4.3.1. Registry structure

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.

4.3.2. Using a Windows registry

If you point Wine at an existing MS Windows installation (by setting the appropriate directories in ~/.wine/config, then Wine is able to load registry data from it. However, Wine will not save anything to the real Windows registry, but rather to its own registry files (see below). Of course, if a particular registry value exists in both the Windows registry and in the Wine registry, then Wine will use the latter.

Occasionally, Wine may have trouble loading the Windows registry. Usually, this is because the registry is inconsistent or damaged in some way. If that becomes a problem, you may want to download the regclean.exe from the MS website and use it to clean up the registry. Alternatively, you can always use regedit.exe to export the registry data you want into a text file, and then import it in Wine.

4.3.3. Wine registry data files

In the user's home directory, there is a subdirectory named .wine, where Wine will try to save its registry by default. It saves into four files, which are:

All of these files are human-readable text files, so unlike Windows, you can actually use an ordinary text editor on them if you want (make sure you don't have Wine running when modifying them, otherwise your changes will be discarded).

FIXME: global config currently not implemented. In addition to these files, Wine can also optionally load from global registry files residing in the same directory as the global wine.conf (i.e. /usr/local/etc if you compiled from source). These are:

4.3.4. System administration

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 wine.userreg over to the global registry files (which we assume will reside in /usr/local/etc here), with:

cd ~/.wine
cp system.reg /usr/local/etc/wine.systemreg
cp wine.userreg /usr/local/etc/wine.userreg
      

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
ln -sf /usr/local/etc/wine.userreg wine.userreg
      

Note that the tools/wineinstall script already does all of this for you, if you install Wine source as root. If you then install Windows applications while logged in as root, all your users will automatically be able to use them. While the application setup will be taken from the global registry, the users' personalized configurations will be saved in their own home directories.

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

4.3.5. The default registry

A Windows registry contains many keys by default, and some of them are necessary for even installers to operate correctly. The keys that the Wine developers have found necessary to install applications are distributed in a file called winedefault.reg. It is automatically installed for you if you use the tools/wineinstall script in the Wine source, but if you want to install it manually, you can do so by using the regapi tool to be found in the programs/regapi/ directory in Wine source.

4.3.6. The [registry] section

With the above information fresh in mind, let's look at the wine.conf / ~/.wine/config options for handling the registry.