There are better ways of getting rid of FILE_Dup2 than moving a bunch of kernel APIs into winedos. The obvious one is to allocate new handles until we get the one we want and then free the others; not exactly efficient, but I don't think many apps calls FILE_Dup2 in a loop.
this won't work if the file number you want to dup is one of the default files (stdin, stdout, stderr...), as Win32HandleToDosFileHandle won't let you set it. Unless Win32HandleToDosFileHandle is wrong about this test. A+