mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 16:23:37 +00:00
server: Improve named pipe write error handling.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
91852564dc
commit
7038b9ef15
|
@ -1149,7 +1149,7 @@ static DWORD CALLBACK serverThreadMain4(LPVOID arg)
|
|||
SetLastError(ERROR_SUCCESS);
|
||||
success = WriteFile(hnp, buf, readden, &written, &oWrite);
|
||||
err = GetLastError();
|
||||
todo_wine_if (!success && err == ERROR_PIPE_NOT_CONNECTED) ok(!success && err == ERROR_NO_DATA,
|
||||
ok(!success && err == ERROR_NO_DATA,
|
||||
"overlapped WriteFile on disconnected pipe returned %u, err=%i\n", success, err);
|
||||
|
||||
/* No completion status is queued on immediate error. */
|
||||
|
@ -1605,7 +1605,7 @@ static void test_CloseHandle(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
ret = WriteFile(hfile, testdata, sizeof(testdata), &numbytes, NULL);
|
||||
ok(!ret, "WriteFile unexpectedly succeeded\n");
|
||||
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
|
||||
CloseHandle(hfile);
|
||||
|
||||
|
@ -1650,7 +1650,7 @@ static void test_CloseHandle(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
ret = WriteFile(hfile, testdata, sizeof(testdata), &numbytes, NULL);
|
||||
ok(!ret, "WriteFile unexpectedly succeeded\n");
|
||||
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
|
||||
CloseHandle(hfile);
|
||||
|
||||
|
@ -1715,7 +1715,7 @@ static void test_CloseHandle(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
ret = WriteFile(hpipe, testdata, sizeof(testdata), &numbytes, NULL);
|
||||
ok(!ret, "WriteFile unexpectedly succeeded\n");
|
||||
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
|
||||
CloseHandle(hpipe);
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ static void test_CloseHandle(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
ret = WriteFile(hpipe, testdata, sizeof(testdata), &numbytes, NULL);
|
||||
ok(!ret, "WriteFile unexpectedly succeeded\n");
|
||||
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
|
||||
|
||||
CloseHandle(hpipe);
|
||||
}
|
||||
|
|
|
@ -1419,7 +1419,6 @@ static void test_pipe_with_data_state(HANDLE pipe, BOOL is_server, DWORD state)
|
|||
break;
|
||||
}
|
||||
status = NtWriteFile(pipe, NULL, NULL, NULL, &io, buf, 1, NULL, NULL);
|
||||
todo_wine_if(expected_status == STATUS_PIPE_CLOSING)
|
||||
ok(status == expected_status, "NtWriteFile failed in %s state %u: %x\n",
|
||||
is_server ? "server" : "client", state, status);
|
||||
|
||||
|
|
|
@ -826,10 +826,19 @@ static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos )
|
|||
struct pipe_message *message;
|
||||
struct iosb *iosb;
|
||||
|
||||
if (!pipe_end->connection)
|
||||
switch (pipe_end->state)
|
||||
{
|
||||
case FILE_PIPE_CONNECTED_STATE:
|
||||
break;
|
||||
case FILE_PIPE_DISCONNECTED_STATE:
|
||||
set_error( STATUS_PIPE_DISCONNECTED );
|
||||
return 0;
|
||||
case FILE_PIPE_LISTENING_STATE:
|
||||
set_error( STATUS_PIPE_LISTENING );
|
||||
return 0;
|
||||
case FILE_PIPE_CLOSING_STATE:
|
||||
set_error( STATUS_PIPE_CLOSING );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(pipe_end->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) && !get_req_data_size()) return 1;
|
||||
|
|
Loading…
Reference in a new issue