ntdll: Make sure that serial ioctl calls fail on non-serial handles.
This commit is contained in:
parent
c1cb976b66
commit
72241b5d47
@ -1643,6 +1643,15 @@ static void test_WaitBreak(HANDLE hcom)
|
|||||||
ok(ClearCommBreak(hcom), "ClearCommBreak failed\n");
|
ok(ClearCommBreak(hcom), "ClearCommBreak failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_stdio(void)
|
||||||
|
{
|
||||||
|
DCB dcb;
|
||||||
|
|
||||||
|
/* cygwin tries this to determine the stdin handle type */
|
||||||
|
ok( !GetCommState( GetStdHandle(STD_INPUT_HANDLE), &dcb ), "GetCommState succeeded on stdin\n" );
|
||||||
|
ok( GetLastError() == ERROR_INVALID_HANDLE, "got error %u\n", GetLastError() );
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(comm)
|
START_TEST(comm)
|
||||||
{
|
{
|
||||||
HANDLE hcom;
|
HANDLE hcom;
|
||||||
@ -1735,4 +1744,5 @@ START_TEST(comm)
|
|||||||
test_WaitBreak(hcom);
|
test_WaitBreak(hcom);
|
||||||
CloseHandle(hcom);
|
CloseHandle(hcom);
|
||||||
}
|
}
|
||||||
|
test_stdio();
|
||||||
}
|
}
|
||||||
|
@ -1110,8 +1110,17 @@ static inline NTSTATUS io_control(HANDLE hDevice,
|
|||||||
|
|
||||||
if (dwIoControlCode != IOCTL_SERIAL_GET_TIMEOUTS &&
|
if (dwIoControlCode != IOCTL_SERIAL_GET_TIMEOUTS &&
|
||||||
dwIoControlCode != IOCTL_SERIAL_SET_TIMEOUTS)
|
dwIoControlCode != IOCTL_SERIAL_SET_TIMEOUTS)
|
||||||
if ((status = server_get_unix_fd( hDevice, access, &fd, &needs_close, NULL, NULL )))
|
{
|
||||||
|
enum server_fd_type type;
|
||||||
|
if ((status = server_get_unix_fd( hDevice, access, &fd, &needs_close, &type, NULL )))
|
||||||
goto error;
|
goto error;
|
||||||
|
if (type != FD_TYPE_SERIAL)
|
||||||
|
{
|
||||||
|
if (needs_close) close( fd );
|
||||||
|
status = STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (dwIoControlCode)
|
switch (dwIoControlCode)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user