CreateFile("conin$") issue

Oleg Prokhorov xolegpro at
Mon Jun 2 13:59:16 CDT 2003

Hello ,

I've been examining compatibility of OpenWatcom C/C++ compiler with
Wine. And it works just fine except one thing.
So I request for your help to eliminate it, it looks easy but covers
wine client/server stuff, which is not so trivial.

Watcom's getch() uses CreateFile("conin$") to get console input handle
and fails with Wine :(

Here's the short code.
----------------------- CUT
#include <stdio.h>
#include <windows.h>
int main(void) {
        HANDLE h;
        h = CreateFile( "conin$",
                                 GENERIC_READ, FILE_SHARE_READ, NULL,
                                 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
        printf("%X", h); fflush(NULL);
        return 0;
with Windows it works just fine, but fails with Wine - CreateFile
returns invalid handle == 0xFFFFFFFF. And another thing is that the
bug is not reproducible under any debugger (e.g. winedbg), the code
runs just fine and createfile returns true handler.

Best regards,
 Oleg                          mailto:xolegpro at

More information about the wine-devel mailing list