Unfortunately, this is a FAQ, so I've added it. I based the answer on the last time this came around on wine-users; I'm not a developer, so please sanity-check what I wrote! Hopefully this will be useful in dealing with the actual problems people think they can solve by doing this.
http://wiki.winehq.org/FAQ#head-9c045f5ff1df8a1afef91e1152ca7f6a9684f116
8.6. I write a Windows app. How can it detect if it's running under Wine?
This is a bad idea. The goal of Wine is that an application will be unable to tell it's running under Wine rather than Windows. So any method to detect running under Wine is unsupported and may break without warning in the future. Wine should not be treated as a "version" of Windows - functionality or performance-tuning is likely to be different between any two development versions.
Rather than detecting Wine:
* Detect if functionality exists and use it when available. * File a bug if something works in Windows that does not work in Wine. * Ask for help on the developers' list.
That said: if you really want to detect Wine, try, e.g., running a native binary or syscall (AppArmor or SELinux may block this), reading the environment, accessing a function (e.g ntdll.get_wine_version() ) or registry key only found in Wine. Any of these may break at any time.
Asking the user directly if they are running the app under Wine will be more reliable than trying to automatically detect it.
- d.