On Wed, Sep 2, 2009 at 7:31 PM, Fenixk19<[email protected]> wrote:
> Hello! I've already post the
> bug(http://bugs.winehq.org/show_bug.cgi?id=19713) on this subject, but i
> need more help. So I've decided to write here.
> There is a problem in wine. When I use asynchronous serial port read,
> data never comes. Event, caused by select comes. But operation status
> stays pending, and i can't do anything to this serial port anymore. In
> windows it never get pending, and port can be accessed just after data
> arrival. Seems to be wineserver problem, but i don't know, where to look
> at. What code respond for asynchronous serial port in wineserver?
> Alexander.
> P.S. Test program attached.
>
>
>
>
Hi,
Alexandre would be the guy to talk to about wineserver-related things.
Sadly he's off on a long weekend. Does the attached patch help solve
the problem?
Mike.
diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index dfb00e1..2a448ed 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -851,6 +851,7 @@ typedef struct async_commio
{
HANDLE hDevice;
DWORD* events;
+ IO_STATUS_BLOCK* iosb;
HANDLE hEvent;
DWORD evtmask;
DWORD mstat;
@@ -985,12 +986,14 @@ static DWORD CALLBACK wait_for_event(LPVOID arg)
}
if (needs_close) close( fd );
}
+ if (commio->iosb)
+ commio->iosb->u.Status = *commio->events ? STATUS_SUCCESS : STATUS_CANCELLED;
if (commio->hEvent) NtSetEvent(commio->hEvent, NULL);
RtlFreeHeap(GetProcessHeap(), 0, commio);
return 0;
}
-static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, DWORD* events)
+static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, PIO_STATUS_BLOCK piosb, DWORD* events)
{
async_commio* commio;
NTSTATUS status;
@@ -1003,6 +1006,7 @@ static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, DWORD* events)
commio->hDevice = hDevice;
commio->events = events;
+ commio->iosb = piosb;
commio->hEvent = hEvent;
get_wait_mask(commio->hDevice, &commio->evtmask);
@@ -1301,7 +1305,7 @@ static inline NTSTATUS io_control(HANDLE hDevice,
case IOCTL_SERIAL_WAIT_ON_MASK:
if (lpOutBuffer && nOutBufferSize == sizeof(DWORD))
{
- if (!(status = wait_on(hDevice, fd, hEvent, lpOutBuffer)))
+ if (!(status = wait_on(hDevice, fd, hEvent, piosb, lpOutBuffer)))
sz = sizeof(DWORD);
}
else