Eric Pouech : ntdll/kernel32: SetupComm & SET_QUEUE_SIZE

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 9 14:15:52 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: fcdc293bb08ab0d21f9fc48e58fde76e6b35b641
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=fcdc293bb08ab0d21f9fc48e58fde76e6b35b641

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Sun May  7 14:11:02 2006 +0200

ntdll/kernel32: SetupComm & SET_QUEUE_SIZE

- stubbed out ntdll's serial IOCTL SET_QUEUE_SIZE
- implemented kernel32.SetupComm on top of it

---

 dlls/kernel/comm.c  |   21 +++++++++++----------
 dlls/ntdll/serial.c |   12 ++++++++++++
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/dlls/kernel/comm.c b/dlls/kernel/comm.c
index f12043d..8f5c18d 100644
--- a/dlls/kernel/comm.c
+++ b/dlls/kernel/comm.c
@@ -883,6 +883,11 @@ BOOL WINAPI ClearCommError(HANDLE handle
  *  Called after CreateFile to hint to the communication resource to use
  *  specified sizes for input and output buffers rather than the default values.
  *
+ * PARAMS
+ *      handle  [in]    The just created communication resource handle
+ *      insize  [in]    The suggested size of the communication resources input buffer in bytes
+ *      outsize [in]    The suggested size of the communication resources output buffer in bytes
+ *
  * RETURNS
  *
  *  True if successful, false if the communications resource handle is bad.
@@ -891,18 +896,14 @@ BOOL WINAPI ClearCommError(HANDLE handle
  *
  *  Stub.
  */
-BOOL WINAPI SetupComm(
-    HANDLE handle,  /* [in] The just created communication resource handle. */
-    DWORD  insize,  /* [in] The suggested size of the communication resources input buffer in bytes. */
-    DWORD  outsize) /* [in] The suggested size of the communication resources output buffer in bytes. */
+BOOL WINAPI SetupComm(HANDLE handle, DWORD insize, DWORD outsize)
 {
-    int fd;
+    SERIAL_QUEUE_SIZE   sqs;
 
-    FIXME("insize %ld outsize %ld unimplemented stub\n", insize, outsize);
-    fd=get_comm_fd( handle, FILE_READ_DATA );
-    if(0>fd) return FALSE;
-    release_comm_fd( handle, fd );
-    return TRUE;
+    sqs.InSize = insize;
+    sqs.OutSize = outsize;
+    return DeviceIoControl(handle, IOCTL_SERIAL_SET_QUEUE_SIZE,
+                           &sqs, sizeof(sqs), NULL, 0, NULL, NULL);
 }
 
 /*****************************************************************************
diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index 1b45a10..15d1941 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -729,6 +729,12 @@ #endif
     return STATUS_SUCCESS;
 }
 
+static NTSTATUS set_queue_size(int fd, const SERIAL_QUEUE_SIZE* sqs)
+{
+    FIXME("insize %ld outsize %ld unimplemented stub\n", sqs->InSize, sqs->OutSize);
+    return STATUS_SUCCESS;
+}
+
 static NTSTATUS set_special_chars(int fd, const SERIAL_CHARS* sc)
 {
     struct termios port;
@@ -985,6 +991,12 @@ #endif
         else
             status = STATUS_INVALID_PARAMETER;
         break;
+    case IOCTL_SERIAL_SET_QUEUE_SIZE:
+        if (lpInBuffer && nInBufferSize == sizeof(SERIAL_QUEUE_SIZE))
+            status = set_queue_size(fd, (const SERIAL_QUEUE_SIZE*)lpInBuffer);
+        else
+            status = STATUS_INVALID_PARAMETER;
+        break;
     case IOCTL_SERIAL_SET_TIMEOUTS:
         if (lpInBuffer && nInBufferSize == sizeof(SERIAL_TIMEOUTS))
             status = set_timeouts(hDevice, fd, (const SERIAL_TIMEOUTS*)lpInBuffer);




More information about the wine-cvs mailing list