ntdll: Do not fill the IOSB if a device IRP failed synchronously.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-09-14 01:02:44 -05:00 committed by Alexandre Julliard
parent 1ee382c706
commit 5af74129bd
4 changed files with 32 additions and 23 deletions

View File

@ -1641,8 +1641,8 @@ static void test_mountmgr_query_points(void)
status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
IOCTL_MOUNTMGR_QUERY_POINTS, NULL, 0, NULL, 0 );
ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
memset( input, 0, sizeof(*input) );
@ -1651,16 +1651,16 @@ static void test_mountmgr_query_points(void)
status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input) - 1, NULL, 0 );
ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
io.Status = 0xdeadf00d;
io.Information = 0xdeadf00d;
status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), NULL, 0 );
ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
io.Status = 0xdeadf00d;
io.Information = 0xdeadf00d;
@ -1668,8 +1668,8 @@ static void test_mountmgr_query_points(void)
status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), output, sizeof(*output) - 1 );
ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
ok(output->Size == 0xcccccccc, "got size %u\n", output->Size);
ok(output->NumberOfMountPoints == 0xcccccccc, "got count %u\n", output->NumberOfMountPoints);

View File

@ -385,6 +385,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
if (result->async_io.status != STATUS_PENDING)
{
result->async_io.total = info;
/* the server will pass us NULL if a call failed synchronously */
set_async_iosb( call->async_io.sb, result->async_io.status, info );
}
break;

View File

@ -690,8 +690,8 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
ok(ret == expect_status, "got %#x\n", ret);
if (NT_ERROR(params->iosb_status))
{
todo_wine ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
}
else
{
@ -726,8 +726,8 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
"got %#x\n", ret);
if (!params->pending && NT_ERROR(params->iosb_status))
{
todo_wine ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ret = WaitForSingleObject(event, 0);
ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
}
@ -778,8 +778,8 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
"got %#x\n", ret);
if (!params->pending && NT_ERROR(params->iosb_status))
{
todo_wine ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ret = WaitForSingleObject(event, 0);
ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
}
@ -810,8 +810,8 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
"got %#x\n", ret);
if (!params->pending && NT_ERROR(params->iosb_status))
{
todo_wine ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ret = WaitForSingleObject(file, 0);
ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
}
@ -846,8 +846,8 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
"got %#x\n", ret);
if (!params->pending && NT_ERROR(params->iosb_status))
{
todo_wine ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ret = WaitForSingleObject(event, 0);
ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
}
@ -915,8 +915,8 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
ok(ret == params->ret_status, "got %#x\n", ret);
if (!params->pending && NT_ERROR(params->iosb_status))
{
todo_wine ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
}
else
{
@ -1151,8 +1151,8 @@ static void test_blocking_irp(void)
io.Information = 0xdeadf00d;
status = NtQueryVolumeInformationFile(file, &io, buffer, sizeof(buffer), FileFsFullSizeInformation);
ok(status == STATUS_DEVICE_NOT_READY, "got %#x\n", status);
todo_wine ok(io.Status == 0xdeadf00d, "got iosb status %#x\n", io.Status);
todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
ok(io.Status == 0xdeadf00d, "got iosb status %#x\n", io.Status);
ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
CloseHandle(file);

View File

@ -184,9 +184,17 @@ void async_terminate( struct async *async, unsigned int status )
memset( &data, 0, sizeof(data) );
data.type = APC_ASYNC_IO;
data.async_io.user = async->data.user;
data.async_io.sb = async->data.iosb;
data.async_io.result = iosb ? iosb->result : 0;
/* this can happen if the initial status was unknown (i.e. for device
* files). the client should not fill the IOSB in this case; pass it as
* NULL to communicate that.
* note that we check the IOSB status and not the initial status */
if (NT_ERROR( status ) && (!is_fd_overlapped( async->fd ) || !async->pending))
data.async_io.sb = 0;
else
data.async_io.sb = async->data.iosb;
/* if there is output data, the client needs to make an extra request
* to retrieve it; use STATUS_ALERTED to signal this case */
if (iosb && iosb->out_data)