ntdll: Fix iosb handling in NtCancelIoFile().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-07-07 11:51:25 +02:00
parent 3a32ea8e91
commit 27ecc6ba5f
2 changed files with 33 additions and 7 deletions

View File

@ -168,7 +168,7 @@ static void test_ntncdf_async(void)
HANDLE hdir, hEvent;
char buffer[0x1000];
DWORD fflags, filter = 0;
IO_STATUS_BLOCK iosb, iosb2;
IO_STATUS_BLOCK iosb, iosb2, iosb3;
WCHAR path[MAX_PATH], subdir[MAX_PATH];
static const WCHAR szBoo[] = { '\\','b','o','o',0 };
static const WCHAR szHoo[] = { '\\','h','o','o',0 };
@ -293,16 +293,28 @@ static void test_ntncdf_async(void)
ok(U(iosb).Status == 0x01234567, "status set too soon\n");
ok(iosb.Information == 0x12345678, "info set too soon\n");
r = pNtCancelIoFile(hdir, &iosb);
U(iosb3).Status = 0x111111;
iosb3.Information = 0x222222;
r = pNtCancelIoFile(hdir, &iosb3);
ok( r == STATUS_SUCCESS, "cancel failed\n");
CloseHandle(hdir);
ok(U(iosb).Status == STATUS_SUCCESS, "status wrong\n");
ok(U(iosb).Status == STATUS_CANCELLED, "status wrong %x\n",U(iosb).Status);
ok(U(iosb2).Status == STATUS_CANCELLED, "status wrong %x\n",U(iosb2).Status);
ok(U(iosb3).Status == STATUS_SUCCESS, "status wrong %x\n",U(iosb3).Status);
ok(iosb.Information == 0, "info wrong\n");
ok(iosb2.Information == 0, "info wrong\n");
ok(iosb3.Information == 0, "info wrong\n");
U(iosb3).Status = 0x111111;
iosb3.Information = 0x222222;
r = pNtCancelIoFile(hdir, &iosb3);
ok( r == STATUS_INVALID_HANDLE, "cancel failed %x\n", r);
ok(U(iosb3).Status == 0x111111, "status wrong %x\n",U(iosb3).Status);
ok(iosb3.Information == 0x222222, "info wrong\n");
r = RemoveDirectoryW( path );
ok( r == TRUE, "failed to remove directory\n");

View File

@ -5931,16 +5931,23 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE handle, IO_STATUS_BLOCK *io )
*/
NTSTATUS WINAPI NtCancelIoFile( HANDLE handle, IO_STATUS_BLOCK *io_status )
{
NTSTATUS status;
TRACE( "%p %p\n", handle, io_status );
SERVER_START_REQ( cancel_async )
{
req->handle = wine_server_obj_handle( handle );
req->only_thread = TRUE;
io_status->u.Status = wine_server_call( req );
if (!(status = wine_server_call( req )))
{
io_status->u.Status = status;
io_status->Information = 0;
}
}
SERVER_END_REQ;
return io_status->u.Status;
return status;
}
@ -5949,16 +5956,23 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE handle, IO_STATUS_BLOCK *io_status )
*/
NTSTATUS WINAPI NtCancelIoFileEx( HANDLE handle, IO_STATUS_BLOCK *io, IO_STATUS_BLOCK *io_status )
{
NTSTATUS status;
TRACE( "%p %p %p\n", handle, io, io_status );
SERVER_START_REQ( cancel_async )
{
req->handle = wine_server_obj_handle( handle );
req->iosb = wine_server_client_ptr( io );
io_status->u.Status = wine_server_call( req );
if (!(status = wine_server_call( req )))
{
io_status->u.Status = status;
io_status->Information = 0;
}
}
SERVER_END_REQ;
return io_status->u.Status;
return status;
}