Commit 58e719ce authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

ntdll: Implemented IOCTL for serial: SET_WAIT_MASK, GET_WAIT_MASK.

parent b83c5ead
......@@ -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);
}
/*****************************************************************************
......
......@@ -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 flags)
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 hDevice,
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 hDevice,
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment