Commit 950c8209 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add support for file I/O on device files.

parent c4fb1f61
......@@ -847,7 +847,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
goto done;
}
}
else if (type == FD_TYPE_SERIAL)
else if (type == FD_TYPE_SERIAL || type == FD_TYPE_DEVICE)
{
if (async_read && (!offset || offset->QuadPart < 0))
{
......@@ -872,6 +872,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
{
case FD_TYPE_FILE:
case FD_TYPE_CHAR:
case FD_TYPE_DEVICE:
status = length ? STATUS_END_OF_FILE : STATUS_SUCCESS;
goto done;
case FD_TYPE_SERIAL:
......@@ -1265,7 +1266,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
goto done;
}
}
else if (type == FD_TYPE_SERIAL)
else if (type == FD_TYPE_SERIAL || type == FD_TYPE_DEVICE)
{
if (async_write &&
(!offset || (offset->QuadPart < 0 && offset->QuadPart != FILE_WRITE_TO_END_OF_FILE)))
......
......@@ -1063,14 +1063,14 @@ static void test_null_device(void)
SetLastError(0xdeadbeef);
ret = WriteFile(null, buf, sizeof(buf), &num_bytes, NULL);
todo_wine ok(!ret, "WriteFile unexpectedly succeeded\n");
todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER,
ok(!ret, "WriteFile unexpectedly succeeded\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(null, buf, sizeof(buf), &num_bytes, NULL);
ok(!ret, "ReadFile unexpectedly succeeded\n");
todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER,
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
num_bytes = 0xdeadbeef;
......@@ -1102,7 +1102,7 @@ static void test_null_device(void)
ret = GetOverlappedResult(null, &ov, &num_bytes, TRUE);
ok(!ret, "GetOverlappedResult unexpectedly succeeded\n");
}
todo_wine ok(GetLastError() == ERROR_HANDLE_EOF,
ok(GetLastError() == ERROR_HANDLE_EOF,
"expected ERROR_HANDLE_EOF, got %u\n", GetLastError());
pNtClose(null);
......
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