PATCH: FlushFileBuffers / serial

Marcus Meissner meissner at suse.de
Fri Jul 12 16:22:13 CDT 2002


Hi,

There was a report for Agfa Photowise not working. This should fix it.

MSDN says on that topic:

	If hFile is a handle to a communications device, the function
	only flushes the transmit buffer.

Ciao, Marcus

License:LGPL
Changelog:
	Marcus Meissner <marcus at jet.franken.de>
	implemented FlushFileBuffers for serial devices.


Index: serial.c
===================================================================
RCS file: /home/wine/wine/server/serial.c,v
retrieving revision 1.22
diff -u -r1.22 serial.c
--- serial.c	30 May 2002 20:12:58 -0000	1.22
+++ serial.c	12 Jul 2002 21:10:04 -0000
@@ -55,6 +55,7 @@
 static void serial_queue_async(struct object *obj, void *ptr, unsigned int status, int type, int count);
 static void destroy_serial(struct object *obj);
 static void serial_poll_event( struct object *obj, int event );
+static int serial_flush( struct object *obj );
 
 struct serial
 {
@@ -92,7 +93,7 @@
     serial_get_poll_events,       /* get_poll_events */
     serial_poll_event,            /* poll_event */
     serial_get_fd,                /* get_fd */
-    no_flush,                     /* flush */
+    serial_flush,                 /* flush */
     serial_get_info,              /* get_file_info */
     serial_queue_async,           /* queue_async */
     destroy_serial                /* destroy */
@@ -314,6 +315,21 @@
     else set_error ( STATUS_INVALID_PARAMETER );
 
     set_select_events ( obj, serial_get_poll_events ( obj ));
+}
+
+static int serial_flush( struct object *obj )
+{
+    int ret;
+    struct serial *serial = (struct serial *)grab_object(obj);
+    assert( obj->ops == &serial_ops );
+
+    /* MSDN says: If hFile is a handle to a communications device,
+     * the function only flushes the transmit buffer. 
+     */
+    ret = (tcdrain( serial->obj.fd ) != -1);
+    if (!ret) file_set_error();
+    release_object( serial );
+    return ret;
 }
 
 /* create a serial */




More information about the wine-patches mailing list