mirror of
https://github.com/reactos/reactos.git
synced 2025-07-02 06:01:21 +00:00
[RPCRT4] Update the support for remote pipes which was dropped by the sync to Wine Staging 2.9 and update rpcrt4_ros.diff accordingly
This commit is contained in:
parent
8f440355da
commit
24cd7bbe0b
2 changed files with 160 additions and 289 deletions
|
@ -258,14 +258,24 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *ncacn_pipe_name(const char *endpoint)
|
static char *ncacn_pipe_name(const char *server, const char *endpoint)
|
||||||
{
|
{
|
||||||
static const char prefix[] = "\\\\.";
|
static const char prefix[] = "\\\\";
|
||||||
|
static const char local[] = ".";
|
||||||
|
char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
char *pipe_name;
|
char *pipe_name;
|
||||||
|
DWORD bufLen = ARRAYSIZE(ComputerName);
|
||||||
|
|
||||||
|
GetComputerNameA(ComputerName, &bufLen);
|
||||||
|
|
||||||
|
if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0)
|
||||||
|
server = local;
|
||||||
|
|
||||||
/* protseq=ncacn_np: named pipes */
|
/* protseq=ncacn_np: named pipes */
|
||||||
pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
|
pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint));
|
||||||
strcat(strcpy(pipe_name, prefix), endpoint);
|
strcpy(pipe_name, prefix);
|
||||||
|
strcat(pipe_name, server);
|
||||||
|
strcat(pipe_name, endpoint);
|
||||||
return pipe_name;
|
return pipe_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +289,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
|
||||||
if (npc->pipe)
|
if (npc->pipe)
|
||||||
return RPC_S_OK;
|
return RPC_S_OK;
|
||||||
|
|
||||||
pname = ncacn_pipe_name(Connection->Endpoint);
|
pname = ncacn_pipe_name(Connection->NetworkAddr, Connection->Endpoint);
|
||||||
r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
|
r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
|
||||||
I_RpcFree(pname);
|
I_RpcFree(pname);
|
||||||
|
|
||||||
|
@ -307,7 +317,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protse
|
||||||
if (r != RPC_S_OK)
|
if (r != RPC_S_OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(Connection->Endpoint);
|
((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(NULL, Connection->Endpoint);
|
||||||
r = rpcrt4_conn_create_pipe(Connection);
|
r = rpcrt4_conn_create_pipe(Connection);
|
||||||
|
|
||||||
EnterCriticalSection(&protseq->cs);
|
EnterCriticalSection(&protseq->cs);
|
||||||
|
@ -358,7 +368,7 @@ static RPC_STATUS rpcrt4_ncacn_np_is_server_listening(const char *endpoint)
|
||||||
char *pipe_name;
|
char *pipe_name;
|
||||||
RPC_STATUS status;
|
RPC_STATUS status;
|
||||||
|
|
||||||
pipe_name = ncacn_pipe_name(endpoint);
|
pipe_name = ncacn_pipe_name(NULL, endpoint);
|
||||||
status = is_pipe_listening(pipe_name);
|
status = is_pipe_listening(pipe_name);
|
||||||
I_RpcFree(pipe_name);
|
I_RpcFree(pipe_name);
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -63,9 +63,35 @@ diff -pudN e:\wine\dlls\rpcrt4/rpc_epmap.c e:\reactos\dll\win32\rpcrt4/rpc_epmap
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||||
diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_transport.c
|
diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_transport.c
|
||||||
--- e:\wine\dlls\rpcrt4/rpc_transport.c 2016-11-16 17:33:13 +0100
|
--- e:\wine\dlls\rpcrt4/rpc_transport.c 2018-07-28 18:12:19 +0000
|
||||||
+++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2016-11-17 00:00:46 +0100
|
+++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2018-07-28 18:28:54 +0000
|
||||||
@@ -82,6 +79,7 @@
|
@@ -25,6 +25,9 @@
|
||||||
|
|
||||||
|
#include "ntstatus.h"
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
+#ifdef __REACTOS__
|
||||||
|
+#define NONAMELESSUNION
|
||||||
|
+#endif
|
||||||
|
#include "ws2tcpip.h"
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
@@ -32,12 +35,14 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
+
|
||||||
|
+
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winnls.h"
|
||||||
|
#include "winerror.h"
|
||||||
|
#include "wininet.h"
|
||||||
|
-#include "winternl.h"
|
||||||
|
+#include "wine/winternl.h"
|
||||||
|
#include "winioctl.h"
|
||||||
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
|
@@ -54,10 +59,26 @@
|
||||||
|
|
||||||
#define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000)
|
#define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000)
|
||||||
|
|
||||||
|
@ -73,302 +99,137 @@ diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_t
|
||||||
#define ARRAYSIZE(a) (sizeof((a)) / sizeof((a)[0]))
|
#define ARRAYSIZE(a) (sizeof((a)) / sizeof((a)[0]))
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
|
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
|
||||||
@@ -94,31 +92,41 @@ typedef struct _RpcConnection_np
|
|
||||||
{
|
|
||||||
RpcConnection common;
|
|
||||||
HANDLE pipe;
|
|
||||||
- HANDLE listen_thread;
|
|
||||||
+ OVERLAPPED ovl;
|
|
||||||
BOOL listening;
|
|
||||||
} RpcConnection_np;
|
|
||||||
|
|
||||||
static RpcConnection *rpcrt4_conn_np_alloc(void)
|
+#ifdef __REACTOS__ /* FIXME: Inspect */
|
||||||
{
|
+BOOL WINAPI CancelIoEx(HANDLE handle, LPOVERLAPPED lpOverlapped)
|
||||||
RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_np));
|
|
||||||
+ if (npc)
|
|
||||||
+{
|
+{
|
||||||
+ npc->pipe = NULL;
|
+ IO_STATUS_BLOCK io_status;
|
||||||
+ memset(&npc->ovl, 0, sizeof(npc->ovl));
|
+
|
||||||
+ npc->listening = FALSE;
|
+ NtCancelIoFile(handle, &io_status);
|
||||||
|
+ if (io_status.u.Status)
|
||||||
|
+ {
|
||||||
|
+ SetLastError( RtlNtStatusToDosError( io_status.u.Status ) );
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+ return TRUE;
|
||||||
+}
|
+}
|
||||||
return &npc->common;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static DWORD CALLBACK listen_thread(void *arg)
|
|
||||||
+static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
|
|
||||||
{
|
|
||||||
- RpcConnection_np *npc = arg;
|
|
||||||
+ if (npc->listening)
|
|
||||||
+ return RPC_S_OK;
|
|
||||||
+
|
|
||||||
+ npc->listening = TRUE;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
- if (ConnectNamedPipe(npc->pipe, NULL))
|
|
||||||
+ if (ConnectNamedPipe(npc->pipe, &npc->ovl))
|
|
||||||
return RPC_S_OK;
|
|
||||||
|
|
||||||
switch(GetLastError())
|
|
||||||
{
|
|
||||||
case ERROR_PIPE_CONNECTED:
|
|
||||||
+ SetEvent(npc->ovl.hEvent);
|
|
||||||
+ return RPC_S_OK;
|
|
||||||
+ case ERROR_IO_PENDING:
|
|
||||||
+ /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */
|
|
||||||
return RPC_S_OK;
|
|
||||||
- case ERROR_HANDLES_CLOSED:
|
|
||||||
- /* connection closed during listen */
|
|
||||||
- return RPC_S_NO_CONTEXT_AVAILABLE;
|
|
||||||
case ERROR_NO_DATA_DETECTED:
|
|
||||||
/* client has disconnected, retry */
|
|
||||||
DisconnectNamedPipe( npc->pipe );
|
|
||||||
@@ -131,6 +139,7 @@ static DWORD CALLBACK listen_thread(void
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifndef __REACTOS__
|
|
||||||
static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
|
|
||||||
{
|
|
||||||
if (npc->listening)
|
|
||||||
@@ -146,13 +155,14 @@ static RPC_STATUS rpcrt4_conn_listen_pip
|
|
||||||
}
|
|
||||||
return RPC_S_OK;
|
|
||||||
}
|
|
||||||
+#endif
|
+#endif
|
||||||
|
|
||||||
static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname)
|
|
||||||
{
|
|
||||||
RpcConnection_np *npc = (RpcConnection_np *) Connection;
|
|
||||||
TRACE("listening on %s\n", pname);
|
|
||||||
|
|
||||||
- npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX,
|
|
||||||
+ npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
|
||||||
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
|
|
||||||
PIPE_UNLIMITED_INSTANCES,
|
|
||||||
RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
|
|
||||||
@@ -164,6 +174,9 @@ static RPC_STATUS rpcrt4_conn_create_pip
|
|
||||||
return RPC_S_CANT_CREATE_ENDPOINT;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ memset(&npc->ovl, 0, sizeof(npc->ovl));
|
|
||||||
+ npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
|
||||||
+
|
+
|
||||||
/* Note: we don't call ConnectNamedPipe here because it must be done in the
|
static RpcConnection *rpcrt4_spawn_connection(RpcConnection *old_connection);
|
||||||
* server thread as the thread must be alertable */
|
|
||||||
return RPC_S_OK;
|
/**** ncacn_np support ****/
|
||||||
@@ -210,6 +223,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
|
@@ -237,14 +258,24 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
|
||||||
if (err == ERROR_PIPE_BUSY) {
|
return r;
|
||||||
TRACE("connection failed, error=%x\n", err);
|
|
||||||
return RPC_S_SERVER_TOO_BUSY;
|
|
||||||
+ } else if (err == ERROR_BAD_NETPATH) {
|
|
||||||
+ TRACE("connection failed, error=%x\n", err);
|
|
||||||
+ return RPC_S_SERVER_UNAVAILABLE;
|
|
||||||
}
|
|
||||||
if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
|
|
||||||
err = GetLastError();
|
|
||||||
@@ -219,9 +235,11 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* success */
|
-static char *ncacn_pipe_name(const char *endpoint)
|
||||||
+ memset(&npc->ovl, 0, sizeof(npc->ovl));
|
+static char *ncacn_pipe_name(const char *server, const char *endpoint)
|
||||||
/* pipe is connected; change to message-read mode. */
|
|
||||||
dwMode = PIPE_READMODE_MESSAGE;
|
|
||||||
SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
|
|
||||||
+ npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
|
||||||
npc->pipe = pipe;
|
|
||||||
|
|
||||||
return RPC_S_OK;
|
|
||||||
@@ -304,15 +322,64 @@ static char *ncacn_pipe_name(const char
|
|
||||||
static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
|
|
||||||
{
|
{
|
||||||
RpcConnection_np *npc = (RpcConnection_np *) Connection;
|
- static const char prefix[] = "\\\\.";
|
||||||
+ static const char prefix[] = "\\\\";
|
+ static const char prefix[] = "\\\\";
|
||||||
+ static const char local[] = ".";
|
+ static const char local[] = ".";
|
||||||
+ BOOL bUseLocalName = TRUE;
|
+ char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
+ CHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
char *pipe_name;
|
||||||
+ DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]);
|
+ DWORD bufLen = ARRAYSIZE(ComputerName);
|
||||||
RPC_STATUS r;
|
+
|
||||||
LPSTR pname;
|
+ GetComputerNameA(ComputerName, &bufLen);
|
||||||
+ LPSTR NetworkAddr;
|
+
|
||||||
+ INT size;
|
+ if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0)
|
||||||
|
+ server = local;
|
||||||
|
|
||||||
/* already connected? */
|
/* protseq=ncacn_np: named pipes */
|
||||||
|
- pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
|
||||||
|
- strcat(strcpy(pipe_name, prefix), endpoint);
|
||||||
|
+ pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint));
|
||||||
|
+ strcpy(pipe_name, prefix);
|
||||||
|
+ strcat(pipe_name, server);
|
||||||
|
+ strcat(pipe_name, endpoint);
|
||||||
|
return pipe_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -258,7 +289,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(R
|
||||||
if (npc->pipe)
|
if (npc->pipe)
|
||||||
return RPC_S_OK;
|
return RPC_S_OK;
|
||||||
|
|
||||||
- pname = ncacn_pipe_name(Connection->Endpoint);
|
- pname = ncacn_pipe_name(Connection->Endpoint);
|
||||||
- r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
|
+ pname = ncacn_pipe_name(Connection->NetworkAddr, Connection->Endpoint);
|
||||||
+ /* protseq=ncacn_np: named pipes */
|
r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
|
||||||
+ size = strlen(prefix);
|
|
||||||
+
|
|
||||||
+ if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
|
|
||||||
+ {
|
|
||||||
+ bUseLocalName = TRUE;
|
|
||||||
+ size += strlen(local);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ NetworkAddr = Connection->NetworkAddr;
|
|
||||||
+ if (NetworkAddr[0] == '\\' && NetworkAddr[1] == '\\')
|
|
||||||
+ NetworkAddr += 2;
|
|
||||||
+
|
|
||||||
+ if (GetComputerNameA(ComputerName, &bufLen))
|
|
||||||
+ {
|
|
||||||
+ if (stricmp(ComputerName, NetworkAddr) == 0)
|
|
||||||
+ {
|
|
||||||
+ bUseLocalName = TRUE;
|
|
||||||
+ size += strlen(local);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ bUseLocalName = FALSE;
|
|
||||||
+ size += strlen(NetworkAddr);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ bUseLocalName = FALSE;
|
|
||||||
+ size += strlen(NetworkAddr);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ size += strlen(Connection->Endpoint) + 1;
|
|
||||||
+
|
|
||||||
+ pname = I_RpcAllocate(size);
|
|
||||||
+ strcpy(pname, prefix);
|
|
||||||
+ if (bUseLocalName)
|
|
||||||
+ strcat(pname, local);
|
|
||||||
+ else
|
|
||||||
+ strcat(pname, NetworkAddr);
|
|
||||||
+ strcat(pname, Connection->Endpoint);
|
|
||||||
+ r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
|
|
||||||
I_RpcFree(pname);
|
I_RpcFree(pname);
|
||||||
|
|
||||||
|
@@ -286,7 +317,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_n
|
||||||
|
if (r != RPC_S_OK)
|
||||||
return r;
|
return r;
|
||||||
@@ -358,9 +425,9 @@ static void rpcrt4_conn_np_handoff(RpcCo
|
|
||||||
* to the child, then reopen the server binding to continue listening */
|
|
||||||
|
|
||||||
new_npc->pipe = old_npc->pipe;
|
- ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(Connection->Endpoint);
|
||||||
- new_npc->listen_thread = old_npc->listen_thread;
|
+ ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(NULL, Connection->Endpoint);
|
||||||
+ new_npc->ovl = old_npc->ovl;
|
r = rpcrt4_conn_create_pipe(Connection);
|
||||||
old_npc->pipe = 0;
|
|
||||||
- old_npc->listen_thread = 0;
|
|
||||||
+ memset(&old_npc->ovl, 0, sizeof(old_npc->ovl));
|
|
||||||
old_npc->listening = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -444,20 +511,29 @@ static int rpcrt4_conn_np_read(RpcConnec
|
|
||||||
void *buffer, unsigned int count)
|
|
||||||
{
|
|
||||||
RpcConnection_np *npc = (RpcConnection_np *) Connection;
|
|
||||||
- IO_STATUS_BLOCK io_status;
|
|
||||||
char *buf = buffer;
|
|
||||||
+ BOOL ret = TRUE;
|
|
||||||
unsigned int bytes_left = count;
|
|
||||||
- NTSTATUS status;
|
|
||||||
+ OVERLAPPED ovl;
|
|
||||||
+
|
|
||||||
+ ZeroMemory(&ovl, sizeof(ovl));
|
|
||||||
+ ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
|
||||||
|
|
||||||
while (bytes_left)
|
|
||||||
{
|
|
||||||
- status = NtReadFile(npc->pipe, NULL, NULL, NULL, &io_status, buf, bytes_left, NULL, NULL);
|
|
||||||
- if (status && status != STATUS_BUFFER_OVERFLOW)
|
|
||||||
- return -1;
|
|
||||||
- bytes_left -= io_status.Information;
|
|
||||||
- buf += io_status.Information;
|
|
||||||
+ DWORD bytes_read;
|
|
||||||
+ ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &ovl);
|
|
||||||
+ if (!ret && GetLastError() == ERROR_IO_PENDING)
|
|
||||||
+ ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_read, TRUE);
|
|
||||||
+ if (!ret && GetLastError() == ERROR_MORE_DATA)
|
|
||||||
+ ret = TRUE;
|
|
||||||
+ if (!ret || !bytes_read)
|
|
||||||
+ break;
|
|
||||||
+ bytes_left -= bytes_read;
|
|
||||||
+ buf += bytes_read;
|
|
||||||
}
|
|
||||||
- return count;
|
|
||||||
+ CloseHandle(ovl.hEvent);
|
|
||||||
+ return ret ? count : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int rpcrt4_conn_np_write(RpcConnection *Connection,
|
|
||||||
@@ -467,16 +543,23 @@ static int rpcrt4_conn_np_write(RpcConne
|
|
||||||
const char *buf = buffer;
|
|
||||||
BOOL ret = TRUE;
|
|
||||||
unsigned int bytes_left = count;
|
|
||||||
+ OVERLAPPED ovl;
|
|
||||||
+
|
|
||||||
+ ZeroMemory(&ovl, sizeof(ovl));
|
|
||||||
+ ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
|
||||||
|
|
||||||
while (bytes_left)
|
|
||||||
{
|
|
||||||
DWORD bytes_written;
|
|
||||||
- ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL);
|
|
||||||
+ ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &ovl);
|
|
||||||
+ if (!ret && GetLastError() == ERROR_IO_PENDING)
|
|
||||||
+ ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_written, TRUE);
|
|
||||||
if (!ret || !bytes_written)
|
|
||||||
break;
|
|
||||||
bytes_left -= bytes_written;
|
|
||||||
buf += bytes_written;
|
|
||||||
}
|
|
||||||
+ CloseHandle(ovl.hEvent);
|
|
||||||
return ret ? count : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -488,9 +571,9 @@ static int rpcrt4_conn_np_close(RpcConne
|
|
||||||
CloseHandle(npc->pipe);
|
|
||||||
npc->pipe = 0;
|
|
||||||
}
|
|
||||||
- if (npc->listen_thread) {
|
|
||||||
- CloseHandle(npc->listen_thread);
|
|
||||||
- npc->listen_thread = 0;
|
|
||||||
+ if (npc->ovl.hEvent) {
|
|
||||||
+ CloseHandle(npc->ovl.hEvent);
|
|
||||||
+ npc->ovl.hEvent = 0;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -694,7 +777,7 @@ static void *rpcrt4_protseq_np_get_wait_
|
|
||||||
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
|
|
||||||
while (conn) {
|
|
||||||
rpcrt4_conn_listen_pipe(conn);
|
|
||||||
- if (conn->listen_thread)
|
|
||||||
+ if (conn->ovl.hEvent)
|
|
||||||
(*count)++;
|
|
||||||
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
|
|
||||||
}
|
|
||||||
@@ -715,7 +798,7 @@ static void *rpcrt4_protseq_np_get_wait_
|
|
||||||
*count = 1;
|
|
||||||
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
|
|
||||||
while (conn) {
|
|
||||||
- if ((objs[*count] = conn->listen_thread))
|
|
||||||
+ if ((objs[*count] = conn->ovl.hEvent))
|
|
||||||
(*count)++;
|
|
||||||
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
|
|
||||||
}
|
|
||||||
@@ -762,18 +845,12 @@ static int rpcrt4_protseq_np_wait_for_ne
|
|
||||||
EnterCriticalSection(&protseq->cs);
|
EnterCriticalSection(&protseq->cs);
|
||||||
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
|
@@ -337,7 +368,7 @@ static RPC_STATUS rpcrt4_ncacn_np_is_ser
|
||||||
while (conn) {
|
char *pipe_name;
|
||||||
- if (b_handle == conn->listen_thread) break;
|
RPC_STATUS status;
|
||||||
+ if (b_handle == conn->ovl.hEvent) break;
|
|
||||||
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
|
- pipe_name = ncacn_pipe_name(endpoint);
|
||||||
|
+ pipe_name = ncacn_pipe_name(NULL, endpoint);
|
||||||
|
status = is_pipe_listening(pipe_name);
|
||||||
|
I_RpcFree(pipe_name);
|
||||||
|
return status;
|
||||||
|
@@ -395,10 +426,14 @@ static int rpcrt4_conn_np_read(RpcConnec
|
||||||
|
if (connection->read_closed)
|
||||||
|
{
|
||||||
|
IO_STATUS_BLOCK io_status;
|
||||||
|
+#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
|
||||||
|
+ NtCancelIoFile(connection->pipe, &io_status);
|
||||||
|
+#else
|
||||||
|
NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
|
||||||
|
+#endif
|
||||||
}
|
}
|
||||||
cconn = NULL;
|
WaitForSingleObject(event, INFINITE);
|
||||||
if (conn)
|
- status = connection->io_status.Status;
|
||||||
- {
|
+ status = connection->io_status.u.Status;
|
||||||
- DWORD exit_code;
|
}
|
||||||
- if (GetExitCodeThread(conn->listen_thread, &exit_code) && exit_code == RPC_S_OK)
|
release_np_event(connection, event);
|
||||||
- RPCRT4_SpawnConnection(&cconn, &conn->common);
|
return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information;
|
||||||
- CloseHandle(conn->listen_thread);
|
@@ -419,7 +454,7 @@ static int rpcrt4_conn_np_write(RpcConne
|
||||||
- conn->listen_thread = 0;
|
if (status == STATUS_PENDING)
|
||||||
- }
|
{
|
||||||
+ RPCRT4_SpawnConnection(&cconn, &conn->common);
|
WaitForSingleObject(event, INFINITE);
|
||||||
|
- status = io_status.Status;
|
||||||
|
+ status = io_status.u.Status;
|
||||||
|
}
|
||||||
|
release_np_event(connection, event);
|
||||||
|
if (status)
|
||||||
|
@@ -457,7 +492,11 @@ static void rpcrt4_conn_np_close_read(Rp
|
||||||
|
IO_STATUS_BLOCK io_status;
|
||||||
|
|
||||||
|
connection->read_closed = TRUE;
|
||||||
|
+#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
|
||||||
|
+ NtCancelIoFile(connection->pipe, &io_status);
|
||||||
|
+#else
|
||||||
|
NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rpcrt4_conn_np_cancel_call(RpcConnection *conn)
|
||||||
|
@@ -675,7 +714,7 @@ static void *rpcrt4_protseq_np_get_wait_
|
||||||
|
{
|
||||||
|
case STATUS_SUCCESS:
|
||||||
|
case STATUS_PIPE_CONNECTED:
|
||||||
|
- conn->io_status.Status = status;
|
||||||
|
+ conn->io_status.u.Status = status;
|
||||||
|
SetEvent(event);
|
||||||
|
break;
|
||||||
|
case STATUS_PENDING:
|
||||||
|
@@ -756,10 +795,10 @@ static int rpcrt4_protseq_np_wait_for_ne
|
||||||
|
{
|
||||||
|
release_np_event(conn, conn->listen_event);
|
||||||
|
conn->listen_event = NULL;
|
||||||
|
- if (conn->io_status.Status == STATUS_SUCCESS || conn->io_status.Status == STATUS_PIPE_CONNECTED)
|
||||||
|
+ if (conn->io_status.u.Status == STATUS_SUCCESS || conn->io_status.u.Status == STATUS_PIPE_CONNECTED)
|
||||||
|
cconn = rpcrt4_spawn_connection(&conn->common);
|
||||||
else
|
else
|
||||||
ERR("failed to locate connection for handle %p\n", b_handle);
|
- ERR("listen failed %x\n", conn->io_status.Status);
|
||||||
LeaveCriticalSection(&protseq->cs);
|
+ ERR("listen failed %x\n", conn->io_status.u.Status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue