Module: wine Branch: refs/heads/master Commit: 58e719ce93f9dd621af22003f3981da0f3e6a68c URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=58e719ce93f9dd621af22003...
Author: Eric Pouech eric.pouech@wanadoo.fr Date: Mon Feb 6 11:37:06 2006 +0100
ntdll: Implemented IOCTL for serial: SET_WAIT_MASK, GET_WAIT_MASK.
---
dlls/kernel/comm.c | 47 ++++++++++++++++------------------------------- dlls/ntdll/serial.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 31 deletions(-)
diff --git a/dlls/kernel/comm.c b/dlls/kernel/comm.c index 41ae790..3a63c02 100644 --- a/dlls/kernel/comm.c +++ b/dlls/kernel/comm.c @@ -952,28 +952,20 @@ BOOL WINAPI SetupComm( * Obtain the events associated with a communication device that will cause * a call WaitCommEvent to return. * + * PARAMS + * + * handle [in] The communications device + * evtmask [out] The events which cause WaitCommEvent to return + * * RETURNS * * True on success, fail on bad device handle etc. */ -BOOL WINAPI GetCommMask( - HANDLE handle, /* [in] The communications device. */ - LPDWORD evtmask) /* [out] The events which cause WaitCommEvent to return. */ +BOOL WINAPI GetCommMask(HANDLE handle, LPDWORD evtmask) { - BOOL ret; - TRACE("handle %p, mask %p\n", handle, evtmask); - - SERVER_START_REQ( get_serial_info ) - { - req->handle = handle; - if ((ret = !wine_server_call_err( req ))) - { - if (evtmask) *evtmask = reply->eventmask; - } - } - SERVER_END_REQ; - return ret; + return DeviceIoControl(handle, IOCTL_SERIAL_GET_WAIT_MASK, + NULL, 0, evtmask, sizeof(*evtmask), NULL, NULL); }
/***************************************************************************** @@ -983,27 +975,20 @@ BOOL WINAPI GetCommMask( * (Set which events associated with a communication device should cause * a call WaitCommEvent to return.) * + * PARAMS + * + * handle [in] The communications device + * evtmask [in] The events that are to be monitored + * * RETURNS * * True on success, false on bad handle etc. */ -BOOL WINAPI SetCommMask( - HANDLE handle, /* [in] The communications device. */ - DWORD evtmask) /* [in] The events that are to be monitored. */ +BOOL WINAPI SetCommMask(HANDLE handle, DWORD evtmask) { - BOOL ret; - TRACE("handle %p, mask %lx\n", handle, evtmask); - - SERVER_START_REQ( set_serial_info ) - { - req->handle = handle; - req->flags = SERIALINFO_SET_MASK; - req->eventmask = evtmask; - ret = !wine_server_call_err( req ); - } - SERVER_END_REQ; - return ret; + return DeviceIoControl(handle, IOCTL_SERIAL_SET_WAIT_MASK, + &evtmask, sizeof(evtmask), NULL, 0, NULL, NULL); }
/***************************************************************************** diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c index ecf025c..b364376 100644 --- a/dlls/ntdll/serial.c +++ b/dlls/ntdll/serial.c @@ -129,6 +129,20 @@ static const char* iocode2str(DWORD ioc) } }
+static NTSTATUS get_wait_mask(HANDLE hDevice, DWORD* mask) +{ + NTSTATUS status; + + SERVER_START_REQ( get_serial_info ) + { + req->handle = hDevice; + if (!(status = wine_server_call( req ))) + *mask = reply->eventmask; + } + SERVER_END_REQ; + return status; +} + static NTSTATUS purge(int fd, DWORD flags) { /* @@ -143,6 +157,21 @@ static NTSTATUS purge(int fd, DWORD flag return STATUS_SUCCESS; }
+static NTSTATUS set_wait_mask(HANDLE hDevice, DWORD mask) +{ + NTSTATUS status; + + SERVER_START_REQ( set_serial_info ) + { + req->handle = hDevice; + req->flags = SERIALINFO_SET_MASK; + req->eventmask = mask; + status = wine_server_call( req ); + } + SERVER_END_REQ; + return status; +} + /****************************************************************** * COMM_DeviceIoControl * @@ -170,6 +199,15 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDe
switch (dwIoControlCode) { + case IOCTL_SERIAL_GET_WAIT_MASK: + if (lpOutBuffer && nOutBufferSize == sizeof(DWORD)) + { + if (!(status = get_wait_mask(hDevice, (DWORD*)lpOutBuffer))) + sz = sizeof(DWORD); + } + else + status = STATUS_INVALID_PARAMETER; + break; case IOCTL_SERIAL_PURGE: if (lpInBuffer && nInBufferSize == sizeof(DWORD)) status = purge(fd, *(DWORD*)lpInBuffer); @@ -200,6 +238,13 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDe status = STATUS_NOT_SUPPORTED; #endif break; + case IOCTL_SERIAL_SET_WAIT_MASK: + if (lpInBuffer && nInBufferSize == sizeof(DWORD)) + { + status = set_wait_mask(hDevice, *(DWORD*)lpInBuffer); + } + else status = STATUS_INVALID_PARAMETER; + break; default: FIXME("Unsupported IOCTL %lx (type=%lx access=%lx func=%lx meth=%lx)\n", dwIoControlCode, dwIoControlCode >> 16, (dwIoControlCode >> 14) & 3,