Saturday, December 8, 2007

A quick introduction to Wine

About Wine

Wine is a translation layer (a program loader) capable of running Windows applications on Linux and other POSIX compatible operating systems. Windows programs running in Wine act as native programs would, running without the performance or memory usage penalties of an emulator, with a similar look and feel to other applications on your desktop.

The Wine project started in 1993 as a way to support running Windows 3.1 programs on Linux. Bob Amstadt was the original coordinator, but turned it over fairly early on to Alexandre Julliard, who has run it ever since. Over the years, ports for other Unixes have been added, along with support for Win32 as Win32 applications became popular.

Getting Wine

Binary and source downloads for the most common Linux distributions and BSD can be found here.

If you build Wine from source or from the FreeBSD ports collection their are a couple dependencies that need to be met before you can start the build process.

For example this is the build dependencies for Wine 0.9.48 on FreeBSD 7

fontforge, gmake, bison, lcms, libuninameslist, libungif, m4

Wine Programs

This isn't the full list of utility programs that Wine provides but its (in my opinion) the five most important programs that you will need on a daily basis.

eject - Unmount and eject removable Media
msiexec - Microsoft Installer frontend
regedit - Registry editor
wineboot - Wine bootstrap process
winecfg - Wine configuration utility

eject is a function of Wine. It is used to free, unlock, and eject an optical device when Wine is using it.

Note: in order to eject, the drive must be correctly set up in winecfg and must be invoked with wine preceding it.
wine eject [-u] [-a] [-h] [x:]...
-a Eject all the CD drives we find
-h Display this help message
-u Unmount only, don't eject the CD
x: Eject drive x:

useful when trying to install mutidisk installs

1. wine /media/cdrom/setup.exe (or whatever it's called)
2. When the installer prompts for the 2nd disc, go to another window and run "wine eject" if just pressing the button doesn't let go of the disc
3. Don't run setup.exe from a file browser or by cd'ing to the drive location, by setting in the location this will prevent the swap and you will receive a error.

Install a product:
msiexec {package|productcode} [property]
msiexec /i {package|productcode} [property]
msiexec /a package [property]
Repair an installation:
msiexec /f[p|o|e|d|c|a|u|m|s|v] {package|productcode}
Uninstall a product:
msiexec /x {package|productcode} [property]
Advertise a product:
msiexec /j[u|m] package [/t transform] [/g languageid]
msiexec {u|m} package [/t transform] [/g languageid]
Apply a patch:
msiexec /p patchpackage [property]
msiexec /p patchpackage /a package [property]
Modifiers for above operations:
msiexec /l[*][i|w|e|a|r|u|c|m|o|p|v|][+|!] logfile
msiexec /q{|n|b|r|f|n+|b+|b-}
Register a module:
msiexec /y module
Unregister a module:
msiexec /z module
Display usage and copyright:
msiexec {/h|/?}

NOTE: Product code on command line unimplemented as of yet

1. The most common usage is msiexec /i program.msi to install a .msi program.

regedit filename
regedit /E filename [regpath]
regedit /D regpath

filename - registry file name
regpath - name of the registry key

When called without any switches, adds the content of the specified file to the registry

/E - exports contents of the specified registry key to the specified
file. Exports the whole registry if no key is specified.
/D - deletes specified registry key
/S - silent execution, can be used with any other switch.
Default. The only existing mode, exists for compatibility with Windows regedit.
/V - advanced mode, can be used with any other switch.
Ignored, exists for compatibility with Windows regedit.
/L - location of system.dat file. Can be used with any other switch.
Ignored. Exists for compatibility with Windows regedit.
/R - location of user.dat file. Can be used with any other switch.
Ignored. Exists for compatibility with Windows regedit.
/? - print this help. Any other switches are ignored.
/C - create registry from file. Not implemented.

The switches are case-insensitive, can be prefixed either by '-' or '/'.
This program is command-line compatible with Microsoft Windows regedit


Initiates a "virtual" reboot, for when Windows apps call for a real reboot

Usage: wineboot [options]
-h,--help Display this help message
-e,--end-session End the current session cleanly
-f,--force Force exit for processes that don't exit cleanly
-k,--kill Kill running processes without any cleanup
-r,--restart Restart only, don't do normal startup operations
-s,--shutdown Shutdown only, don't reboot


winecfg is a GUI configuration tool for wine, designed to make life a little easier than editing the .reg files by hand.

NOTE: Everything can't be edited using winecfg, some keys can only be edited with regedit.

Wine First Run

The first time you run wine it will set up a .wine directory in your home directory. The easiest way to do this is run a Wine program, I prefer winecfg myself.

$ winecfg

tom@tuxonfire ~ $ winecfg
wine: creating configuration directory '/home/tom/.wine'...
fixme:midi:OSS_MidiInit Synthesizer supports MIDI in. Not yet supported.
Could not load Mozilla. HTML rendering will be disabled.
wine: '/home/tom/.wine' created successfully.
fixme:midi:OSS_MidiInit Synthesizer supports MIDI in. Not yet supported.
tom@tuxonfire ~ $

After the configuration directory is created winecfg will start and you can then make any changes to the default setup at this time,if you wish to do so.

After you exit winecfg you can then start installing Windows programs into Wine.

$ wine app-name-here.exe

Putty for Mac
Putty for Mac

1 comment:

Anonymous said...

Thx. Good introduction.