https://bugs.winehq.org/show_bug.cgi?id=40540
--- Comment #5 from henry@littau.org --- I have attached two CPP files. Compile both with VS 2008 as console apps.
I have USB-RS232 adapter to null modem cable to 2nd USB-RS232 adapter plugged in and configured as COM31 and COM32.
Run 40540FakeDevice. It waits for any input, then sends some data back.
Run 40540Demo. You should see five successful transactions between the two programs using overlapped io. The hit key is there to give me time to attach a remote debugger.
Recompile 40540Demo with USE_WAITFOREVENT defined.
Run 40540Demo. It fails first time through the loop, reports, then fails elsewhere second time through the loop, reports, exits.
Bug 40540 is the first failure. I have not investigated the second, likely a clean up issue from the first.
I tried to reproduce the issue with one app, that's why the USE_COM1 define is in there. For some reason having the second com port in use in the single app does not reproduce the issue. I didn't bother with threads to investigate that further -- too easy to use another app :-)