Practical Wine

Practical Wine

COVER STORY Wine Running Windows Programs with the Wine API PRACTICAL WINE The Wine compatibility layer lets Linux users run Windows programs. Unfortunately, configuring Wine is anything but trivial, and it helps if you enjoy experimenting. BY JOACHIM VON THADDEN inux offers a number of options achieve just 50 to 80 percent of its nor- As there is a lot of redundancy in the for users who need to run an mal native performance, even with API, one might suspect that Microsoft Loccasional Windows program. increased static RAM memory use by the has actually lost track of the many thou- You can emulate a complete machine guest operating system. sands of system calls and their extremely using an application such as VMware or An alternative to emulation is simply complex calling parameters. Addition- Qemu, or you can simulate a machine to provide Windows libraries for the ally, some functions are tailored to suit subset with Win4Lin. These solutions Linux system. In theory, this approach the Windows environment and make work quite well but also have some would allow the program to run in many assumptions about the underlying drawbacks: for one thing, users need to Linux. Unfortunately, this approach is system. For example, the Linux filesys- buy both the emulation environment complicated. First, the Windows library tem is massively different from the Win- and the operating system, both of which functions, or so called API (Application dows filesystem. To mitigate this issue, it take up valuable space on the host Programming Interface), is not ade- would be useful to have the ability to machine. Emulation also taxes perfor- quately documented. And in many use the original Windows libraries. Of mance and soaks up memory. An aver- cases, programs written by Microsoft, in course, this means owning a Windows age program running in an emulator will particular, call undocumented functions. license, but most people have one any- 30 ISSUE 57 AUGUST 2005 WWW.LINUX - MAGAZINE.COM Wine COVER STORY install, typing rpm -e wine should remove the offending version. On Fedora, the Prelink security mechanism, which stores prelinked versions of all system libraries, can cause a few issues. If you do not want to disable Prelink completely, first become root, and then, after installing Wine, delete the pre- linked libraries as follows: killall prelink;prelink -uav; U rm /etc/prelink.cache; ldconfig As Fedora’s Prelinking mechanism checks the libraries every 24 hours, the system will be returned to a safe state after 24 hours at the latest. If you are in a hurry, you can call the prelink cron script to reenable the mechanism: killall prelink;U /etc/cron.daily/prelink Figure 1: The rewards – complex Windows programs like Microsoft Word show good perfor- The Wine packages supplied with mance on Linux. Debian have gained a certain degree of notoriety for being poorly maintained way, so why not do something useful ages always use the release date as their and highly unpredictable. Debian users with it? version number. The October 2004 will want to deinstall any Wine packages The open source Wine project pro- release is extremely stable and gives me they discover, then change repository vides programming functionality and all the functionality I need. The versions and install the original packages from also integrates original libraries. The released since then have been highly Wine headquarters, as described at [3]. recursive acronym “Wine,” which stands experimental and do not lend them- for “Wine is not an emulator,” expresses selves to productive use. The latest ver- At the Wine Lodge – Wine’s what Wine truly is: not an operating sys- sion at this time of writing, 20050419, Directory System tem emulator, but a compatibility layer. looks more promising, but it refuses to Wine stores a user’s configuration and After a long development period, and cooperate with Microsoft Word. working files along with that user’s Win- with support from commercial enter- Fortunately, installing Wine is now dows programs below the user directory prises, Wine has now reached a stage of child’s play. Long-winded build and in the .wine subdirectory. Be careful if development that allows users to run an install processes are a thing of the past you log on as root. Just as Linux system amazingly large number of Windows for most distributions, as the official users should only log on as root to per- programs on Linux. This article takes a Wine Site has matching, and well main- form administrative chores, Wine users practical look at how to use Wine. tained, packages for Suse, Red Hat, should never use privileged accounts. Fedora, Debian, Mandrake, Slackware, For one thing, Windows programs are Installing Wine and even FreeBSD [1]. Older packages not exactly renowned for their security As Wine is subject to rapid development are also available [2]. After downloading and might compromise your system: for cycles, the version you use is critical. It the package, users with RPM-based dis- another, system calls that might other- does not make much sense to go for the tributions can simply become root and wise fail could work for the root user, latest version; in fact, I would suggest give the following command and this makes program behavior unpre- adopting a conservative approach and dictable. keeping a working version. Restrict rpm -Uvh wine-200xxxxx-* You will need a new Wine directory to experiments with new systems. complete the installation steps; if you The Wine version that I use myself, to install Wine on their systems. If a pre- have a pre-existing Wine directory, you 20041019, is not the latest. Wine pack- vious version gets in the way of the should rename it just to be on the safe Advertisment 31 COVER STORY Wine side. Initializing a new directory is quite Wine uses links below the ~/.wine/ sion setting is the setting for which the simple; just type wine at the console. dosdevices directory to provide the drive Wine API has the most functionality. This places the config configuration file, letters that Windows expects. The links The most powerful switch-box is and the Windows registry database, have exactly the names that Windows located below [DllOverrides] (Listing 3 which will store files with the reg suffix, programs expect of drive letters, that is, line 6). This is where you specify which directly below the ~/.wine directory. c:, d: and so on. Thus, the c subdirectory built-in Wine libraries you will be using More recent Wine versions do not create maps the Windows C: drive within the and which you will be replacing with the a config file. The following command: Linux filesystem tree, and this is where original Windows versions. These set- the beginnings of a typical collection tings can be prioritized; for example, cp /usr/share/doc/wine-U of Windows files and subdirectories specifying "native, builtin" indicates that 20041019/samples/config ~/U appears when you launch Wine for the Wine should search for a native library .wine first time. c/windows has a few symbolic first. If this library is not available, the links to programs such as regedit.exe or Wine copy is used. To use the original copies a template file. Incidentally, Wine notepad.exe; these programs are part of Windows DLL, you need to store it in does not support the original Windows the Wine package and should work the simulated Windows filesystem tree Registry file. Instead, Wine uses a clear- without any additional configuration. below windows/system or in the direc- text format, storing the system and user To test this, let’s call tory that contains the application you Registry hives in the system.reg and user. will be launching. However, not all DLLs reg files. As programs do not typically wine notepad are really appropriate or useful. For access the Registry directly, but take the example, the Windows kernel, user sys- recommended approach via system calls, This should launch our first program on tem, and graphical subsystem are this is a good way of making the Registry Wine. Some Wine packages install these located in the DLLs kernel.dll, user.dll, database easier for humans and programs as hard links in the Linux file- and gdi.dll, and can’t be used with machines to read and modify. system tree, allowing users to simply call Wine. The same thing applies to the 32- Notepad to launch the application. bit counterparts, kernel32.dll, user32.dll, and gdi32.dll. Low level DLLs, most Simple Configuration drivers, and VXD files are similarly The config file handles the Wine config- useless. uration. The structure of the config file is quite simple; just like a Windows .ini DLLs file, the config file comprises group Windows 98 DLLs are your best bet; names in square brackets, followed by some of them are available off the Inter- "Key" = "Value" pairs. In contrast to net [4] or from Microsoft. Avoid Win- Windows, both keys and values need to dows XP libraries, as they more or less be quoted, and comments are indicated never provide error-free service. Even by semicolons. The group order is not with Win98 DLLs, caution is recom- important. mended. Some work fine with some The [wine] group (Listing 1) contains applications, but the built-in Wine ver- a number of basic parameters that gov- sion performs better with others. In ern the filesystem structure and access many cases, Wine can leverage the so to the Linux system resources. You might called controls, that is, DLLs that provide like to set the "ShowDirSymlinks" and "ShowDotFiles" parameters to 1 here, to Listing 1: config Part 1 allow Windows file displays to show you 01 [wine] all the files on your Linux system.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us