[PATCH 2/2] ntdll: Fix NtFlushBuffersFile() for files with FILE_APPEND_DATA access.

Paul Gofman gofmanp at gmail.com
Fri Mar 3 11:05:27 CST 2017


     Sorry for introducing that in f7d40d45da7a1bc0accd58bca6d6da4e34861937.
     I just verified that server_get_unix_fd() returns success if to 
request FILE_APPEND_DATA for handles created with (read/)write access. I 
also checked that requesting FILE_APPEND_DATA gets no error if using it 
with a usb serial port. Is it anything bad to just use FILE_APPEND_DATA 
instead of FILE_WRITE_DATA in server_get_unix_fd()?

     If its not that I am missing something why it should not be done 
like that, I can add test for serial port.

On 03/03/2017 06:21 PM, Józef Kucia wrote:
> This fixes a regression introduced by commit
> f7d40d45da7a1bc0accd58bca6d6da4e34861937.
>
> Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
> ---
>   dlls/ntdll/file.c       | 2 ++
>   dlls/ntdll/tests/file.c | 1 -
>   2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
> index 3f38c6f..e2cfe7f 100644
> --- a/dlls/ntdll/file.c
> +++ b/dlls/ntdll/file.c
> @@ -3418,6 +3418,8 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock
>       int fd, needs_close;
>   
>       ret = server_get_unix_fd( hFile, FILE_WRITE_DATA, &fd, &needs_close, &type, NULL );
> +    if (ret == STATUS_ACCESS_DENIED)
> +        ret = server_get_unix_fd( hFile, FILE_APPEND_DATA, &fd, &needs_close, &type, NULL );
>   
>       if (!ret && type == FD_TYPE_SERIAL)
>       {
> diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
> index 5e7e1ee..09bf688 100644
> --- a/dlls/ntdll/tests/file.c
> +++ b/dlls/ntdll/tests/file.c
> @@ -4441,7 +4441,6 @@ static void test_flush_buffers_file(void)
>       ok(hfile != INVALID_HANDLE_VALUE, "could not open temp file, error %d.\n", GetLastError());
>   
>       status = pNtFlushBuffersFile(hfile, &io_status_block);
> -    todo_wine
>       ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x.\n", status);
>   
>       CloseHandle(hfile);





More information about the wine-patches mailing list