Commit 6bcd695c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Set IO_STATUS_BLOCK on non-blocking NtFlushBuffersFile success.

parent dd1769a1
...@@ -3298,13 +3298,15 @@ NTSTATUS WINAPI NtSetEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer, ...@@ -3298,13 +3298,15 @@ NTSTATUS WINAPI NtSetEaFile( HANDLE hFile, PIO_STATUS_BLOCK iosb, PVOID buffer,
* Success: 0. IoStatusBlock is updated. * Success: 0. IoStatusBlock is updated.
* Failure: An NTSTATUS error code describing the error. * Failure: An NTSTATUS error code describing the error.
*/ */
NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock ) NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK *io )
{ {
NTSTATUS ret; NTSTATUS ret;
HANDLE hEvent = NULL; HANDLE wait_handle;
enum server_fd_type type; enum server_fd_type type;
int fd, needs_close; int fd, needs_close;
if (!io || !virtual_check_buffer_for_write( io, sizeof(io) )) return STATUS_ACCESS_VIOLATION;
ret = server_get_unix_fd( hFile, FILE_WRITE_DATA, &fd, &needs_close, &type, NULL ); ret = server_get_unix_fd( hFile, FILE_WRITE_DATA, &fd, &needs_close, &type, NULL );
if (ret == STATUS_ACCESS_DENIED) if (ret == STATUS_ACCESS_DENIED)
ret = server_get_unix_fd( hFile, FILE_APPEND_DATA, &fd, &needs_close, &type, NULL ); ret = server_get_unix_fd( hFile, FILE_APPEND_DATA, &fd, &needs_close, &type, NULL );
...@@ -3317,16 +3319,21 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock ...@@ -3317,16 +3319,21 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock
{ {
SERVER_START_REQ( flush ) SERVER_START_REQ( flush )
{ {
req->async = server_async( hFile, NULL, NULL, NULL, NULL, IoStatusBlock ); req->async = server_async( hFile, NULL, NULL, NULL, NULL, io );
ret = wine_server_call( req ); ret = wine_server_call( req );
hEvent = wine_server_ptr_handle( reply->event ); wait_handle = wine_server_ptr_handle( reply->event );
if (wait_handle && ret != STATUS_PENDING)
{
io->u.Status = ret;
io->Information = 0;
}
} }
SERVER_END_REQ; SERVER_END_REQ;
if (hEvent) if (wait_handle)
{ {
NtWaitForSingleObject( hEvent, FALSE, NULL ); NtWaitForSingleObject( wait_handle, FALSE, NULL );
ret = STATUS_SUCCESS; ret = io->u.Status;
} }
} }
......
...@@ -4501,11 +4501,9 @@ static void test_flush_buffers_file(void) ...@@ -4501,11 +4501,9 @@ static void test_flush_buffers_file(void)
ok(hfileread != INVALID_HANDLE_VALUE, "could not open temp file, error %d.\n", GetLastError()); ok(hfileread != INVALID_HANDLE_VALUE, "could not open temp file, error %d.\n", GetLastError());
status = pNtFlushBuffersFile(hfile, NULL); status = pNtFlushBuffersFile(hfile, NULL);
todo_wine
ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %#x.\n", status); ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %#x.\n", status);
status = pNtFlushBuffersFile(hfile, (IO_STATUS_BLOCK *)0xdeadbeaf); status = pNtFlushBuffersFile(hfile, (IO_STATUS_BLOCK *)0xdeadbeaf);
todo_wine
ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %#x.\n", status); ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %#x.\n", status);
status = pNtFlushBuffersFile(hfile, &io_status_block); status = pNtFlushBuffersFile(hfile, &io_status_block);
......
...@@ -1378,8 +1378,8 @@ static void test_pipe_state(HANDLE pipe, BOOL is_server, DWORD state) ...@@ -1378,8 +1378,8 @@ static void test_pipe_state(HANDLE pipe, BOOL is_server, DWORD state)
{ {
ok(status == STATUS_SUCCESS, "status = %x in %s state %u\n", ok(status == STATUS_SUCCESS, "status = %x in %s state %u\n",
status, is_server ? "server" : "client", state); status, is_server ? "server" : "client", state);
todo_wine
ok(io.Status == status, "io.Status = %x\n", io.Status); ok(io.Status == status, "io.Status = %x\n", io.Status);
ok(!io.Information, "io.Information = %lx\n", io.Information);
} }
if (state != FILE_PIPE_CONNECTED_STATE) if (state != FILE_PIPE_CONNECTED_STATE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment