Likely a similar treatment should be given to other kernelbase APIs, but it's not immediately clear which.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/kernelbase/file.c | 7 ++++++- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index d21ad299d1f..74e713b7593 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -4116,7 +4116,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH DeviceIoControl( HANDLE handle, DWORD code, void * in_buff, in_count, out_buff, out_count );
if (returned) *returned = piosb->Information; - return set_ntstatus( status ); + if (status == STATUS_PENDING || !NT_SUCCESS( status )) + { + SetLastError( RtlNtStatusToDosError( status )); + return FALSE; + } + return TRUE; }
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index dc10497caee..9ee2f55a826 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -663,17 +663,17 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params) size = 0xdeadf00d; SetLastError(0xdeadf00d); ret = DeviceIoControl(device, ioctl, params, sizeof(*params), buffer, sizeof(buffer), &size, NULL); - todo_wine_if (NT_SUCCESS(expect_status) != !params->iosb_status) + todo_wine_if (NT_SUCCESS(expect_status) != NT_SUCCESS(params->iosb_status)) ok(ret == NT_SUCCESS(expect_status), "got %d\n", ret); if (NT_SUCCESS(expect_status)) { - todo_wine_if (params->iosb_status) + todo_wine_if (!NT_SUCCESS(params->iosb_status)) ok(GetLastError() == 0xdeadf00d, "got error %u\n", GetLastError()); } else { todo_wine_if (RtlNtStatusToDosError(expect_status) != RtlNtStatusToDosError(params->iosb_status) - || params->iosb_status == STATUS_PENDING) + || NT_SUCCESS(params->iosb_status)) ok(GetLastError() == RtlNtStatusToDosError(expect_status), "got error %u\n", GetLastError()); } if (NT_ERROR(expect_status))