ntdll: Implemented IOCTL for serial: SET_WAIT_MASK, GET_WAIT_MASK.
This commit is contained in:
parent
b83c5ead16
commit
58e719ce93
|
@ -952,28 +952,20 @@ BOOL WINAPI SetupComm(
|
||||||
* Obtain the events associated with a communication device that will cause
|
* Obtain the events associated with a communication device that will cause
|
||||||
* a call WaitCommEvent to return.
|
* a call WaitCommEvent to return.
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
*
|
||||||
|
* handle [in] The communications device
|
||||||
|
* evtmask [out] The events which cause WaitCommEvent to return
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
*
|
*
|
||||||
* True on success, fail on bad device handle etc.
|
* True on success, fail on bad device handle etc.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI GetCommMask(
|
BOOL WINAPI GetCommMask(HANDLE handle, LPDWORD evtmask)
|
||||||
HANDLE handle, /* [in] The communications device. */
|
|
||||||
LPDWORD evtmask) /* [out] The events which cause WaitCommEvent to return. */
|
|
||||||
{
|
{
|
||||||
BOOL ret;
|
|
||||||
|
|
||||||
TRACE("handle %p, mask %p\n", handle, evtmask);
|
TRACE("handle %p, mask %p\n", handle, evtmask);
|
||||||
|
return DeviceIoControl(handle, IOCTL_SERIAL_GET_WAIT_MASK,
|
||||||
SERVER_START_REQ( get_serial_info )
|
NULL, 0, evtmask, sizeof(*evtmask), NULL, NULL);
|
||||||
{
|
|
||||||
req->handle = handle;
|
|
||||||
if ((ret = !wine_server_call_err( req )))
|
|
||||||
{
|
|
||||||
if (evtmask) *evtmask = reply->eventmask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SERVER_END_REQ;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -983,27 +975,20 @@ BOOL WINAPI GetCommMask(
|
||||||
* (Set which events associated with a communication device should cause
|
* (Set which events associated with a communication device should cause
|
||||||
* a call WaitCommEvent to return.)
|
* a call WaitCommEvent to return.)
|
||||||
*
|
*
|
||||||
|
* PARAMS
|
||||||
|
*
|
||||||
|
* handle [in] The communications device
|
||||||
|
* evtmask [in] The events that are to be monitored
|
||||||
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
*
|
*
|
||||||
* True on success, false on bad handle etc.
|
* True on success, false on bad handle etc.
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetCommMask(
|
BOOL WINAPI SetCommMask(HANDLE handle, DWORD evtmask)
|
||||||
HANDLE handle, /* [in] The communications device. */
|
|
||||||
DWORD evtmask) /* [in] The events that are to be monitored. */
|
|
||||||
{
|
{
|
||||||
BOOL ret;
|
|
||||||
|
|
||||||
TRACE("handle %p, mask %lx\n", handle, evtmask);
|
TRACE("handle %p, mask %lx\n", handle, evtmask);
|
||||||
|
return DeviceIoControl(handle, IOCTL_SERIAL_SET_WAIT_MASK,
|
||||||
SERVER_START_REQ( set_serial_info )
|
&evtmask, sizeof(evtmask), NULL, 0, NULL, NULL);
|
||||||
{
|
|
||||||
req->handle = handle;
|
|
||||||
req->flags = SERIALINFO_SET_MASK;
|
|
||||||
req->eventmask = evtmask;
|
|
||||||
ret = !wine_server_call_err( req );
|
|
||||||
}
|
|
||||||
SERVER_END_REQ;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
|
@ -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)
|
static NTSTATUS purge(int fd, DWORD flags)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -143,6 +157,21 @@ static NTSTATUS purge(int fd, DWORD flags)
|
||||||
return STATUS_SUCCESS;
|
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
|
* COMM_DeviceIoControl
|
||||||
*
|
*
|
||||||
|
@ -170,6 +199,15 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDevice,
|
||||||
|
|
||||||
switch (dwIoControlCode)
|
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:
|
case IOCTL_SERIAL_PURGE:
|
||||||
if (lpInBuffer && nInBufferSize == sizeof(DWORD))
|
if (lpInBuffer && nInBufferSize == sizeof(DWORD))
|
||||||
status = purge(fd, *(DWORD*)lpInBuffer);
|
status = purge(fd, *(DWORD*)lpInBuffer);
|
||||||
|
@ -200,6 +238,13 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDevice,
|
||||||
status = STATUS_NOT_SUPPORTED;
|
status = STATUS_NOT_SUPPORTED;
|
||||||
#endif
|
#endif
|
||||||
break;
|
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:
|
default:
|
||||||
FIXME("Unsupported IOCTL %lx (type=%lx access=%lx func=%lx meth=%lx)\n",
|
FIXME("Unsupported IOCTL %lx (type=%lx access=%lx func=%lx meth=%lx)\n",
|
||||||
dwIoControlCode, dwIoControlCode >> 16, (dwIoControlCode >> 14) & 3,
|
dwIoControlCode, dwIoControlCode >> 16, (dwIoControlCode >> 14) & 3,
|
||||||
|
|
Loading…
Reference in New Issue