First steps to make Win32 app running under Wine

Marcus Meissner meissner at
Thu Mar 20 04:52:28 CDT 2008

On Thu, Mar 20, 2008 at 10:26:20AM +0100, Martin Hinner wrote:
> Hi,
>    I am solving problem how to get one Win32 app (for which I have
> source code) running under Wine. The biggest issue is drivers and
> ioctls. Linux has driver support for what we need and provides similar
> ioctls for some stuff, but it differs from Windows.
>   The difference is *so big* that I would prefer to modify our source
> code to use different pieces of code when it detects Wine. I
> understand, that this is *against* Wine policy and generally should
> not be used. But writing built-in replacement for some DLLs (hack
> Linux-style drivers into Windows-style) would be a nightmare, so
> having small mods to Win code would be much easier. I am not talking
> about "generic" functions, but about specific drivers/etc.
> Imagine this: Under windows you get usb driver with some ioctl-based
> interface, sometimes with DLL or without it (vendor provides only .lib
> file that gets statically linked). Under Linux there is libusb used.
> Difference between these two ways of driver implementation is *huge*
> and making libusb driver compatible with Win32 driver is almost
> impossible (in Win you have a real file handle, under libusb only
> pointer, etc.).
> It would greatly help for this case to be able to:
> - detect wine and platform from Win32 app (.exe)

Best bet is to just check for the registry key HKLM\Software\Wine

> - load native Linux library and perform ioctls (ioctl(2), not Windows
> IOCTL!) on file handles

Needs code in your application, but is technically possible. 

> - get somehow access to files in Linux filesystem (i.e. in /dev)

Same as above. No need for any specific code if you map Z: to / for instance.

> This would allow to easily modify our source code in a few places
> (i.e. hardware routines) and get it quickly running under Linux.
> I can do all above by writing some built-in dll that would work just
> for my case, but I think *maybe* it's worth it to provide some generic
> interface in Wine??

Hmm. We might be able to do this via msvcrt ioctl perhaps? No idea.

Ciao, Marcus

More information about the wine-devel mailing list