ntdll: Add support for file I/O on device files.
This commit is contained in:
parent
c4fb1f617d
commit
950c82094b
|
@ -847,7 +847,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
|
||||||
goto done;
|
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))
|
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_FILE:
|
||||||
case FD_TYPE_CHAR:
|
case FD_TYPE_CHAR:
|
||||||
|
case FD_TYPE_DEVICE:
|
||||||
status = length ? STATUS_END_OF_FILE : STATUS_SUCCESS;
|
status = length ? STATUS_END_OF_FILE : STATUS_SUCCESS;
|
||||||
goto done;
|
goto done;
|
||||||
case FD_TYPE_SERIAL:
|
case FD_TYPE_SERIAL:
|
||||||
|
@ -1265,7 +1266,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == FD_TYPE_SERIAL)
|
else if (type == FD_TYPE_SERIAL || type == FD_TYPE_DEVICE)
|
||||||
{
|
{
|
||||||
if (async_write &&
|
if (async_write &&
|
||||||
(!offset || (offset->QuadPart < 0 && offset->QuadPart != FILE_WRITE_TO_END_OF_FILE)))
|
(!offset || (offset->QuadPart < 0 && offset->QuadPart != FILE_WRITE_TO_END_OF_FILE)))
|
||||||
|
|
|
@ -1063,14 +1063,14 @@ static void test_null_device(void)
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = WriteFile(null, buf, sizeof(buf), &num_bytes, NULL);
|
ret = WriteFile(null, buf, sizeof(buf), &num_bytes, NULL);
|
||||||
todo_wine ok(!ret, "WriteFile unexpectedly succeeded\n");
|
ok(!ret, "WriteFile unexpectedly succeeded\n");
|
||||||
todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||||
"expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
|
"expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = ReadFile(null, buf, sizeof(buf), &num_bytes, NULL);
|
ret = ReadFile(null, buf, sizeof(buf), &num_bytes, NULL);
|
||||||
ok(!ret, "ReadFile unexpectedly succeeded\n");
|
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());
|
"expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
|
||||||
|
|
||||||
num_bytes = 0xdeadbeef;
|
num_bytes = 0xdeadbeef;
|
||||||
|
@ -1102,7 +1102,7 @@ static void test_null_device(void)
|
||||||
ret = GetOverlappedResult(null, &ov, &num_bytes, TRUE);
|
ret = GetOverlappedResult(null, &ov, &num_bytes, TRUE);
|
||||||
ok(!ret, "GetOverlappedResult unexpectedly succeeded\n");
|
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());
|
"expected ERROR_HANDLE_EOF, got %u\n", GetLastError());
|
||||||
|
|
||||||
pNtClose(null);
|
pNtClose(null);
|
||||||
|
|
Loading…
Reference in New Issue