Advanced Wine User Information

From Wine-Wiki.org
Jump to: navigation, search

Contents

Advanced Wine Software Installations

This page now focuses upon Advanced tasks involving installing software on wine (it became too big, and we split it into two), whereas the Advanced Wine Installation page examines advanced methods of installing wine, such as changing the location of your wine install.

When Wine will not do the job

Yes, sometimes wine cannot do everything you need. While it can run an amazing spread of programs, sometimes working better than windows itself, there may be that one commercial program that you need that does not work well enough on wine. But you can still get the best of both worlds.

[Oct 09 wineusr] One of the coolest things in Linux is that the Terminal Server Client implementation is very mature. In fact, there are more command line options for the ts client (rdesktop) in Linux than in Windows. What I do for my SAP Business One users is that I install Ubuntu Linux, then I create a bash script using rdesktop, like:

rdesktop 192.168.0.1 -u 'username' -d DOMAINNAME -p password -k es -g 1249x753 -m -s 'C:\Program Files\SAP\SAP Business One\SAP Business One.exe'

Using this options, you will get an app window with SAP only, no Start menu, no task bar.

You get a lot from this approach, in one hand you can have a stable, virus free, user proof client OS, and in the other hand you get a controlled and easy to maintain SAP Business One environment. I have 24 SAP B1 users and 19 of them work using this TS+Linux approach, so, when I have to deploy an AddOn or update B1 version, I only have to do it in 5 computers only intead of going to 24 seats. I also use Wine a lot[..]

Copying Software across from a native Windows Installation

Occasionally Wine will not install the software, yet it may be able to run the software. At first this would seem a catch 22, but you can copy the installation across from a Windows Installation. This may require some medium level debugging as Windows often stores information in the registry. However this is often easier than it sounds.


L. Kurmos [Nov 05]: you'll need to save the registry keys from the windows parition and patch them into the wine registry. For some apps this is easy as all the keys are in one place (local machine\software) but for others it maybe near impossible as they scatter their keys all over the place.

G. Streeter: Use regmon from www.sysinternals.com on [Your software]. This will give you an indication of from where the registry keys are being read. wine archive


L. Kurmos: you can export keys [using] the regedit program in win. [click on the start button, Run, type regedit and press enter..] The majority of programs store keys in

/local machine/software/<app name>

[and] for these [programs] you should be able to export the key folders .[...] Luckily when you export keys from win regedit. They are saved as a simple text file. wine also uses a text file [...] (for a normal install this is ~/.wine/user.reg) adding keys from your win system here should allow the apps on it to run in wine. If you're not familiar with registry keys, hopefully it should be obvious how these work if you take a look in the text file. Some apps will spread keys all over the registry and you will have a hard time to find out what keys it needs. wine archive

Further Reading


Running Software across from a native Windows Installation

This is something that is very dangerous to do and you really do need to know what you are doing. If you are thinking of experimenting, then dont. This is an very advanced wine task that can be quite tempting to try and play with, but stop right there. Dont do it unless you are a wine guru. You need to give wine access to the windows file system, but this is a two edged sword, in that many programs are not expecting to be running this way, and they or wine itself are likely to alter your windows files and leave you with a broken Windows system. At least you can say that you were warned.

Mounting the Windows file system can run into trouble with permissions as noted in bug 10282: S Szakacsits If you use the 'users' mount option then mount(2) will be done with the 'noexec' mount option (you can confirm this by checking out the ntfs-3g log messages under /var/log) and you will not be able to mmap programs for execution. Solution: add the 'exec' option to the of the mount options. Like:

/dev/hda2 /mnt/ntfs2 ntfs-3g users,uid=1000,gid=1000,exec 0 0

Then Wine will work fine like in the other cases.

A patch around wine 0.9.60 changes things to prevent setting wine to run on Windows. However it doesn't prevent someone from changing it manually via symlinks. D. Kegel bug 12666: That's probably ok. We don't want to stop the wizards, just the innocent. A. Julliard: there needs to be a way to work around the check for people who know what they are doing.

Vitamin [sept 08 wineusr] There are several reasons why you shouldn't never try pointing Wine's c: drive to real windows' c: drive: - Wine will destroy windows installation by corrupting some key system files. After that windows won't boot - Wine is made to work with it's own dlls, data files, directory layout, permissions, etc. You will "kill" Wine if you try to copy all windows dlls from system32 into Wine's system32. - Wine can't read windows binary registry files. - Windows uses NTFS partition that still does not provide 100% required functionality for some programs (fixed in kernel 2.6.26+ only). All this means - you have to treat Wine like a totally separate PC. And you have to install all the programs on Wine before you can use them You could map the windows drive in winecfg for easy access. But I'd strongly suggest making a copy of all the data files to use with Wine. In case files get corrupted. [emphasis added]

J. Dresher: you can [with care..] share your Documents and Settings [folder]

Installing using an .inf

A user asked: How can I install from a .inf file? D. Kegel [jan 08] The same way as on windows, using rundll32, if it doesnt work file a bug:

Running Wine on Multicore Processors

Restrict Wine to One CPU Core

Aug 08 wine user: What would I need to do to make wine run LotrO on just one core, or, [...] How do I set it to use both to test if that helps?

Jeffz: You need to set the affinity mask for the Wine process so that it only runs on 1 cpu, you can use a tool called schedtool, once you build or install it you run it as [opening a terminal window much like a dos window]:

cd ~/.wine/path/to/lotro ~/schedtool-1.2.10/schedtool -a 0x1 -e wine lotro.exe

Gert: You can also use htop to set the affinity if you have that installed...Press "a" when the desired process is selected.

For one user, Dmisio suggested using taskset [sept 08 wine user]. The user tried a script with the last command as

cd "/home/thomas/.PlayOnLinux/wineprefix/SimCity4/drive_c/Program Files/Maxis/SimCity 4/Apps/" wine "SimCity 4.exe" -d:software -intro:off > $@

Vitamin noted: 'taskset' is a program not env var. The last command should be:

Code: taskset -c 0 wine "SimCity 4.exe" -d:software -intro:off $@

Vitamin gave another example [feb 10]

taskset 1 wine program.exe

wine user Aug 08: I am running Wine 1.0 under Fedora 9 x86_64. The problem is that the two mentioned games use a lot of CPU power about 50 % on a 2 Ghz Core 2 Duo. [...] Does anybody has any idea where can I look for the source of this problem?

Jochen: Many older games that are programmed for Windows and DOS use busy-wait polling for the input devices, such as the mouse. busy-wait polling means that the program will do nothing, but ask the input ports for new data. This kind of polling causes a CPU usage of 100% (single core, 50% dual core, 25% quad core). It does not matter how fast the CPU is, the program will consume it all. I am pretty sure if you would run these games on windows, the task manager would report the same. Many old DOS games behave this way, but usually in emulators like dosbox you can reduce the cpu cycles the emulator can use. That will then reduce the CPU load. But of course WINE is not an emulator [...] So in short: it is no wine problem, but a design decision of the makers of the program [...]

Running Software on a NTFS Partition

NOTE: This NOT about running wine on a partition that has windows installed. If you try running wine on Windows, prepare to reformat (it is as crazy as trying to run win2k on top of win98 - something will break).

Sz. Szakacsits [May 08 bug 12836] in reply to a developer who claimed that the NTFS driver is incomplete and doesn't support all needed features: [...] We are not aware of nor were reported any, and other software sure work fine with the NTFS-3G driver. The most common Wine problems are documented at http://ntfs-3g.org/support.html#wine

It can be summarized as either not using the 'exec' mount option, or not using at least Linux kernel 2.6.26-rc1 which added support for shared writable mmap what some Windows software need.[..] The 2.6.26 kernel was released with shared writable mmap support mid July 2008.


If you want to run something on a partition, or install it on a spare partition that does not contain a windows registry Winehq Bugzilla entry 19214 By default distros mount NTFS partitions with noexec option. (you will probably need to change this)

Running Software on a VFAT Partition

Vitamin jul 08: there are few known problems with vfat partitions. Just don't use them with Wine.

Running multiple instances of a program

I want to run three separate, different apps and three instances of an identical app.

D. Clark: In general, that works fine. Running multiple apps and multiple instances of the same app has worked for many years in Wine (I have done it many times). And there is no need make another copy of the application directory to do it. I hope you don't mean you are somehow attempting to copy the entire C: drive or Wine binaries. So there is apparently something that the particular app you are using is doing that prevents this. Can you run multiple instances of it under Windows? Wine Archive Link

Running software on a new virtual desktop

Feb 08 wine devel: to start a new virtual desktop.

wine explorer.exe /desktop=Name,800x600 myapp.exe

