Eric Pouech : ntdll: Implemented serial IOCTL for status:
GET_COMM_STATUS.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Feb 28 14:40:52 CST 2006
Module: wine
Branch: refs/heads/master
Commit: a6d339c6560c2d371dc856c8ab2c1b25d216abe9
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=a6d339c6560c2d371dc856c8ab2c1b25d216abe9
Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date: Mon Feb 27 22:22:06 2006 +0100
ntdll: Implemented serial IOCTL for status: GET_COMM_STATUS.
---
dlls/ntdll/serial.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c
index 04f9534..879f6f1 100644
--- a/dlls/ntdll/serial.c
+++ b/dlls/ntdll/serial.c
@@ -168,6 +168,36 @@ static NTSTATUS get_modem_status(int fd,
return status;
}
+static NTSTATUS get_status(int fd, SERIAL_STATUS* ss)
+{
+ NTSTATUS status = STATUS_SUCCESS;
+
+ ss->Errors = 0;
+ ss->HoldReasons = 0;
+ ss->EofReceived = FALSE;
+ ss->WaitForImmediate = FALSE;
+#ifdef TIOCOUTQ
+ if (ioctl(fd, TIOCOUTQ, &ss->AmountInOutQueue) == -1)
+ {
+ WARN("ioctl returned error\n");
+ status = FILE_GetNtStatus();
+ }
+#else
+ ss->AmountInOutQueue = 0; /* FIXME: find a different way to find out */
+#endif
+
+#ifdef TIOCINQ
+ if (ioctl(fd, TIOCINQ, &ss->AmountInInQueue))
+ {
+ WARN("ioctl returned error\n");
+ status = FILE_GetNtStatus();
+ }
+#else
+ ss->AmountInInQueue = 0; /* FIXME: find a different way to find out */
+#endif
+ return status;
+}
+
static NTSTATUS get_wait_mask(HANDLE hDevice, DWORD* mask)
{
NTSTATUS status;
@@ -247,6 +277,14 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDe
switch (dwIoControlCode)
{
+ case IOCTL_SERIAL_GET_COMMSTATUS:
+ if (lpOutBuffer && nOutBufferSize == sizeof(SERIAL_STATUS))
+ {
+ if (!(status = get_status(fd, (SERIAL_STATUS*)lpOutBuffer)))
+ sz = sizeof(SERIAL_STATUS);
+ }
+ else status = STATUS_INVALID_PARAMETER;
+ break;
case IOCTL_SERIAL_GET_MODEMSTATUS:
if (lpOutBuffer && nOutBufferSize == sizeof(DWORD))
{
More information about the wine-cvs
mailing list