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

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 21 07:24:24 CDT 2015


Module: wine
Branch: master
Commit: 950c82094b34bec87b38e09fe4657df4eeeb0522
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=950c82094b34bec87b38e09fe4657df4eeeb0522

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu May 21 17:27:03 2015 +0900

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

---

 dlls/ntdll/file.c     | 5 +++--
 dlls/ntdll/tests/om.c | 8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 43e52c6..d081750 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -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)))
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index fa6f2c3..a7ac95f 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -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);




More information about the wine-cvs mailing list