E. Savage noted: Running the apps in their own wine window fixes several usability issues I was having with them (as I don't like playing games fullscreen).

Sept 08 wineuser: Cerin: Is there anyway to instruct wine to force a program to run in windowed mode?

Vitamin: Run winecfg, go to graphics tab, check "Emulate a virtual desktop" and set initial resolution (program can change this size if it needs to).

Running multiple programs at the same time

A user commented on wine user [Feb 06] In another thread, a user was told to execute: wine 'prog1 prog2' to run them both at the same time.

D. Kegel: That's incorrect. You have to do something like

wine prog1 &
wine prog2

Limiting users Running Wine /locking down wine

Dec 10 is it possible to limit user when using wine. For example allow for a certain user to run only 1 application?

M. Gregorie: Yes. Its called a "captive login" Are you expecting the user to be logging in from the Linux console or over the network? The way you implement it will be different in each case.

Simply changing the login for that user with the user management tool may do the trick for console logins - or not, depending on the run-time requirements of the single application, but basically you'd change the Login shell: setting it to something like:

/bin/bash -c /path/to/application

might do it for you, but I suggest you do a search on 'captive login' and read up on it and/or ask your distro's support forum before trying it. Its not necessarily straight forward to do and a simple approach may not stop a determined visitor from breaking out of your captive login jail.

You'd do well to also look at "chroot login" as well, though this link may give you a headstart: http://www.kegel.com/crosstool/current/doc/chroot-login-howto.html

dimesio pointed to a forum link: http://forum.winehq.org/viewtopic.php?t=10176

Blocking Internet Access

D. Kegel 2011 Jan: So you want to prevent a particular program from accessing the internet? Perhaps apparmor is the way to go, see https://apparmor.wiki.kernel.org/index.php/QuickProfileLanguage#Network_Rules

Running a wine program when you start up and log in

A user asked about how to run a program on startup [wine user jun 2008].

R.H. I am guessing that he wants on login. If not then just ignore this. At your menu at the top: System->Preferences->Sessions. That will open a window with a tab selected that says Startup Programs. Click the Add button. Name it what you like, The command would be wine /path/to/your/program.exe. Add whatever comment you feel appropriate. That should do it, just restart X and it should load up. (Make sure after you add it that it is enabled.)

Starting a Service

Daniel asked aug 08 wineuser: I have software which runs as a service, and I can get this to start at login using wineboot, but I'm trying to start the service before login.

Vitamin: You will have to setup NX (or like) server aka "virtual X server". Wine (in most cases) can't run without one and you won't have one before you login. Then start it at any time you want it.

Register Com ActiveX

A user tried [2011 feb] wine "c:\MSDERelA\setup.exe SAPWD="sa" SECURITY=SQL"

Vitamin:Wrong. Correct way: Code: wine 'c:\MSDERelA\setup.exe' SAPWD=sa SECURITY=SQL

Software Installs with Multiple CD's

S. Cragin [Apr 07 wine user]: with the solution to the 2-CD install problem. To eject the first cdrom, open a NEW terminal window, type

wine eject

and the CD will eject. Then close that terminal window, and insert the second CD.

V. Margolen [Dec 07 wine bug10725]: When using the terminal there are two valid methods of running applications. The first method is to chdir into the program's folder and then run the application directly, e.g.

cd "~/.wine/drive_c/Games/Tron" && wine tron.exe

The second method should ONLY be used if you are intending to install from something which has multiple CDs (you need to use this method to allow you to swap discs) as it doesn't always work. It consists in using the full Windows path like so...

wine "C:\Games\Tron\tron.exe"

Do NOT run with the full Linux path i.e. "wine /stuff/mygame.exe" or by double clicking icons from your file manager (sometimes this works but more often it will fail with errors of some sort). This is because Wine passes this path as-is to the windows program in argv[0]. This is exactly what cmd.exe does and Wine has extensive tests for that. However some programs expect fully qualified windows path in argv[0], and break if they don't get it. Lots of programs written with Borland tools will have that problem because Borland mistakenly stated in the manuals that argv[0] will always be set to fully qualified path of the executable. Which is not the case.

R. Dunn [Wine devel 29 may 2008]: with AoE, I have recently tried this with the same setup (except for using 1.0-rc2). I haven't submitted these results yet as I need to verify them on a clean setup[...]

  1. wine /media/cdrom0/aoesetup.exe works, but running the game gives a "no CD in drive" error;
  2. wine "d:\\aoesetup.exe" also works, and does *not* give a no CD error.

Running Dos Software

Wine has an implementation of cmd, as well Wine start and others. However it is not complete and there are alternatives.


A user asked [Mar 07] Is there some fundamental reason why WINE could not be made to support old DOS apps (like Warcraft), or is it just a matter of missing libraries and such? In other words, is there a reason why DosBox, etc. are full hardware emulators, or why full DOS library support in WINE still wouldn't be enough?

P. Troller: I think that one of the reasons is that old DOS apps are often very "dirty", trying to directly access the hardware - ports, graphic card, sound card etc. It's the main reason for which a hardware emulator (or even direct access to physical ports, like in dosemu) is more suitable than the software layer only. And because for example dosemu or dosbox are mature and almost stable apps, it's not necessary to "triplicate" the effort and create yet another DOS emulator .

Anon [Jun29 07]: This doesn't explain why the same DOS software will work in Windows on the same machine, but won't work in WINE. There must be a software-only compatibility layer we're missing.

Ed. You can run command line software in wine. See Wineconsole

sometimes dos software does things that are not allowed... so you can use alternatives to wine. suggestions were made to one user [July 07 wine user]

The reason is that it really doesn't make sense to do it in WINE, because the way support for DOS apps works under windows is essentially the same thing that dosemu does, basically, the question is not why doesn't WINE do this, but why would it? dosemu does not usually do full system emulation, and neither does Windows, they both handle things that DOS apps do that would mess up Windows/Linux by "trapping" them, then emulating the effects, this has the advantage of being fast, but means that LOTS of stuff doesn't work (eg sound on Windows), and some apps don't work at all. DOSBox has far better compatibility because it is a full system emulator. So if you want a dos emulation layer that is roughly equivalent to what windows does, use dosemu, but chances are DOSBox will give you better results, and these days DOSBox is fairly fast (Through doing some tricky things so that it can almost just use traps).

Running Batch or Bat Files

A windows batch file is not meant to run under a linux terminal window, it needs to run under wine. Try wine cmd.exe

A user asked aug 08: will wine be able to run .bat files? Another replied: Yes with 'wine cmd.exe /c file.bat'.

jeffz july 08 gave an example:

wine cmd /c foo.bat

Installing Java

This is covered by the developer wiki:


Running a program which clashes with the name of a wine executable

Daniel noticed a problem which just popped up in the newsgroup [Nov 05]: Imagine a program called start.exe (or notepad.exe or regedit.exe, etc.). Invoking 'wine start.exe' will not run this program, but the start.exe that comes with wine. The only workaround is to do WINEDLLOVERRIDES="start.exe=n" wine start.exe. wine archive He suggested for the developers to implement 'wine ./start.exe' but the discussion ended at this point.

Running a program with runs another

wine user Aug 08: I have an application sent to me from a friend in Japan (call it abc.exe) [and] a translation program (call it 123.exe) [..] I need to open the original program through the translator. [..]In Windows, I would create a shortcut that said (open abc.exe using 123.exe). [...] The translation program has no open option. It doesn't work any other way. So, does anyone have any idea how I can accomplish this?[..]

jeffz: Assuming your program 123.exe and abc.exe are in c:\abc from a terminal,

cd ~/.wine/drive_c/abc && wine 123.exe abc.exe

The software tells you that there is insufficient free space

A user reported a problem with software incorrectly thinking there was insufficient free space on the hard drive:

Your c: drive has [blank] MB left, you need to free up space

D. Skorka [Mar 07 wine user]: a combination of old programs and great amounts of free space can result in integer overflows. In this case, a workaround is to create a small loopback filesystem for the installation. You can even mount it under ~/.wine/drive_c/...

D. Kegel: Which applications, exactly, and which version of Wine? I fixed a bug in Wine last year that caused exactly this symptom for old win16 applications like Lotus 1 2 3 R5.

Running wine with multiple Languages

L. Rayhen: You need execute [locale-gen] as root. For example:

su
/usr/sbin/locale-gen

If you really don't have locale-gen then you should fix this. Make sure that you have Romanian locale in /etc/locale.gen .

The user replied with the answer to the locale command:

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

L. Rayhen: Accordingly to your locale settings you will be able to use only English input in WINE with English UI. Therefore you need to fix your locale configuration. You need to change LC_ALL to Romanian locale. If you want to keep Englis interface then don't touch LC_ALL and change LC_CTYPE only. Make sure that your locale has been generated successfully with locale-gen before trying to assign it. If you don't know how to setup your locale configuration refer to documentation for your distribution. If you need more help please tell me what distribution you are using.

Another with chinese was advised: You have wrong locale settings; if you want to use Chinese language with WINE (and see Chinese symbols in file names) you should fix your locale. Try this:

wineserver -k
export LANG=zh_SG.utf8
export LC_ALL=zh_SG.utf8
wine notepad

This should fix your problem. If you want to keep English interface you need to change only LC_CTYPE.

With Japanese one wrote [nov 07]: I tested locales which are soppose to be valid in Japan like ja_JP.eucjp, ja_JP.sjis or ja_JP.utf8 but could't get good result. I also tested native Windows "English" edition which is different from "Japanese" edition with MUI package, but different problems occured like Mojibake buttons and good menus reversing my wine problem which are Mojibake menus and good buttons.

Another wrote: The problems are cause of no fonts.After link directory that contain fonts to ~/.wine/drive_c/windows/fonts, Japanese menus are displayed correctly[...]


Running Software with another Language

When starting wine, set the language you want. Type it carefully as it is case sensitive. If you want, make a small script to do it for you when you start the program, or edit the desktop command for the icon.

Grof [wineuser sept 08] If I want that Application correctly show my extra characters (Croatian chars), I must before calling apps set LANG variable on this way:

LANG=hr_HR.UTF-8 wine app_name

A user [sept 08 wineusr] tried to install though an .msi installer. That particular installer has an option of choosing which languange you want to choose, and since im not a native english speaker i chose greek. now instead of displaying the correct letters i got a bunch of "???" instead of the ones i should get! My ubuntu installation supports and displays greek encoding without any problem [...] Is there any way to fix it?


vitamin: Set LANG environment variable to correct locale "el_GR.utf8" [using the command line]:

LANG=el_GR.utf8 wine start setup.msi


On user found a surprise [sept 08wineuser] a window pops up and says I can only run the app if my language is set to English (further confusing me because I assume it is in English by default). So my question is, how do I do that?

Vitamin: Run your program this way:Code:

LANG=en_US.utf-8 wine program.exe



neVs wrote: > You need to find the Code for England and also set the sCountry and > sLanguage in HKEY_CURRENT_USER\Control Panel\International .


That won't work. It will be overwritten at the startup time.

Uninstalling Software under Wine

vitamin [wine user jun 08] Bugs related to uninstalling programs on Wine are the really low priority. You can easily and cleanly remove all the installed programs under Wine by removing ~/.wine directory. This of course does not uninstall Wine itself from your system. The only side affect - this will remove ALL programs. If you like to keep some of them around - use separate WINEPREFIX (that ~/.wine dir) for each program.

D. Jovanovic jul 09 winedevel: Mnus don't come from ~/.local/share/desktop-directories. Files under ~/.config/menus/applications-merged/wine-*.menu link in ~/.local/share/desktop-directories/* and .desktop files from ~/.local/share/applications/wine/*.


Icons

A user asked how to get wine to make an icon but was informed: vitamin may 2008 wine user: You can do that with proper API calls. Or you can just install that software on Wine. This is so complicated for a reason - extracting icons from executables might be considered copyright infringement. You can always use 3rd party resource editors to get those icons out.


Icons for Windows Applications

Icons with KDE konqueror
O. Stieber [Jun 05]: Wine Archive I mentioned that I had a plugin for KDE so that the correct icons for windows applications (and the icons in dlls) are displayed in the file explorer. A few people seemed interested so I've put the plugin up on KDE apps.

http://www.kde-apps.org/content/show.php?content=25430


Extracting Icons

If I have a Windows-program, which comes with an installer and the program wants to create icons on the desktop, then Wine creates on the desktop a link to the installed program, extract an xpm icon from it and use it as icon for the desktop. But if I have a program with no installer and I want to bring it manually on the desktop (what I already have done), how can I extract the nice icon from an Windows EXE-file?

J. LaBarre [Sept 05]: What I've done before is to use IrfanView (www.irfanview.com), which is a free Windows image viewer. It installs nicely under Wine as well. To extract the icon from an EXE, simply open the .exe file inside irfanview, and it will show you the first icon in the file. At the top of the window is a "Page x/y" box and up/down arrows next to it. this will scroll through the icons in the file. Then you can do a "File | Save As" to save the icon out to a seperate file. It doesn't create XPM files, however, so you will have to use PNG (or BMP, etc.) Wine Archive

Another time this was raised M. Dee [dec 06 wine user]: to recreate Windows application icons for use in those programs [what] I run under Wine is:

The user replied that: I've found an open-source solution for POSIX systems which works great. It's a suite of programs called icoutils and you can download it for free at: < http://www.nongnu.org/icoutils/ I highly recommend icoutils. The author, [redacted] answered both of my emails within hours! Thanks again [...redacted] for all the help!

Mixing Linux and Wine

Java

A user queried about his software [May 07]: When I install it under WINE, it installs fine, but when I run it, it gives a 'JRE is not installed' error message. I have a Linux JRE already installed. Do I have to install a Windows JRE? Or is there a way of telling WINE about the Linux JRE I already have installed?

J. Hawkins explained: You have to install the Windows java binaries in wine. [May 20 2007 Wine users]

Running Linux software From Wine

First of all, there is an example in the official Wine FAQ.. http://wiki.winehq.org/FAQ#head-68d921c50355f280a905e3574b7dda58d76ff51f Wine user jun 08: I have a windows application running under wine that needs to launch/start a linux application, what I did was make a script and saved it as launch.exe in launch.exe I simply have the

#!/bin/bash
/usr/bin/linuxapplication

and so my windows program under wine starts launch.exe which under unix starts my linuxapplication.


i want to define which application should be started for which attachment type. For microsoft attachments i want to start my linux version of open office and for pdf files i want to start my linux version of acrobat reader or xpdf. Where do i have to configure this stuff?
A Wine Lotus Notes User replied Wine Archive Link: It's possible and works very fine when you right-click at the document. See below.

I did the following 2 steps:

1) put an entry at the ~/.wine/system.reg like this (example):

