[PATCH v2 01/11] ntdll: Do not fill the IOSB in NtDeviceIoControlFile() if the NT status denotes error.

Zebediah Figura zfigura at codeweavers.com
Fri Dec 10 11:27:29 CST 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/ntdll/unix/file.c  |  2 +-
 dlls/ws2_32/tests/afd.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index e459087af76..51c92df57e3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5735,7 +5735,7 @@ NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUT
         return server_ioctl_file( handle, event, apc, apc_context, io, code,
                                   in_buffer, in_size, out_buffer, out_size );
 
-    if (status != STATUS_PENDING) io->u.Status = status;
+    if (status != STATUS_PENDING && !NT_ERROR(status)) io->u.Status = status;
     return status;
 }
 
diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c
index 9e888f1fcb9..55029bfd30d 100644
--- a/dlls/ws2_32/tests/afd.c
+++ b/dlls/ws2_32/tests/afd.c
@@ -688,7 +688,7 @@ static void test_poll(void)
     ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io,
             IOCTL_AFD_POLL, in_params, params_size, out_params, params_size);
     ok(ret == STATUS_INVALID_HANDLE, "got %#x\n", ret);
-    todo_wine ok(!io.Status, "got %#x\n", io.Status);
+    ok(!io.Status, "got %#x\n", io.Status);
     ok(!io.Information, "got %#Ix\n", io.Information);
 
     /* Test passing the same handle twice. */
@@ -1201,7 +1201,7 @@ static void test_recv(void)
     memset(&io, 0, sizeof(io));
     ret = NtDeviceIoControlFile((HANDLE)listener, event, NULL, NULL, &io, IOCTL_AFD_RECV, NULL, 0, NULL, 0);
     todo_wine ok(ret == STATUS_INVALID_CONNECTION, "got %#x\n", ret);
-    todo_wine ok(!io.Status, "got status %#x\n", io.Status);
+    ok(!io.Status, "got status %#x\n", io.Status);
     ok(!io.Information, "got information %#Ix\n", io.Information);
 
     client = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -1213,7 +1213,7 @@ static void test_recv(void)
     memset(&io, 0, sizeof(io));
     ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io, IOCTL_AFD_RECV, NULL, 0, NULL, 0);
     ok(ret == STATUS_INVALID_PARAMETER, "got %#x\n", ret);
-    todo_wine ok(!io.Status, "got status %#x\n", io.Status);
+    ok(!io.Status, "got status %#x\n", io.Status);
     ok(!io.Information, "got information %#Ix\n", io.Information);
 
     wsabufs[0].len = sizeof(buffer);
@@ -1301,7 +1301,7 @@ static void test_recv(void)
     ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io,
             IOCTL_AFD_RECV, &params, sizeof(params), NULL, 0);
     ok(ret == STATUS_DEVICE_NOT_READY, "got %#x\n", ret);
-    todo_wine ok(!io.Status, "got status %#x\n", io.Status);
+    ok(!io.Status, "got status %#x\n", io.Status);
     ok(!io.Information, "got information %#Ix\n", io.Information);
 
     ret = send(server, "data", 5, 0);
@@ -1368,7 +1368,7 @@ static void test_recv(void)
     ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io,
             IOCTL_AFD_RECV, &params, sizeof(params), NULL, 0);
     ok(ret == STATUS_INVALID_PARAMETER, "got %#x\n", ret);
-    todo_wine ok(io.Status == 0xdeadbeef, "got %#x\n", io.Status);
+    ok(io.Status == 0xdeadbeef, "got %#x\n", io.Status);
 
     params.msg_flags = AFD_MSG_OOB | AFD_MSG_NOT_OOB;
 
@@ -1376,7 +1376,7 @@ static void test_recv(void)
     ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io,
             IOCTL_AFD_RECV, &params, sizeof(params), NULL, 0);
     ok(ret == STATUS_INVALID_PARAMETER, "got %#x\n", ret);
-    todo_wine ok(io.Status == 0xdeadbeef, "got %#x\n", io.Status);
+    ok(io.Status == 0xdeadbeef, "got %#x\n", io.Status);
 
     params.msg_flags = AFD_MSG_OOB;
 
-- 
2.34.1




More information about the wine-devel mailing list