Commit 85cc2c13 authored by Andrey Turkin's avatar Andrey Turkin Committed by Alexandre Julliard

server: Connect named pipe synchronously when overlapped param is NULL.

parent c30688c4
......@@ -547,28 +547,36 @@ static DWORD CALLBACK serverThreadMain3(LPVOID arg)
oOverlap.hEvent = hEvent;
/* Wait for client to connect */
trace("Server calling overlapped ConnectNamedPipe...\n");
success = ConnectNamedPipe(hnp, &oOverlap);
err = GetLastError();
ok(!success && (err == ERROR_IO_PENDING || err == ERROR_PIPE_CONNECTED), "overlapped ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe returned.\n");
if (!success && (err == ERROR_IO_PENDING)) {
if (letWFSOEwait)
{
DWORD ret;
do {
ret = WaitForSingleObjectEx(hEvent, INFINITE, TRUE);
} while (ret == WAIT_IO_COMPLETION);
ok(ret == 0, "wait ConnectNamedPipe returned %x\n", ret);
}
success = GetOverlappedResult(hnp, &oOverlap, &dummy, letGORwait);
if (!letGORwait && !letWFSOEwait && !success) {
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
success = GetOverlappedResult(hnp, &oOverlap, &dummy, TRUE);
if (i == 0) {
trace("Server calling non-overlapped ConnectNamedPipe on overlapped pipe...\n");
success = ConnectNamedPipe(hnp, NULL);
err = GetLastError();
ok(success || (err == ERROR_PIPE_CONNECTED), "ConnectNamedPipe failed: %d\n", err);
trace("ConnectNamedPipe operation complete.\n");
} else {
trace("Server calling overlapped ConnectNamedPipe...\n");
success = ConnectNamedPipe(hnp, &oOverlap);
err = GetLastError();
ok(!success && (err == ERROR_IO_PENDING || err == ERROR_PIPE_CONNECTED), "overlapped ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe returned.\n");
if (!success && (err == ERROR_IO_PENDING)) {
if (letWFSOEwait)
{
DWORD ret;
do {
ret = WaitForSingleObjectEx(hEvent, INFINITE, TRUE);
} while (ret == WAIT_IO_COMPLETION);
ok(ret == 0, "wait ConnectNamedPipe returned %x\n", ret);
}
success = GetOverlappedResult(hnp, &oOverlap, &dummy, letGORwait);
if (!letGORwait && !letWFSOEwait && !success) {
ok(GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult\n");
success = GetOverlappedResult(hnp, &oOverlap, &dummy, TRUE);
}
}
ok(success || (err == ERROR_PIPE_CONNECTED), "GetOverlappedResult ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe operation complete.\n");
}
ok(success || (err == ERROR_PIPE_CONNECTED), "GetOverlappedResult ConnectNamedPipe\n");
trace("overlapped ConnectNamedPipe operation complete.\n");
/* Echo bytes once */
memset(buf, 0, sizeof(buf));
......
......@@ -1227,7 +1227,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
SERVER_START_REQ( ioctl )
{
req->code = code;
req->blocking = !apc && !event;
req->blocking = !apc && !event && !cvalue;
req->async.handle = wine_server_obj_handle( handle );
req->async.callback = wine_server_client_ptr( ioctl_completion );
req->async.iosb = wine_server_client_ptr( io );
......
......@@ -613,7 +613,7 @@ static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const a
{
case ps_idle_server:
case ps_wait_connect:
if (blocking && !is_overlapped( get_fd_options(fd) ))
if (blocking)
{
async_data_t new_data = *async_data;
if (!(wait_handle = alloc_wait_event( current->process ))) break;
......
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