[Bug 16957] New: CreateProcess handles are inherited even when bInheritHandles=FALSE

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Jan 16 09:25:58 CST 2009


http://bugs.winehq.org/show_bug.cgi?id=16957

           Summary: CreateProcess handles are inherited even when
                    bInheritHandles=FALSE
           Product: Wine
           Version: 1.1.2
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: kernel32
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: ben at salilab.org


Created an attachment (id=18729)
 --> (http://bugs.winehq.org/attachment.cgi?id=18729)
test.c

The attached file uses CreateProcess to create a subprocess (gzip in this case)
with redirected standard output. In order for this to work properly, the output
handle created in this code must be inherited by the subprocess - thus the
bInheritHandles argument to CreateProcess must be TRUE. And indeed if this
program is compiled to test-true.exe, a simple text file 'test.in' and the gzip
binary are placed in the same directory, and then test-true.exe is run, it
successfully produces the output test.gz.

If the TRUE argument is switched to FALSE and the file is compiled again to
test-false.exe, when the program is run in the same way on a 'real' Windows
sytem (32 bit Vista Business in this case) the following is output:

gzip: stdout: Bad file descriptor

This is also fine and expected, since the output file handle was not passed to
gzip. *However* if the same test-false.exe program is run with Wine (the Fedora
10 wine-core-1.1.12-1.fc10.i386 package in this case) it runs in just the same
way as test-true.exe, generating the test.gz output.

This suggests to me that the bInheritHandles argument is ignored by Wine. As
stated, this is a minor bug but it would be nice if Wine behaved the same way
as Windows here. (In our case we discovered this problem after we tested our
program successfully under Wine, but then had it fail on a real Windows
system.) I am not familiar with the code, but hopefully it should be
straightforward enough to provide the subprocess with invalid handles if
bInheritHandles=FALSE?


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list