From daf347ac8b8be098421d7d65076b877daa9fb350 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Thu, 8 Nov 2001 17:06:08 +0000 Subject: [PATCH] Find out how much data is available when calling ReadFileEx. --- dlls/user/comm16.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/user/comm16.c b/dlls/user/comm16.c index 8964c9b09a2..03edd947254 100644 --- a/dlls/user/comm16.c +++ b/dlls/user/comm16.c @@ -362,13 +362,25 @@ static VOID WINAPI COMM16_WriteComplete(DWORD status, DWORD len, LPOVERLAPPED ov static void comm_waitread(struct DosDeviceStruct *ptr) { int bleft; + COMSTAT stat; + /* FIXME: get timeouts working properly so we can read bleft bytes */ bleft = ((ptr->ibuf_tail > ptr->ibuf_head) ? (ptr->ibuf_tail-1) : ptr->ibuf_size) - ptr->ibuf_head; - /* FIXME: get timeouts working properly so we can read bleft bytes */ + + /* find out how many bytes are left in the buffer */ + if(ClearCommError(ptr->handle,NULL,&stat)) + bleft = (blefthandle, ptr->inbuf + ptr->ibuf_head, - 1, + bleft, &ptr->read_ov, COMM16_ReadComplete); }