------------------------ 8< --------------------------------
[Software\\Classes\\.pdf] 1051470000 @="acroread.pdf"

[Software\\Classes\\acroread.pdf] 1051470000 @="Documento Adobe PDF"

[Software\\Classes\\acroread.pdf\\DefaultIcon] 1051470000 @="C:\\Program Files\\Acroread\\acroread.exe,1"

[Software\\Classes\\acroread.pdf\\shell] 1051470000 @="open"

[Software\\Classes\\acroread.pdf\\shell\\open\\command] 1051470000 @="\"C:\\Program Files\\Acroread\\acroread.exe\" \"%1\""
---------------------- 8< ---------------------------------

2) the linux "executable" acroread.exe *must have been placed at the above dir (the linux "executable" is a shell script so you can do anything you like from now on ;)). Follows an example:

---------------------- 8< ---------------------------------
#!/bin/sh

#set -x
m kdir -p "$HOME/tmp"
L OG="$HOME/tmp/acroread.exe-log.`id -u -n`"
e cho "Arguments received: $@" > $LOG
#
R ESULT=`winepath "$@" 2> /dev/null`
e cho "/usr/local/bin/acroread $RESULT" >> $LOG
T MP=$TMPDIR ; TEMP=$TMPDIR ; /usr/local/bin/acroread "$RESULT"
# removing the temporary file
r m -f "$RESULT"
---------------------- 8< ---------------------------------

I already have system.reg entries for various extensions (DOC, SXW, XLS, SXC, ZIP, HTM, JPG, etc) and their respectives "executables". You have to be careful with some tricks like the $TMP and $TMPDIR that are modified by wine. You can have lots of informations if you put at the end of the "executable" script an entry like: "env >> $LOG" to see the environment variables and anything you like. If this helps I'd like to know because we can exchange new "executables" for other extensios (mimes)/entries. One more tip for lotus notes. You can also modify your browser settings in order to start a linux browser when you get a HTTP link at the email. My notes is in portuguese (brazilian) so I'm figuring out the path/location of the parameters in english .... you have to choose (at the right side at the end of the notes window) something like: Office->Edit current->Internet browser. At the "internet browser" choose "Other" and then navigate through the file system in order to find the "mozilla.exe" shell script below (put it somewhere else). There is no need for a system.reg entry.

 mozilla.exe
---------------------- 8< ---------------------------------
#!/bin/sh

#s et -x
m kdir -p "$HOME/tmp"
L OG="$HOME/tmp/mozilla.exe-log.`id -u -n`"
e cho "Arguments received: $@" > $LOG
M OZILLA_BIN="/usr/bin/mozilla"
L ANG=en $MOZILLA_BIN -remote "ping()" 2>&1 | grep "No running" >> $LOG 
2 >&1
i f [ $? != 0 ] ; then
        e cho "Calling: $MOZILLA_BIN -remote \"openurl(\"$RESULTADO\", new-window)\"" >> $LOG $MOZILLA_BIN -remote "openurl($RESULTADO, new-window)"
e lse
        echo "Calling: $MOZILLA_BIN \"$RESULTADO\"" >> $LOG $MOZILLA_BIN "$RESULTADO"
f i
---------------------- 8< ---------------------------------


example number 2

Anon: With the Notes client application I have, you can do this [With open office]:

a) append the following entry at your ~/.wine/system.reg (for DOC entensions): [Software\\Classes\\.doc] 1051470000@="ooffice"

[Software\\Classes\\ooffice] 1051470000@="Documento Office"

[Software\\Classes\\ooffice\\DefaultIcon] 1051470000@="C:\\Program Files\\OpenOffice.org\\ooffice.exe,1"

[Software\\Classes\\ooffice\\shell] 1051470000@="open"

[Software\\Classes\\ooffice\\shell\\open\\command] 1051470000@="\"C:\\Program Files\\OpenOffice.org\\ooffice.exe %1\""


