Use tcdrain() instead of tcflush() to implement FlushFileBuffers() for a COM port.

Wolfgang Walter wine at stwm.de
Mon Aug 26 11:02:36 CDT 2013


Am Montag, 26. August 2013, 17:13:46 schrieb Alexandre Julliard:
> Wolfgang Walter <wine at stwm.de> writes:
> > @@ -2749,19 +2752,46 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile,
> > IO_STATUS_BLOCK* IoStatusBlock> 
> >  {
> >  
> >      NTSTATUS ret;
> >      HANDLE hEvent = NULL;
> > 
> > -
> > -    SERVER_START_REQ( flush_file )
> > -    {
> > -        req->handle = wine_server_obj_handle( hFile );
> > -        ret = wine_server_call( req );
> > -        hEvent = wine_server_ptr_handle( reply->event );
> > +    enum server_fd_type type;
> > +    unsigned int options;
> > +    int needs_close;
> > +    int unix_handle;
> > +
> > +    ret = server_get_unix_fd( hFile, FILE_WRITE_DATA, &unix_handle,
> > +                              &needs_close, &type, &options );
> > +    if (ret) return ret;
> 
> You probably don't want to fail just because there's no unix fd.

What is the correct behaviour if there ist no such handle? Should I only fail 
in the case FD_FILE_SERIAL ?

In this case
	server_get_unix_fd()
and
	if (needs_close) close( unix_handle );

could be moved there, too.


> 
> > +    if (ret == STATUS_SUCCESS && IoStatusBlock) {
> > +        IoStatusBlock->u.Status = ret;
> > 
> >      }
> 
> This is an unrelated change and should be a separate patch, with tests
> (also for failures cases),

Ok. I have to see how to write tests.

Regards,
-- 
Wolfgang Walter
Studentenwerk München
Anstalt des öffentlichen Rechts
Abteilungsleiter IT
Leopoldstraße 15
80802 München



More information about the wine-devel mailing list