Hi,<br> wine's implementation of _get_osfhandle is found to cause sharing violation in some apps. The author commented this piece of code with a block of FIXME<br> warning about possible leakage. It turns out it's no just a matter of leakage.<br> <br> A simple test program<br> ------------------------------------------------------------<br> #include "windows.h"<br> #include "io.h"<br> #include "fcntl.h"<br> #include "share.h"<br> int main()<br> {<br> &nbsp;&nbsp;&nbsp; int fd, bWritten;<br> &nbsp;&nbsp;&nbsp; fd = _sopen("foo", _O_CREAT|_O_RDWR,_SH_DENYRW, 0);<br> &nbsp;&nbsp;&nbsp; WriteFile((HANDLE)_get_osfhandle(fd), "bar", 3, &amp;bWritten, NULL);<br> &nbsp;&nbsp;&nbsp; _close(fd);<br> &nbsp;&nbsp;&nbsp; fd = _open("foo", _O_RDONLY, 0);<br> &nbsp;&nbsp;&nbsp; _write(1, fd==-1? "F\n" : "S\n", 2);<br> }<br> ------------------------------------------------------------<br> The second _open fails with builtin msvcrt, not with native one.<br> <br> The comment&nbsp; says that
 the duplication is to make an inheritable hande.<br> With the recent change in msvcrt's io init procedure, that shouldn't be a problem<br> anymore.<br> <p>
                <hr size=1>Blab-away for as little as 1�/min. Make <a href="http://us.rd.yahoo.com/mail_us/taglines/postman2/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com"> PC-to-Phone Calls</a> using Yahoo! Messenger with Voice.