b) for every extension you want you can put the same entry just replacing the ".doc" string to the string you wish. For example: replace ".doc" for ".xls" and so on and put an entry like this for each extension you want: [Software\\Classes\\.xls] 1051470000@="ooffice"

c) You'll have to put the shell script in the same directory you=20 have at the registry entries. In our case the "executable" must be at: C:\\Program Files\\OpenOffice.org\\ooffice.exe

d) the "executable" oofice.exe is the following shell script:

  1. !/bin/sh
LOG="$HOME/tmp/soffice.exe-log.`id -u -n`"
echo "Arguments received: $@" > $LOG
RESULT=`winepath "$@" 2> /dev/null`
echo "/usr/bin/soffice $RESULT" >> $LOG
TMP=$TMPDIR ; TEMP=$TMPDIR ; /usr/bin/soffice "${RESULT}"
rm -f "$RESULT"

Of course, the "/usr/bin/soffice" is the Linux executable and has to be the full path to your openoffice.org executable or script provided with the OOo package. Wine Archive

Script to patch registery + fake executable using gnome-open

Tested and working with wine 1.0 (Inspired by and stream-lining the previous examples) Really usefull for opening attachements in Lotus Notes. Run this script: it kills the currently running wine and updates the system registry for doc, ppt, pdf, odt, svg and zip (you can add or remove from this list) In case of error, a copy of you registry is performed and stored aside. All these file formats will be consequently opened with the program c:\gstart.exe

#!/bin/bash
killall wineboot.exe wineserver >/dev/null
REG=~/.wine/system.reg
cp $REG $REG.save.$(date +%F_%H-%M-%S)
for i in doc ppt xls pdf odt svg zip
do 
NB=1051470000
echo '[Software\\Classes\\.'$i'] '$NB'
@="gstart.'$i'"
"Content Type"="application/'$i'"
[Software\\Classes\\gstart.'$i'] '$NB'
@="Document '$i'"
[Software\\Classes\\gstart.'$i'\\DefaultIcon] '$NB'
@="C:\\gstart.exe,1"
[Software\\Classes\\gstart.'$i'\\shell] '$NB'
@="open"
[Software\\Classes\\gstart.'$i'\\shell\\open\\command] '$NB'
@="\"C:\\gstart.exe\" \"%1\""
' >> $REG
done

The program gstart.exe must be placed in ~/.wine/drive_c/ and is

#!/bin/sh

LOG=$HOME/.wine/gstart.exe-log.$(id -u -n)
OPEN_HANDLER=/usr/bin/gnome-open
echo "$# Arguments received: '$@'" > $LOG

RESULT=$(winepath "$@" 2> /dev/null)
echo "$OPEN_HANDLER $RESULT" >> $LOG
TMP=$TMPDIR ; TEMP=$TMPDIR ;$OPEN_HANDLER "$RESULT"

You can remove the logging part when everything works as expected. Nota: the temporary file is not deleted after running gnome-open because gnome-open returns instantaneously.

Running a Linux Application from Wine and catching it's exit code

A developer wrote: we have a Windows application "App1" which starts another application "App2" using CreateProcessA, then doing some different work, and finally waiting for "App2" to finish using WaitForSingleObject. It is important for "App1" to catch the exit code of "App2" as well as "App2's" messages on stdout. This works fine with Windows applications.

Unfortunately, this does not work as soon as "App2" is a Linux application; "App1" seems to wait forever. Looking at the code of process.c and sync.c in kernel32, it seems to me that wine forgets everything about the Linux process once it is started.

E. Pouch: the point is that we currently don't trace pure unix process as being windows processes hence you lack the ability to get some information on them (wait on exit, get return code...)one of the things we could do is to:

  1. create a winelib app (say winixec) which does basically:
    WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    {
    return system(lpCmdLine);
    }
  2. setup the application to be called as "winixec foo args" instead of "foo args"

this would work in some of the cases, but fail for all the other operations (resume/suspend, debug...) which shouldn't be an issue in your case wine archive

M .Ost: My solution was to create a DLL interface that implements a function called "linux_command". On Windows it is stubbed out, but in Linux it a system() type call. App1 can link against it in Windows, but do nothing. When you link against it at runtime in Wine, you can do the linux command. Then I run an async bash command, capture the pid, and check for it later. This, after long hours of attempts and dead ends.

App1

char out[1024];
linux_command("App2 & echo $! > /var/tmp/my.pid", out, sizeof(out));
linux_command("cat /var/tmp/my.pid", out, sizeof(out));
do your work
char command[1024];
sprintf(command, "test -e /proc/%s || echo finished", out);
forever
linux_command(command, out, sizeof(out));
if (strcmp(out, "finished") == 0)
break
sleep

If you are interested I can post the linux_command sources. wine archive

Another programmer appeared to be doing something similar Aug 08 wine user: Finally I have solved to the problem doing a compiled intermediate program with Mingw that is in charge to pick up the parameters of the application and to launch the script linux with them.

There is the code:

int main(int argc, char *argv[])
{
if (argc >= 2)
{
spawnlp(_P_NOWAIT, "/bin/sh","sh", "strjava", argv[0], argv[1], NULL);
}
return 0;
}

Running Wine Software from Linux

A user asked [July 05]: I want to configure Mozilla for opening .DOC files with the free Word Viewer.[...] Is it possible to instruct wine to translate the path string before it passes it to the windows binary? If not, is there a workaround to do that trick?

