mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 23:07:47 +00:00
kernel32: Fix CancelIoEx return value.
In commit 27ecc6ba5
("ntdll: Fix iosb handling in NtCancelIoFile()"),
NtCancelIoFile(Ex) was updated to return its status rather than
unconditionally setting it in io_status->u.Status (though the write
was retained in the success case). As a result, in the error case,
the kernelbase wrappers now interpret unitialized memory as an error
code, since io_status->u.Status is never written.
Signed-off-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
65f04bcc97
commit
d96975d649
|
@ -2941,6 +2941,7 @@ static void test_blocking_rw(HANDLE writer, HANDLE reader, DWORD buf_size, BOOL
|
|||
OVERLAPPED read_overlapped, read_overlapped2, write_overlapped, write_overlapped2;
|
||||
char buf[10000], read_buf[10000];
|
||||
HANDLE flush_thread;
|
||||
BOOL res;
|
||||
|
||||
memset(buf, 0xaa, sizeof(buf));
|
||||
|
||||
|
@ -3074,6 +3075,17 @@ static void test_blocking_rw(HANDLE writer, HANDLE reader, DWORD buf_size, BOOL
|
|||
overlapped_write_sync(writer, buf, 1);
|
||||
test_overlapped_result(reader, &read_overlapped, 1, FALSE);
|
||||
|
||||
/* Test that canceling the same operation twice gives a sensible error */
|
||||
SetLastError(0xdeadbeef);
|
||||
overlapped_read_async(reader, read_buf, 1, &read_overlapped2);
|
||||
res = pCancelIoEx(reader, &read_overlapped2);
|
||||
ok(res, "CancelIoEx failed with error %d\n", GetLastError());
|
||||
res = pCancelIoEx(reader, &read_overlapped2);
|
||||
ok(!res, "CancelIOEx succeeded unexpectedly");
|
||||
ok(GetLastError() == ERROR_NOT_FOUND,
|
||||
"In CancelIoEx failure, expected ERROR_NOT_FOUND, got %d\n", GetLastError());
|
||||
test_overlapped_failure(reader, &read_overlapped2, ERROR_OPERATION_ABORTED);
|
||||
|
||||
/* make two async writes, cancel the first one and make sure that we read from the second one */
|
||||
overlapped_write_async(writer, buf, buf_size+2000, &write_overlapped);
|
||||
overlapped_write_async(writer, buf, 1, &write_overlapped2);
|
||||
|
|
|
@ -2872,8 +2872,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CancelIo( HANDLE handle )
|
|||
{
|
||||
IO_STATUS_BLOCK io;
|
||||
|
||||
NtCancelIoFile( handle, &io );
|
||||
return set_ntstatus( io.u.Status );
|
||||
return set_ntstatus( NtCancelIoFile( handle, &io ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2884,8 +2883,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CancelIoEx( HANDLE handle, LPOVERLAPPED overlapped
|
|||
{
|
||||
IO_STATUS_BLOCK io;
|
||||
|
||||
NtCancelIoFileEx( handle, (PIO_STATUS_BLOCK)overlapped, &io );
|
||||
return set_ntstatus( io.u.Status );
|
||||
return set_ntstatus( NtCancelIoFileEx( handle, (PIO_STATUS_BLOCK)overlapped, &io ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue