Zebediah Figura : kernelbase: Don't set the output size in DeviceIoControl() if the NT status denotes error.

Alexandre Julliard julliard at winehq.org
Tue Sep 14 16:00:13 CDT 2021


Module: wine
Branch: master
Commit: f5bd94639911b918eb5ee2c0d93bd08fb1cb1778
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f5bd94639911b918eb5ee2c0d93bd08fb1cb1778

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Sep 14 01:02:47 2021 -0500

kernelbase: Don't set the output size in DeviceIoControl() if the NT status denotes error.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 a1c6b68e6cb..614f263c5a3 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) */




More information about the wine-cvs mailing list