Unix FD to Windows File Handles mapping.

Bruno Albuquerque bga at gmail.com
Fri Dec 20 17:56:39 CST 2019


Is the way that wine maps file handles from Unix (Linux, more specifically)
to Windows predictable?

I have this Linux program that forks Wine to run a Windows program. The
Windows program can easily access stdin/stdout/stderr the way one would
expect in a forked Unix program but I am trying to pass one extra file
descriptor to the windows program but I am not sure how to do that.

In the Unix program, the FD will be, say, 3. As I am forking then exec'ing
Wine, wine itself will have access to this FD and, from Wine's point of
view, it should also be 3. The problem is that it seems file handles in
Windows are not like in Unix (for example, stdin is not 0, stdout is not 1
and stderr is not 2) so I am assuming that to make this FD available to the
WIndows program, it is somehow mapped to a file handle with a
different number too. I need to know which one it si to be able to use it.
Any pointers on how to do that?

If I compile a C program with winegcc/winelib and fork/exec it, it looks
like file handles and file descriptors match so one option is to use it.
But I prefer to create the program in a different language so winelib is
not ideal.

Any help would be much appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20191220/9ecdca18/attachment.htm>


More information about the wine-devel mailing list