[PATCH 06/16] ntdll: Added support for immediate success returns in server_read_file.

Jacek Caban jacek at codeweavers.com
Fri Feb 10 09:23:23 CST 2017


On 01.02.2017 19:27, Alexandre Julliard wrote:
> Jacek Caban <jacek at codeweavers.com> writes:
>
>> @@ -588,10 +588,22 @@ static NTSTATUS server_read_file( HANDLE handle, HANDLE event, PIO_APC_ROUTINE a
>>      if (wait_handle)
>>      {
>>          NtWaitForSingleObject( wait_handle, (options & FILE_SYNCHRONOUS_IO_ALERT), NULL );
>> -        status = io->u.Status;
>>          NtClose( wait_handle );
>> +        return io->u.Status;
>> +    }
>> +
>> +    if (status == STATUS_SUCCESS || status == STATUS_BUFFER_OVERFLOW)
>> +    {
>> +        io->u.Status = status;
>> +        io->Information = total;
>> +        if (event) NtSetEvent( event, NULL );
>> +        if (apc) NtQueueApcThread( GetCurrentThread(), (PNTAPCFUNC)apc,
>> +                                   (ULONG_PTR)apc_context, (ULONG_PTR)io, 0 );
>>      }
>> +    else if (status != STATUS_PENDING && event)
>> +        NtResetEvent( event, NULL );
>>  
>> +    if (cvalue && status != STATUS_PENDING) NTDLL_AddCompletion( handle, cvalue, status, total );
> I think it would be cleaner to do these on the server-side, the same way
> it's done for the asynchronous case.

I sent a new version implementing those server-side. It needed bigger
changes than I expected, mostly to cover error handling corner cases:
events should be validated and reset at the moment, when early failure
may happen, meaning that async shouldn't be queued at this point.
Currently we don't support that, because async has to have an associated
queue.

Thanks,
Jacek



More information about the wine-devel mailing list