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

Alexandre Julliard julliard at winehq.org
Wed Feb 1 12:27:05 CST 2017


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.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list