How does wine install softwares? [duplicate]

I know that we can run windows (.exe) programs with the help of Wine.

I want to know how Wine works and runs .exe programs on Ubuntu. As they're two different operating systems - Windows (closed source) and Ubuntu (Linux open-source) - and they work differently: Ubuntu is based on package management (e.g. apt,dpkg).

Why is Wine important and what does it mean by "Wine Is Not an Emulator"?

As I know it creates ~/.wine/drive_c/windows etc. directories. Does it work similarly to Windows and USE the same files in windows/system32 as a real Windows platform?

I want to know the working and importance of it, because why it is projected (what is need/why it should allow to) to run Windows programs on Ubuntu? However it is not fully supporting all Windows software and graphics.

And what are parallel packages like 'Cross-Over' and 'Play on Linux'?


As says wikipedia: http://en.wikipedia.org/wiki/Wine_(software)

"Wine is a compatibility layer. It duplicates functions of Windows by providing alternative implementations of the DLLs that Windows programs call,[4] and a process to substitute for the Windows NT kernel."

So, WINE is set of in-house developed libraries, one side of which (visible to programs) is the Windows API, and the other side (visible to linux kernel and linux libraries, like glibc and libX11) is POSIX, Linux and X11 API. Also, there is special loader of windows programs which can read EXE file, load it and all needed DLL libraries to the memory, connect everything with internal Wine libraries and system libraries and run it. There can be several helper programs inside WINE too.

As there is two different operating system windows (closed source) and Ubuntu (Linux open-source)

Wine provides its own versions of various Window system DLLs. Wine also has the ability to load native Windows DLLs. Attempting to call into the Windows kernel directly is unsupported. If your Windows program makes calls that Linux can handle, then Wine passes them on to the Linux kernel. If the program wants to do something that Linux can't do, then Wine translates the call into something that Linux can deal with first.

Both OSs (Windows and Ubuntu) have different APIs (and ABIs (Application Binary Interface)). Windows has WinAPI, and Linux has POSIX API, with some additional Linux-specific APIs, graphics APIs (like X11) and with its own Linux ABI. Different APIs don't let you, for example, open the file, and read from it, if you are using wrong API. This difference is not about package management, but about interfacing between programs, libraries, and OS kernels.

Then Why wine is important and what means by "Wine Is Not an Emulator"?

An emulator should load program instructions, parse them, and imitate their actions. So, emulators of ARM are possible on x86 (Intel). For example, there is the great qemu (name decoded as "Quick EMUlator"), or an older x86 emulator written in C - bochs. Emulators usually emulate an entire PC, starting from the BIOS, processors and HDDs, and they boot into the OS you install on this virtual PC.

WINE is not an emulator because it doesn't interpret instructions of target binary or simulate processors. It just loads a program into memory and provides an API translation from WinAPI to the host's POSIX/Linux APIs (and Xlib for graphics and mouse, and some other API for sound, etc).

why it is projected (or what is need/why it should allow to) to run windows programmes on Ubuntu?

WINE was projected much before Ubuntu was created, the project was started in 1993 after Solaris's similar project "Wabi". It is useful to have the capability to start applications that are made to run on another OS, especially if this other OS is used widely, and has a lot of software (and games) created exclusively for it which can't be started directly from any other OS like Unix, Solaris or Linux.

However it is not fully supports several software of windows and graphics.

WINE can't have the exact implementation of all WinAPI (some parts of it are undocumented) and all needed libraries. Some Windows programs are using APIs or libraries which are not implemented, so they can't work with WINE.

And what is parallel packages like cross-over,play on linux?

Crossover is commercial variant of WINE with better support, some helper GUI tools (to easy install some software) and verified compatibility list of working windows programs and games. Usually you should pay some (40 US$) money to CodeWeavers, developers of CrossOver, in order to use the package for long time and have support. CodeWeavers (small company) supports wine project, by resending all patches to it, and by paying to several wine developers. According to wikipedia:

"CrossOver is developed by CodeWeavers, based on Wine, an open-source Windows compatibility layer. CodeWeavers modifies the Wine source code, applies compatibility patches, adds configuration tools that are more user-friendly, and provides technical support. CodeWeavers employs several Wine software developers, and contributes source code to Wine."