[PATCH 5/6] kernelbase: Don't set the output size in DeviceIoControl() if the NT status denotes error.

Zebediah Figura zfigura at codeweavers.com
Tue Sep 14 01:02:47 CDT 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/kernelbase/file.c             | 2 +-
 dlls/ntoskrnl.exe/tests/ntoskrnl.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index a4d26c2a1be..5c7b649d805 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -4115,7 +4115,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH DeviceIoControl( HANDLE handle, DWORD code, void *
         status = NtDeviceIoControlFile( handle, event, NULL, cvalue, piosb, code,
                                         in_buff, in_count, out_buff, out_count );
 
-    if (returned) *returned = piosb->Information;
+    if (returned && !NT_ERROR(status)) *returned = piosb->Information;
     if (status == STATUS_PENDING || !NT_SUCCESS( status )) return set_ntstatus( status );
     return TRUE;
 }
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 30868db3e98..2484479efc3 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -675,7 +675,7 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
         ok(GetLastError() == RtlNtStatusToDosError(expect_status), "got error %u\n", GetLastError());
     }
     if (NT_ERROR(expect_status))
-        todo_wine ok(size == 0xdeadf00d, "got size %u\n", size);
+        ok(size == 0xdeadf00d, "got size %u\n", size);
     else if (!NT_ERROR(params->iosb_status))
         todo_wine_if (params->iosb_status == STATUS_PENDING) ok(size == 3, "got size %u\n", size);
     /* size is garbage if !NT_ERROR(expect_status) && NT_ERROR(iosb_status) */
-- 
2.33.0




More information about the wine-devel mailing list