Dossinger pointed out four options:

  1. Try this script:
    #!/bin/bash
    d ocument=`winepath -l "$1"`
    e xec wine start.exe "$document"
  2. If the word viewer installed the .doc file format in the wine registry you can call winestart /some/unix/path/file.doc and wine will start the asociated application automatically.
  3. I've also written a small C program which scans the registry and creates .desktop files for each mime type found. I've sent a first alpha version to this list late June. With these .desktop files in place you can just click on the files in Konqueror or (I think so, but didn't test) the Gnome Equivalent and they will open. It's far away from beeing mature, but you can give it a try. I don't think that these .desktop files open directly, but theres a kstart program which allows you to open any file KDE knows, and this works from literally any application.
  4. KDE offers a 'kdestart' program. This program is similar to winestart. It searches the KDE mime database and starts the associated application. This can be used to asociate all unknown Mimetypes in Mozilla and other applications, so if Mozilla doesn't know the Mime type, it automatically asks KDE for help.

After trying the program posted previously to the list [late june?], The user reported: Compiled and works fine with KDE Wine Archive


A developer wrote [Dec 07 wine devel] I'm writing a little Linux based program to read some variables from a Windows application. But my problem is, that i can't access to the virtual memory of the Win App running under wine.

J. Lang: ReadProcessMemory? You can only call that from a winelib app (or another windows executable), so if your app can't be a winelib app, you might have to resort to the usual trick: create a winelib app that does what you want, and connect to it via a socket.

J. Zerebecki: If you don't need to use linux APIs in your windows application you can also make a normal windows executable with a windows compiler of your choice. So winegcc/winelib is not a requirement for this style of client/server solution. (You could use winsock to communicate over tcp with the linux application.)

M. Meissner: Reading other process memory in Linux is done using the ptrace() function. Its use is a bit difficult, but there is a nice manpage. You could also make your application a Wine app and then use the NtReadVirtualMemory() or ReadProcessMemory() functions on the other process (after finding it via toolhelp32).

Running Custom Visual Basic Software

Sometimes Custom Visual Basic Software will not run with wine - occasionally this can be because of missing functions in wine's oleaut32.dll, but progress is being constantly made and with some work many programes can be convinced to run well.

D. Kegel posted a script for one application that may help those working at this [Oct 05]: I slogged through writing a shell script that works around all the problems I ran into which installing a VB app that uses MS SQL. Have a look, it's at: http://kegel.com/wine/initvbapp.sh.txt

Using a Windows Dll for Linux

you can use a windows dll and override the fake or partially implemented wine version using winecfg. But this is to be done in a limited manner, one at a time, checking the error messages. Not all dlls can be overriden.

A Programmer queried [May 07]: I have a third party library which is a Windows DLL. Is it possible to use Wine to call its functions under Linux?

D. Jovanovic: You can't link a Linux applicaton to a Windows DLL. The project which would allow you to do that is called the wine plugin API [1], but it isn't written yet. What you can do at the moment is write a winelib application, that is, a Windows application compiled with winegcc which can use both Windows and Linux APIs. [Wine devel May 07]

A programmer questioned [Sept 06]: I have a windows dll and header files. I want to make a library that I can link to and use on linux. What are the steps required to do this?

D. Kegal: That's on the to-do list.

J. White: It's not [...] black and white,[...] I believe you can, and it actually works reasonably well. BUT there's a big catch - you have to make your program into a Winelib application. That is, what you (reasonably) want is just a simple foo.so you can dlopen and then do invoke_my_windows_function(). You can get that, but what you have to do is rename your main to be linux_main, and then write a whole new WinMain which invokes your linux_main. Then, from within your linux app, you can write some glue to make the connection. You can get into trouble if you depend heavily on particular IPC mechanisms, threading in particular, but I believe that basic usages should still work. So, basically, if you're willing to stand your application on its head, you can get the functionality you want [..]] wine archive.

T. Rollo: Actually there's probably an easier way - a scheme I've been considering is one involving a crt0.o designed to load Wine (essentially making the native executable an equivalent of wine-pthread with other stuff), then start a Winelib program whose entry point calls back into a second entry point in the original executable. This scheme ought to work without any modifications to the core of Wine. We also wouldn't need to be reserving any memory areas [He then gave an example].


Dec 10:

can I link a dll.so to a dll.so,or DLL? Vitamin: Yes, you'll need a proper .spec file for the second .dll.so of course. can I link a DLL to dll.so? Vitamin: No, see bellow. Can I make [a] windows DLL with winebuild without wine [libraries] that It can run on xp? Vitamin:No, Wine can't create real PE executables/libraries (aside from fake ones). You'll need mingw cross-compiler for that.


Further Reading

DotNet or .Net

update jun 08 wine user: what I need to obtain and install to run an MS program that needs the .NET framework to function?

vitamin: Depends which version. 1.1 some-what works. 2.0 has lots of problems. 3.x - AFAIK won't work at all.

To install - use winetricks - http://wiki.winehq.org/winetricks


A user queried [Jun 07 Wine user] if his .net application would run in wine.

O. Leidinger: IF your application is a _pure_ .NET application, i.e. it doesn't use any win32-calls, it should work with mono [1], which is an open-source .NET for Unix and Windows. This page might also be interesting for you: http://www.mono-project.com/Moma It scans an executable for mono-compatibility (e.g. detects the usage of win32 calls).

Currently the only way to let .NET applications run in wine is to install the win32 version of mono in wine. MS .NET currently won't work. Dan Kegel wrote a handy shell script which will install mono in wine and sets up some registry keys. But as you might guess not every .net app works in mono right now plus there might be some incompatibilities between mono and wine.

Running Command Line Software

A user reported [Apr 08 wine bug12802] trying a Win32 Console App (rdb.exe) without success until he tried wineconsole. A. English: To allow wine to choose for you. [...] You can use:

$ wine start your_prog.exe

The user reported a fixme error message when using wine start, but fixme messages are rather common and not a problem until they prevent something working.

A user reported [Nov 06 Wine user] I've just installed mingw and family, and I can run MSYS.lnk from winefile,but how can I run it in linux console. I've tried:

wine /home/user/.wine/drive_c/windows/profiles/user/Desktop/MSYS.lnk
wine: could not load L"C:\\windows\\profiles\\user\\Desktop\\MSYS.lnk": Bad EXE format for

The console started by MinGW can't copy and paste to rxvt, but can copy and paste to firefox. It's a pain to have to copy and paste from browser, explicitly using firefox's menu.

D. Skorka: Try starting wineconsole Further Reading

Passing Arguments

A user queried how to pass this application a parameter which must contain double quotes

C. Abbott [Jun 07 wine user] You can't put the arguments and the program exe all in one string. Try this.

wine "C:/Program Files/dynaterm8/dynaterm.exe" �connect:\"con1\"

or

wine C:/Program\ Files/dynaterm8/dynaterm.exe �connect:\"con1\"

both of those types work for me [..] wine is not doing the parsing at all....the shell is. The argument has to get fed to wine by the shell and so has to pass through intact.

Wine Sound

See also Sound Troubleshooting

ALSA

Aug 08 wine user S. Craigin quoted from an earlier post by Vitamin: By default Wine uses only one ALSA card. You have to explicitly tell Wine to look for / use other cards. See http://wiki.winehq.org/UsefulRegistryKeys (Alsa Driver section) for more details. [Ed This user has done a lot of good work assisting developers with Wine and dragon naturally speaking]


Microphone Input

a user rsay [sept 08 wne user]I just got this configured under Ubuntu 8.04. I am using wine 1.1.3 and I have a Samson q1u microphone. I did the following From a linux shell [i.e on the command line]:

arecord -l
**** List of CAPTURE Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC883 Analog [ALC883 Analog] Subdevices: 1/1
Subdevice #0:
subdevice #0 card 0: Intel [HDA Intel], device 2: ALC883 Analog [ALC883 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0 card 1: default [Samson Q1U], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
aplay -l
**** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC883 Analog [ALC883 Analog] Subdevices: 1/1
Subdevice #0: 
subdevice #0 card 0: Intel [HDA Intel], device 1: ALC883 Digital [ALC883 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0

This gave me the information about my playback and capture devices:

Your devices may be different. I then saved the following file in my home directory as .asoundrc

pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}

Under winecfg Audio tab I have checked only ALSA Driver and my microphone now shows up as: Wave In Devices

USB audio
USB audio

Rosetta Stone just worked :D. Its pretty cool to finally be able to do the pronunciation exercises. I swapped my Altec Lansing usb headset for my Samson microphone and it also worked fine without changing any settings. (I would have to change my playback device to get sound thru the headphones if I wanted.) Code

arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC883 Analog [ALC883 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0 card 0: Intel [HDA Intel], device 2: ALC883 Analog [ALC883 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0 card 1: default [C-Media USB Headphone Set  ], device 0: USB Audio [USB Audio]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

Pulse Audio

So Far it does not work with wine too well but there have been improvements. Perhaps this will be largely fixed by the time you read this. May 2008, developers on Wine User have recommend disabling it when running wine. Some progress must have been made. E Smulders Jul 08: While [disabling pulse] is true in some cases, i know from experience that at least for winecfg and some games (not steam), it works fine if you have alsa configured to use pulse. [...] disabling it is worth a try.

EAX

A user queried: I've been searching for a while now, for an answer, whether or not EAX and surround sound is supported in wine.

Vitamin [May 2008 wine user]: No. Both are not supported.

Wine and Databases

RDBMS or Relational Database Management Systems. What some refer to as full fleged Databases can require a little tweaking on Wine.

One User [Dec 05] wrote that the application that is using firebird RDBMS needs GDS32.DLL. and then asked how to install this DLL into wine ?

Y. Glodt: I was in the same case and I put fbclient.dll and gds32.dll to the windows\system directory of the wine directories. Additionally, you have to add this line to the file windows\system32\drivers\etc\services wine archive:

gds_db 3050/tcp

J. Ernst reminded users not to confuse native Windows and Wine: Look in ~/.wine/drive_c/windows/system32/

DAO/Jet

A user reported: The program runs fine but there are no components in the component database. [The error message is]

'unable to initialize DAO/jet db engine' halfway

One user suggested installing Jet4.0 using winetricks

$ w get kegel.com/wine/winetricks
$ sh winetricks jet40

[ed. Dont type in the $ or cut and paste it as well..the $ sign is already present on the command line and indicates that it is run as a user and not as root. Oh, and remove the space in the first command w get.]

M. MeKenzie: This program may also require MDAC 2.8 code:

$ winetricks mdac28

ODBC

D. Kegel [Sept 07 wine bug 9540] I think we should be able to support non-unixODBC drivers. A fair bit of work has gone into making that work.

A user asked[jn 08 wine user] Can I use the drivers in Wine(Microsoft Access (*.mdb) drivers just like I could if I was in a "real" Windows enviroment.

J. McKenzie: No. There is no independent driver support in Wine, yet.

The I would much rather use OpenOffice to develop and test (from Linux), and just have the Access database show up as a datasource in OpenOffice.

J. McKenzie: This is not a Wine problem, is is a LINUX problem. Linux does not support mdb (that is Microsoft Database). There is a project to handle this. OpenOffice.org cannot handle Access type databases without this project being complete. However, if you want to use OpenOffice.org for Windows, you will have to install the Jet 4.0 engine to access Microsoft Access type databases. winetricks is your friend to install this product.

A. Leslie-Hughes [aug 08 wine devel] From past experience, wine needs to be in win98 mode for odbc.

Further Reading

aug 08 wine user posted: When I try to install Oracle Client 10.2.0.1 for Windows I get a error message when I click the next button in the requirements check screen. The error message says "You do not have permission to create service %1%"

Vitamin: Try using UNIXOdbc instead to connect to your database. See user manual for more details on how to configure it properly.

Wine and Networking

Network Access for Wine

A user questioned: How can I configure my Wine setup to be able to connect through my router consistantly?

A Wine user commented: Wine uses the networking provided by linux, there is no seperate configuration. The exception are proxies. You have to create a registry key for that. wine archive


Blocking Network access to Software running on Wine

nodalus [Mar 06]: I don't know how much of wine's source would need to be changed to disallow all network commands, but I know that this kind of thing is possible using iptables (particularly with the owner extension).

If you create a new user id (which will be the one you use to start the application, using su or sudo), something like 'nonet', then run the following:

iptables -I OUTPUT -m owner --uid-owner nonet -j REJECT --reject-with imcp-net-unreachable

or something like that (I haven't tested it), it will block the 'nonet' user and any applications started as it from sending network packets. wine archive

Ed: this is not a per-application setting to disable network access, but blocks all running under user nonet.

Y. Kaminskiy: unless worm/virus/troian specifically targets wine, removing ~/.wine would be enough, re-formating whole system is not necessary.

Running wine from separate user (that cannot easily obtain root via sudo [like usual "desktop user/admin"], does not have access to private user data [~/.mozilla/*/*/{signons,cookies}* and alike], and, maybe, limited network access [with something like

iptables -N winejail
iptables -A winejail -j REJECT
iptables -A OUTPUT -o ! lo -m owner --uid-owner wineuser -j winejail

plus some rules to specifically allow network on some ports/addresses:

iptables -I winejail -p tcp --dport 80 -j ACCEPT
iptables -I winejail p tcp -d ${dns-server} --dport 53 -j ACCEPT
iptables -I winejail -p udp -d ${dns-server} --dport 53 -j ACCEPT

]) would also help limit damage from such incident even with wine-aware viruses.

File Sharing

A user[dec 05] queried using software with a shared file. Under MS Windows, vmware, win4lin the application works correctly. Under wine, the 2nd and subsequent incarnations of the application report

Error - Cannot Open Data File C:\DATA\DATABASE.DF1
This File is already open on this Workstation or it is set to Read Only Mode Procedure New File Menu 22

I've used the file from a local filesystem, via smbfs, and via cifs. All fail in this same way under wine. I'm guessing some record locking call is not doing the right thing.

G. Streeter: What version of windows are you specifying [with winecfg ]? Windows 9x only has write locks. NT and later support read locks. wine archive

Allowing Network access to Software running on Wine

A user noted [Aug 07]: i want Wine to be able to access other machines on the network, i dont want to use samba either.

D. Riekenberg: What is wrong / not clear enough with the Documentation? From the Wine User Guide, chapter 3.3.2 ( http://www.winehq.org/docs/en/wineusr-guide.html#AEN416 ):

mount the shared network folder in linux and create a link in .wine/dosdevices/unc/servername/sharename

Proxy Servers and Wine

In Bug 5625 H. Leidekker [March 08]wrote: Current git obeys the http_proxy environment variable for which graphical configuration screens exist in KDE and GNOME. The environment variable can be overridden by setting this registry key:

[HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001
"ProxyServer"="http://proxyserver:8080"

Wine and Samba

A user of Samba queried [aUG 07 wine user] i need to share a directory of wine with samba, how can i do that ? [..] the directory /.wine is invisible to samba configurator

J. Drescher: Find and edit the smb.conf file manually. Then restart samba.


Region Locking

Fuerst: I have an old accounting software. It runs at the moment on a NT4.0 System which access the program itself on a samba share. ...With wine when I copy the whole folder from the file server to the local filesystem (ext2), it works well, But when I mount the share into my drive_c to the correct path (drive_c/KWIN in my case) and start the accounting software, ...It starts up but after providing the password it fails to open the database where the data is stored. (The application uses a Paradox-Engine from Borland )

It works when all the files are on a local fs but not when they are on a share. NFS and Samba both fail and changing Wine to nt40 did not help.


B. Medland: One possibility is region locking. Unless something has changed while I wasn't looking, the SMB filesystem client doesn't handle locking and so the requests won't work.

A. Browaes mentioned that you can disable locking on the samba side

Fuerst: Okay I solved the problem and indeed it was only a samba issue.

We are now using Samba 3.x...

  1. I had to to stop Samba behave like an NFS server
    • unix extensions = no into my smb.conf.
  2. In the share options (so there will be no problem with locking), I also added
    • oplocks = False
    • level2 oplocks = False
  3. I then too had to remove some temoprary Paradox file from the app (they will

be regenerated when running the app under wine and linux

It now it works. Most of it. I'm not able to close some windows but well this is no problem.

NFS

A user reported [Mar 07 wineuser] on installing WindowsInstaller-KB893803-v2-x86.exe [ with .wine on a network drive (NFS)] i get error message from installer: "unable to find a volume for file extraction. please verify that you have permissions."

J. Hawkins: A lot of Microsoft installers won't install to network drives. To workaround this, go to winecfg->Drives->Advanced for each network drive and change the type from 'auto' to 'local'.


DNS Settings

A user reported [Nov 05] difficulty with wine running a win32 app (which uses FQDNs, not plain IP addresses) [which] cannot connect to the Internet when running on 'wine', and it seems that DNS query fails.

R. Klazes: Lots, if not most, of applications would use the winsock function gethostbyname, which is handled by the Unix gethostbyname function. That works fine ;)

If I add the string registry value

HKLM\System\CurrentControlset\Services\Tcpip\Parameters\DhcpNameServer

and fill it the IP address of a name server it works here. A NT4 nslookup.exe worked immediately, a Win2K version only if I did set the version to NT4. wine archive

Variations of Running Wine with or without X

Dual View Cards

Aug 08 wine user posted: i'm looking for some post about how to lauch wine properly when dual view nvidia capabilites are in use. Any info[...]

Dimesio: Try searching for "twinview." IIRC, it's known to cause problems.

Desktop Mode

A. Julliard [Mar 06]: Moved desktop mode handling to the explorer process. Per-application desktop mode settings are no longer supported. Apps can be launched in a specific desktop window by using:

explorer /desktop=name[,widthxheight] app.exe [args]

If the named desktop already exists the app is launched inside it. The default desktop is cleverly named "default".

T. Spear: users can always modify their shortcuts to the application to run wine with the /desktop command like shown above. Doing it that way does conform to windows [...]

V. Margolen: with Steam and all of it's games - it will be almost 100% unusable! Because we still haven't fixes managed/unmamaged windows. And Steam itself would be on top of everything. So the way people were able to work-around this is by putting Steam into virtual desktop. Now that means their game will run in the same desktop as well. We really really really have to fix managed/unmanaged mode

M. McCormack: It might be a little bit harder to get things done by avoiding hacks at the start, but it's *alot* harder to get rid of the hacks once they're there. People will complain and complain forever that the hacky version worked for them once for one application, even if the new version does alot better for all applications.

R. Shearman: unmanaged windows (there may be others that I'm unaware of): They:

  1. Have no window decorations
  2. Are always on top
  3. Appear on all virtual desktops.

Properties (1) and (2) have equal properties in the Win32 world. However, currently only (1) is implemented. AFAIK, the reason (2) isn't implemented is because it isn't set at window creation time, only after window creation (and we cannot switch from managed to unmanaged after creation). Therefore, the solution is to allow managed windows to be converted to unmanaged windows after creation and then we can implement (2) and have an almost exact match of the desired properties of the window with the actual properties that the window manager gives us. Then we can remove the other hacks based on the window style that make Steam end up with an unmanaged window. wine archive

Fake X Server

If you don't have X available you can set up a fake X server.

A. Julliard [Oct 05]: What we should probably do, now that we have support for a null display driver, is to flesh this out a little more and get rid of the tty driver [Update nov 05 - tty driver has gone]. I don't think anybody in their right mind actually wants to run graphical apps on a tty, and the null driver is probably much closer to what people like you actually need. [...the tty.drv] is really an empty skeleton at this point, all it does is mess up the screen and dump a lot of FIXMEs, and I doubt it will ever do more than that. Putting it out of its misery seems the right thing to do. Wine Archive


A. Julliard: [the null display driver now] very much exists. Running without a display should work just fine with 0.9.1. V. Margolen added: the tty driver is no more and replaced with nulldriver.

Wine and VNC

wineuser sept 08: You *can't* start it from putty unless you set your $DISPLAY environment variable to point to an X server ( and one that will allow you to connect, which they shouldn't by default ). To start with, I would walk over to the PC where you're trying to run it, and check that it runs properly in a local X session. Then you can try with VNC ( ie open an xterm in your VNC window, and start uTorrent from there ). Then when that's working, you can try launching it from putty and exporting it to your VNC session ( if that's what you really must do ).

Resetting X resolution and Other Display tips for Games

wineuser [dec 09] A user thought it might make for better performance if he used 16-bit color but then wondered why his program did not work. Vitamin wrote: All modern video card using 32-bit formats internally. Working with 16-bit they do 16<->32 conversion all the time. Of course this is all transparent and doesn't really affect performance for 2-D. 3D however will suffer greatly. Running in 16-bit will limit number of available formats which most programs won't like - and that's exactly what you seen with Wine.


A user reported that upon: exiting the game I get an 'error writing to address' that pops up in a separate window and I have to kill X and then log back in to get the proper resolution back.

L. Ulmer: [Oct 05]No need to kill X to get back your resolution, just use 'xrandr' to set it back to what you want.


P. Beutner: [Oct 05]I use a small wrapper script to start wine which takes care of restoring the resolution wine archive:

#!/bin/bash
o ld=`xrandr | grep ^* | cut -b2`
w ine "$@"
n ew=`xrandr | grep ^* | cut -b2`
i f [[ $new != $old ]]; then,
x randr -s $old
f i


A user noted [Dec 05]: When wine changes screen resolution, it changes resolution of desktop and that [moves my desktop icons]. Please make resolution switching like "cedega".

Stefan Doesinger: Cedega changes the screen resolution, but desktop dimensions are unchanged. That's a Xrandr issue: Wine uses Xrandr to change the screen resulution: Both the virtual Desktop and the Screen resolution are changed. Cedega only changes the Screen resolution just as if you typed Ctrl + alt + "+". The reason why Wine so is a mouse locking issue: dinput.dll fails to lock the mouse inside the Wine window often, and if the Desktop is bigger than the screen, one can accidentally move the mouse outside the game window. The solution to this one is to fix dinput and avoid the use of Xrandr.

Further Reading Wine Registry

Wine and SSH

x11drv:cannot open display
I use debian linux, which has to run a windows program. the Wine says it says x11drv:cannot open display. what can i do?? shall i change config or what (i use SSH connection).

J. vonThadden: You do not forward your X11 connection via ssh. Read the man page of ssh for this.

X. Bestel: Use ssh -X or ssh -Y. Wine Archive Link


Wine and Cron

A User asked how to run a DOS program in Wine using cron: My test program is a DOS batch file that contains a single line "@echo off", i.e. there is no input or output whatsoever. Of course, the final program would be something different, but for testing purposes this simple batch file should be enough. [...]I have tried setting (and exporting) TERM to a number of devices, among them /dev/null or /dev/tty1, but this didn't help.


P. Naef posted that cron will work with versions of Wine older than May 2005: - set GraphicsDriver=ttydrv within ~/.wine/config - in the shell script that is run by cron, include the line "export TERM=linux" before any wine-related command (e.g. wcmd) is run


This works for me on SuSE 9.1 with wine-20050419, but **not** with wine-20050524. The newer wine completely ignores my setting GraphicsDriver=ttydrv. I found the solution here: http://archiv.tu-chemnitz.de/pub/2003/0101/data/nr3-2003.pdf (page 8; document is in German). Wine Archive


P. Millar [Nov 05] pointed out a change in running crontab: crontab has no DISPLAY variable set[...] Unfortunately, crontab environment isn't attached to any tty, so that fails too with the error message you see. What you really want is the nulldriver [...] What I do for WRT is start up a VNC for the duration, then shut it down again. See script snippets below for some ideas. This should work for you, but its something of a hammer to crack a nut. wine archive


Wine and Xvfb

A programmer posted [Nov 045]: I used to use Xvfb (from XFree86) as the (virtual) frame-buffer device and have some scripts to support that. Unfortunately, that had a nasty habit of crashing whenever one tried any openGL/glx stuff wine archive

T. Rollo: The SEGV is due to the X server failing to clean up some of its structures correctly on a reset - you can avoid it by starting Xvfb with the "-noreset" flag. You will get the same SEGV if you use accelerated openGL against an old Voodoo card and the server resets before the app connects.

Running Wine and Webservers

Running Wine from php
[Jun 05] In a Readhat 9 system, I have a simple php file "test.php" with the following content to generate Setup.exe:

<?php
   e cho exec("pwd");
   e xec('/usr/bin/wine rar a -a -c- -cfg- -k -m4 -zc:\\\\zipper\\\\Setup.cmt -sfx Setup.exe @c:\\\\zipper\\\\Setup.lst ');
?>

When I run it as a CGI script via command line as "php test.php" . The .exe is successfully generated. However, if I load test.php from the browser, the result of "pwd" is shown on the browser but the Setup.exe is not generated at all. I also tried embeded the above wine command inside a shell script test.sh and call the script from the php page, for example:

<?php
   e xec("./test.sh");
?>

but again, the wine command does not produce Setup.exe if test.php is loaded from a browser.

A. Carvalho: I had a similar problem, I found out that even if the program doesn't display anything, Wine needs an X server. So instead of having an X server running on the web server just for that, I decided to use the program Xvfb that comes with Xfree. It's a dummy Xserver that can be used for testing and worked for me to run windows applications via wine on the web server. Just start during boot:

Xvfb :1 &

When you want to run the application, on your test.sh don't forget to set the DISPLAY variable to :1 and that the apache user must have write permissions on the directory.

export DISPLAY:1

Hope this helps. By the way, remember that when you run wine from the web server, you have to have wine setup for that user because it will be executed as the apache user or whatever is configured there.Wine Archive

Wine and Hardware Ports

Com Ports

Linux moves quick so this can get out of date.


J. Lang [Oct 05]:there's no UI to do this yet.[...] By default, you don't need to do any config, at least on Linux. COM1 defaults to /dev/ttyS0, COM2 to /dev/ttyS1, and so on. LPT1 defaults to /dev/lp0.. you get the idea.

If you want to change it, you can create a link in .wine/dosdevices from, say, com1 to the device you want it to use. So if for example you wanted com1 to be /dev/cua0, you should have this in dosdevices:

com1 -> /dev/cua0


A user reported that creating a link for wine to the com port did not work. He tried

ln -s /dev/ttyS0 com1

J. McKenzie sept 08 wineuser suggested: try another comX port like com3. com1 may already exist and [thus] cannot be destroyed/created in this manner.


A user reported [sept 06]: I have an application that works fine with vmware but under Wine. The COM port isn't even seen [under wine].

roboknight: This is probably similar to GSAK. You need to add the com ports into the registry in order to get them seen by your app...

[Hardware\\Devicemap\\Serialcomm] 1015709345 "Serial0"="COM1"
"Serial1"="COM2"
"Serial2"="COM3"
"Serial3"="COM4"

You don't have to add all of those, but at least your app should see the com ports after that. I'm unsure why, but this doesn't appear in the docs anywhere. I only found it on a blog. You still need to make the symlinks to make it actually work, but some apps use this key (whether they should or not, I don't know) to figure out what serial ports are available.

jun 08: when i try to run a windows program who need a serial port to run, i have this output error:

fixme:comm:set_queue_size eolino> insize 5000000 outsize 5000000 unimplemented stub

anyone have a solution to solve this problem?

U. Bonnes: Well, it's a Fixme (I introduced). To solve it, queue handling for the serial port has to be implemented in the way Windows does. However Linux itself does quite a good job at handling the serial port, I think this will result in user program failure only in very rare cases. In short: This is probably not the source of your possible problems with your program.


In Oct 07 there was a bit of progress and patches in this area. However on bug 9902 a developer noted: If you see an error "Access denied [5]" in the Status column, be sure to change permissions on the actual COM port (/dev/ttyS0 for me.) This is an area which gives users a fair bit of trouble, so if you have further suggestions - please add them here.

Identifying Ports

You can check what ports to use as explained by M. Gregorie [Sept 09] if you run:

ls /dev/ttyS*

[a] laptop, which has no serial ports, still shows /dev/ttyS[0-3] The problem becomes one of working out which, if any, of these devices work. [For this we] Try setserial [for each port]:

setserial -a /dev/ttyS0

where -a tells setserial to report everything it knows about the serial device. There are three possible outcomes:

setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4
Baud_base: 115200, close_delay: 50, divisor: 0 closing_wait: 3000
Flags: spd_normal skip_test

This means the device file exists and is mapped to a physical serial port, known as a UART. The following word is its type: usually it will be an 8250, 16550 or 16550A.

setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: unknown, Port: 0x03f8, IRQ: 4
Baud_base: 115200, close_delay: 50, divisor: 0 closing_wait: 3000
Flags: spd_normal skip_test auto_irq

This means that the device file exists but it is mapped to a broken or non-existent UART, described as 'unknown'.

setserial -a /dev/ttyS4
/dev/ttyS4: No such file or directory

The device file [/dev/ttyS4] doesn't exist.

Com Port Permissions

You can check permissions for your serial ports using

ls -l /dev/tty*

This will list the devices their permissions. Serial ports start with ttyS0, ttyS1 etc, USB serial ports often start with ttyUSB0. You will be most likely using either 0, or 1, depending upon whether you have more than one serial port, and if you have an internal modem which is using one of these. The command Setserial will have told you which ports are connected.

The problem with the permissions is that you (and wine) usually do not have permission to write to the serial port and often do not have permission to read. Running wine as root is a bad idea, and usually does not fix the problem with serial ports, and even better(depending upon yoru point of view), messes up your wine so do not run wine as root. Obviously you can give everyone access but you might need to do this every time you boot (as root):

chmod 777 /dev/ttyS0

Then exit out of root and run wine as a user. To do this upon boot, add this to your /etc/rc.d/rc.local file. This might get you going, but anyone can now access the serial port.

to identify the group and owner for the serial port is often root:uucp. You might consider adding yourself to this group instead and giving it write access to the serial port. Give it write access by doing this as root:

chmod 775 /dev/ttyS0
chmod 775 /dev/ttyUSB0

M. Gregorie: With current, udev-based, kernels its necessary to reset the permissions of /dev/ttyS[0-9] after every boot. [..]the /etc/rc.d/rc.local trick won't work reliably unless the kernel is guaranteed to create these devices before it runs the /etc/rc.d/rc.local script [..] I added a local rule file to /etc/udev/rules.d [called 51-local.rules]:

cat 51-local.rules
#
# Locally defined rules.
#
#
# Give world read/write access to ttyS* and ttyUSB* serial devices
#KERNEL=="tty[A-Z]*", GROUP="uucp", MODE="0666"

This works under Fedora 6 through Fedora 10. Under earlier releases it was sufficient to add a line containing:chmod uga+rw /dev/ttyS* to /etc/rc.d/rc.local so it got run at boot time, but IIRC this doesn't work with UDEV since all the /dev/ttyS* devices are no longer created at boot time.

On Fedora 10 and WINE 1.1.23 this works with all real serial ports (I have two on the mobo and another 4 on an IPC card) without needing to add COMn: symlinks to the dosdevices directory.


Further Reading

USB

While Wine does not run Windows USB drivers, you often do not need them. If it is a serial port, (listed as usb-tty), then you have a reasonable chance of it working. If a usb driver for linux exists - wine can see it and often use it. There are some patches in the wine-wiki which can work with a few non serial emulator USB systems.

You might check whether it is used as a serial port using the command line [a terminal window]: [Jul 09 wineusr]: First, unplug the device, then plug it back in. Now, open up a terminal and run "dmesg". Look at the last 10 lines or so, it may tell you which object in /dev it is getting loaded as, something like /dev/ttyS0.

The user wrote what showed up:

[347146.152016] usb 5-1: new full speed USB device using uhci_hcd and address 29 [347146.350258] usb 5-1: configuration #1 chosen from 1 choice
[347146.352262] ftdi_sio 5-1:1.0: FTDI USB Serial Device converter detected [347146.352291] usb 5-1: Detected FT232RL
[347146.352335] usb 5-1: FTDI USB Serial Device converter now attached to ttyUSB0
                                                                          ^^^^^^^^

The next step: In the terminal, do "ls /dev/tty*" and look at what shows up. Now, unplug the device and run the command again, has anything disappeared? If you plug the device back in, and run the command again, has it reappeared? If it has, then thats the device you're going to need to get going with wine.


USB Joystick

[sept 08 wineusr: how I get usb support [..] I would like to use my usb joystick.

Vitamin: Just plug it in. Most joysticks are recognized and works fine with Linux. Wine will detect and use all the system joysticks with pretty good success. The only thing that is still questionable is force-feedback support.

USB Serial Ports

L. Rahyen July 07 wine user: Because your "USB" device don't require high bandwidth it is possible that your USB device is usb-tty converter. If so then I will explain how to use it with WINE and what should be done to make it work. If not then you cannot use it with WINE.

See configuration settings in the software, do you need to choose COM port there? In Windows usb-tty converters are represented as COM-ports. So if your program have such setting then there is good chanced it will work with WINE.
But if your program don't using usb-tty converter and work with "true" USB device directly - this will not work under WINE yet; in this case you need something like QEmu (free) or VMWare (not-free) to use your software under Linux.

L. Rahyen [July 07 wine user]: As an example, I have Samsung phone not supported under Linux and USB-data cable. But its USB cabel is actually a usb-tty converter so Windows software for my phone works perfectly with WINE on Linux.

You need to create a symbolic link from COM device to TTY like this [to..] create the symbolic link from COM2 to ttyUSB0:

l n -s /dev/ttyUSB0 ~/.wine/dosdevices/com2

Advanced Wine Troubleshooting

DIB Engine

Max has worked on a DIB engine that is able to test the benefits of a DIB engine with wine. R. Colenbrander: Interpreting Alexandre his words Huw his design was the right way to continue (according to Jeremy he had worked on this for 4-5 months) but even for Huw it would take a similar amount of time to finish it. They didn't know well if continuing with the work was worth it for the apps they had to get working and during a discussion at Wineconf they also weren't certain for which apps it would help and more important by how much (e.g. time is also fixing a lot issues as we are getting faster CPUs all the time). With your patches (even if they aren't clean and won't 100% correctly) we see how much a DIB engine (even unoptimized) can already help. Basically a lot of users should test it using different programs. We need benchmark results e.g. photoshop benchmarks and others.

If the DIB engine appears to do wonders for lots of apps (e.g. photoshop, office ...) then some company might sponsor Codeweavers to work on this.

If you were wondering... No Codeweavers do not have a DIB engine. However they do need to aim their efforts to what their customers want and at this point in time there are other demands upon Huw's which will benefit wine as well. Max's efforts can help things along and even if you cannot help writing the engine, you may be able to submit more tests for winetest, which will only help wine get it working sooner.

OpenGL

A user reported an error running his program.

err:module:import_dll Library OPENGL32.dll (which is needed by L"C:\\Program Files\\Google\\Google Earth\\render.dll") not found

S. Paschukat: Are you using a self built version of Wine? Then make sure that above file is built. Check the output of the configure command for missing headers. Also have a look in Wines OpenGL documentation: http://www.winehq.org/site/docs/winedev-guide/opengl

A user anon posted [Jan 05]: If you use a packaged version of wine, you may want to add the wine-gl lib. Eg: for debian "apt-get install libwine-gl". And launch you application with -opengl arg. It should correct your problem.

DirectX

oiahom: what a card supports by direct X labeling is not important to wine. Opengl support decides wine direct x feature support. Ie Wine Direct X is not MS direct X. Wine Direct X is a wrapper to opengl. Dx9 will work on a dx 8 label card under wine just not perfectly accelerated.

Vitamin noted that you can disable it if needed [oct 09 wineuser] If you want to "disable" support for dx9 then disable d3d9.dll. Code:

WINEDLLOVERRIDES=d3d9= wine program.exe


One user write nov 10: I copied d3d8.dll and d3d8thk.dll from an XP install and overrode it in winecfg.

Vitamin: Don't do that, those will never work on Wine. They talk directly to the windows drivers.

X Server locked

A. Mohr [2005]: That problem CERTAINLY isn't with Wine. Wine Archives

If a program under Wine can kill a system, then either there's a kernel (driver) bug or we have an OOM condition gone to hell or the X server is running amok (mostly font server issues). And maybe some more smaller issues. Since you name Nvidia drivers, it's most likely yet another case of slightly but fatally buggy graphics drivers (sound drivers, ...) hanging the system.


Another [May 2005] User reported that his system to stop responding to key presses and the mouse after installing a program.

U. Bonnes: A hard hang is an ugly error.

But you give few information:

K. Ober: Did you try ssh'ing into the system and executing 'killall X' as root? The mere fact that X doesn't react to keystrokes doesn't necessarily mean that the system is hanging.

A. Mohr commented on how it could be causing trouble: Well, it's fairly likely if you have a program allocating the whole world and even a bit more than that (e.g. by stack trashing which causes a pointer value to be used as the size to allocate: ugh) with a user that forgot to set a memory limit... (ulimit -v?). Then just have the Linux OOM mechanism fail to kill the misbehaving program properly, and that's it.

U. Bonnes: There are some ways that wine can make Linux unusable, like:

M. Hearn: If the system no longer responds to keystrokes then it *has* hung and we should treat fixing as it a a+ priority, regardless of what is going on under the hood. There's no difference for users between "X is hung" and "Linux is hung" ...

Wine and LTSP (linux terminal server project)

A User reported I installed sucessful both ltsp and wine, i'm running perfectly my application on server of LTSP...but when i try to run the same application on the terminal's of LTSP, i receive the following error:

X Error of failed request:  BadShmSeg (invalid shared segment parameter)
  Major opcode of failed request:  142 (MIT-SHM)
  Minor opcode of failed request:  2 (X_ShmDetach)
  Segment id in failed request:  0x1c00019
  Serial number of failed request:  2067
  Current serial number in output stream:  2099
 root@server:~# err:ntdll:RtlpWaitForCriticalSection section 0x401d97e0 "loader.c: loader_section" wait timed 
    out in thread 000a, blocked by 0009, retrying (60sec)
root@server:~# wine: Unhandled exception (thread 000a), starting debugger=
...

M. Hearn [May 05]: At the moment you have to use a separate UNIX user account for each display you want to run Wine on. You can't run multiple Windows programs on different displays as the same user. Is this the problem?

System.ini Files

[Dec 05] D. Riekenburg: With NT, Windows did a Switch from INI-Files to the Registry and uses "IniFileMapping" for compatibility with win9x-Apps. (see http://bugs.winehq.org/show_bug.cgi?id=4096). Wine is using both Methods when settings are changed (more code), and this introduce bugs if a Setting-Target is missing: (Example: http://bugs.winehq.org/show_bug.cgi?id=4097)

Should we follow the Path of NT and implement the things around IniFileMapping to be compatible with every App that uses the API for INI-Files? We already do caching for INI-Files, so there is no additional incompatibility for very ugly Applications that modify INI-Files manual (open, read/write, close). [The discussion appeared to end there] wine archive


.acm

"err:module:load_builtin_dll failed to load .so lib for builtin L"msgsm32.acm": /usr/lib/wine/msgsm32.acm.so: invalid ELF header"
  

Alex Villacs Lasso [Dec 05]: For native ACM files, you may need to specify the full qualified path to the ACM file. That is: MSACM.msgsm610=msgsm32.acm should be replaced by:

MSACM.msgsm610=C:\windows\system32\msgsm32.acm

Of course, you should replace 'C:\windows\system32' with whatever the actual path is in your fake Windows directory structure. wine archive

Translation

Printing

Sound

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox