[PATCH?] Finally found a solution to serial port writes
Geoffrey Hausheer
winedevel9605 at phracturedblue.com
Sat Apr 17 16:52:07 CDT 2004
The following patch is probably wrong, but it fixes my problem with
WriteFile failing when writing to a COM port. The problem appears to be
that NtWaitForSingleObject sends a count of '1' which results in the
wine_server_call in NTDLL_wait_for_multiple_objects returning
'STATUS_USER_APC' which aborts the execution before 'call_apcs' gets
called (which actually does the write).
calling 'NTDLL_wait_for_multiple_objects' with count = 0 allows the
'call_apcs' function to get called, and TzMax50 actually works perfectly
(along with my nasty hack to allow the menus to work)
as a reminder, the COM port is opened in non-overlapped mode, and all
timeouts are set to 0.
(I didn't submit this to wine-patches, since i'm not at all sure it is
generally correct)
I can also try to write a test-case that shows this works (sort of...I
can test that WriteFile returns the right result, but not that data was
actually written on the serial port. I know of no way to do that without
external hardware). I don't know how to make it general enough though
(what to do when there is no COM port attached to the machine?)
.Geoff
--- orig/dlls/ntdll/file.c
+++ mod/dlls/ntdll/file.c
@@ -585,7 +585,7 @@
ret = register_new_async(&ovp->async);
if (ret != STATUS_SUCCESS)
return ret;
- if (flags & FD_FLAG_TIMEOUT)
+ if (hEvent != NULL && flags & FD_FLAG_TIMEOUT)
{
NtWaitForSingleObject(hEvent, TRUE, NULL);
NtClose(hEvent);
More information about the wine-devel
mailing list