ReadFile and WriteFile in overlapped mode

Mike McCormack mike_mccormack at start.com.au
Thu Apr 4 15:45:45 CST 2002


Hi,

> I have been looking at those two functions and some specs. 
> My understanding is that those function do not work at all 

I haven't tested the current CVS lately, but i can assure you that
ReadFile and WriteFile did work at some fairly recent time :-) You may
be correct that they do not work in *exactly* the right way, but for
most cases they do work.

> ever be generated since step be is not performed. Application 
> doing the following sequence
 
> 	ReadFile
>	..
> 	WaitOnSingleObject
> 
> will wait forever. Some borland Builder classes do this

No, it won't because asynchronous reads can be processed during
on-alertable waits.

The application must call WaitForSingleObject eventually to see f the
overlapped operation has finished.

> My understanding is that step a should never be done and only 
> step b. Is that correct ?

We need to check if data is pending before returning RROR_IO_PENDING
because some applications do this:

    WaitCommEvent(hComm,&ev,&ov);
    WaitForSingleObject(ov.hEvent);
    ClearCommError(hComm,NULL,&cs)
    len = cs.cbInQue;
    if(!ReadFile(hComm,buf,len,&count,&ov))
       FATAL()

You're right that the way wine currently handles this is not erfect,
but it will only fail if multiple overlapped operations re done at the
same time. Martin Wilck is currently fixing this.

> Now, why step b is failing is another story.
>
> Comments ?

It's not perfect, and you're welcome to fix it if you want.

Mike





------------------------------------------
mailto:Mike_McCormack at start.com.au
ph +82 16 430 0425

__________________________________________________________________
Get your free Australian email account at http://www.Looksmart.com.au




More information about the wine-devel mailing list