mirror of
https://github.com/reactos/reactos.git
synced 2024-10-24 23:11:33 +00:00
527f2f9057
* Create a branch for some evul shell experiments. svn path=/branches/shell-experiments/; revision=61927
339 lines
12 KiB
Diff
339 lines
12 KiB
Diff
diff -prudN e:\Wine\dlls\rpcrt4/epm_towers.h e:\reactos\dll\win32\rpcrt4/epm_towers.h
|
|
--- e:\Wine\dlls\rpcrt4/epm_towers.h 2011-09-16 23:22:37.031828000 +0100
|
|
+++ e:\reactos\dll\win32\rpcrt4/epm_towers.h 2013-01-25 14:13:03.257632500 +0100
|
|
@@ -19,7 +19,7 @@
|
|
*
|
|
*/
|
|
|
|
-#include "epm.h"
|
|
+#include <epm_c.h>
|
|
|
|
#define EPM_PROTOCOL_DNET_NSP 0x04
|
|
#define EPM_PROTOCOL_OSI_TP4 0x05
|
|
diff -prudN e:\Wine\dlls\rpcrt4/ndr_marshall.c e:\reactos\dll\win32\rpcrt4/ndr_marshall.c
|
|
--- e:\Wine\dlls\rpcrt4/ndr_marshall.c 2012-04-02 20:39:58.270363100 +0100
|
|
+++ e:\reactos\dll\win32\rpcrt4/ndr_marshall.c 2013-12-06 20:04:02.897835300 +0100
|
|
@@ -1211,7 +1211,7 @@ static unsigned char * EmbeddedPointerMa
|
|
unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
|
|
unsigned char *saved_memory = pStubMsg->Memory;
|
|
|
|
- pStubMsg->Memory = pMemory;
|
|
+ pStubMsg->Memory = membase;
|
|
PointerMarshall(pStubMsg, bufptr, *(unsigned char**)memptr, info+4);
|
|
pStubMsg->Memory = saved_memory;
|
|
}
|
|
@@ -1365,7 +1365,7 @@ static void EmbeddedPointerBufferSize(PM
|
|
unsigned char *memptr = membase + *(const SHORT*)&info[0];
|
|
unsigned char *saved_memory = pStubMsg->Memory;
|
|
|
|
- pStubMsg->Memory = pMemory;
|
|
+ pStubMsg->Memory = membase;
|
|
PointerBufferSize(pStubMsg, *(unsigned char**)memptr, info+4);
|
|
pStubMsg->Memory = saved_memory;
|
|
}
|
|
diff -prudN e:\Wine\dlls\rpcrt4/rpc_epmap.c e:\reactos\dll\win32\rpcrt4/rpc_epmap.c
|
|
--- e:\Wine\dlls\rpcrt4/rpc_epmap.c 2013-03-02 14:18:00.736492500 +0100
|
|
+++ e:\reactos\dll\win32\rpcrt4/rpc_epmap.c 2013-12-06 20:28:21.361553600 +0100
|
|
@@ -162,7 +169,7 @@ static RPC_STATUS get_epm_handle_server(
|
|
|
|
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr)
|
|
{
|
|
- switch (GetExceptionCode())
|
|
+ switch (__eptr->ExceptionRecord->ExceptionCode)
|
|
{
|
|
case EXCEPTION_ACCESS_VIOLATION:
|
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
|
diff -prudN e:\Wine\dlls\rpcrt4/rpc_server.c e:\reactos\dll\win32\rpcrt4/rpc_server.c
|
|
--- e:\Wine\dlls\rpcrt4/rpc_server.c 2012-12-09 09:57:02.680308600 +0100
|
|
+++ e:\reactos\dll\win32\rpcrt4/rpc_server.c 2013-12-06 23:50:04.564226300 +0100
|
|
@@ -1075,8 +1077,10 @@ void RPCRT4_destroy_all_protseqs(void)
|
|
EnterCriticalSection(&server_cs);
|
|
LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry)
|
|
{
|
|
+#ifndef __REACTOS__
|
|
if (listen_count != 0)
|
|
RPCRT4_sync_with_server_thread(cps);
|
|
+#endif
|
|
destroy_serverprotoseq(cps);
|
|
}
|
|
LeaveCriticalSection(&server_cs);
|
|
diff -prudN e:\Wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_transport.c
|
|
--- e:\Wine\dlls\rpcrt4/rpc_transport.c 2013-12-06 20:10:59.302378700 +0100
|
|
+++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2013-12-06 23:39:38.664465200 +0100
|
|
@@ -111,31 +115,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)
|
|
{
|
|
RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_np));
|
|
+ if (npc)
|
|
+ {
|
|
+ npc->pipe = NULL;
|
|
+ memset(&npc->ovl, 0, sizeof(npc->ovl));
|
|
+ npc->listening = FALSE;
|
|
+ }
|
|
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 );
|
|
@@ -148,28 +162,12 @@ static DWORD CALLBACK listen_thread(void
|
|
}
|
|
}
|
|
|
|
-static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
|
|
-{
|
|
- if (npc->listening)
|
|
- return RPC_S_OK;
|
|
-
|
|
- npc->listening = TRUE;
|
|
- npc->listen_thread = CreateThread(NULL, 0, listen_thread, npc, 0, NULL);
|
|
- if (!npc->listen_thread)
|
|
- {
|
|
- npc->listening = FALSE;
|
|
- ERR("Couldn't create listen thread (error was %d)\n", GetLastError());
|
|
- return RPC_S_OUT_OF_RESOURCES;
|
|
- }
|
|
- return RPC_S_OK;
|
|
-}
|
|
-
|
|
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);
|
|
@@ -181,6 +179,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
|
|
* server thread as the thread must be alertable */
|
|
return RPC_S_OK;
|
|
@@ -227,6 +228,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
|
|
if (err == ERROR_PIPE_BUSY) {
|
|
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();
|
|
@@ -236,9 +240,11 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
|
|
}
|
|
|
|
/* success */
|
|
+ memset(&npc->ovl, 0, sizeof(npc->ovl));
|
|
/* 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;
|
|
@@ -306,18 +312,32 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
|
|
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 local[] =".";
|
|
RPC_STATUS r;
|
|
LPSTR pname;
|
|
+ INT size;
|
|
|
|
/* already connected? */
|
|
if (npc->pipe)
|
|
return RPC_S_OK;
|
|
|
|
/* protseq=ncacn_np: named pipes */
|
|
- pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
|
|
- strcat(strcpy(pname, prefix), Connection->Endpoint);
|
|
- r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
|
|
+ size = strlen(prefix);
|
|
+ if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
|
|
+ size += strlen(local);
|
|
+ else
|
|
+ size += strlen(Connection->NetworkAddr);
|
|
+ size += strlen(Connection->Endpoint) + 1;
|
|
+
|
|
+ pname = I_RpcAllocate(size);
|
|
+ strcpy(pname, prefix);
|
|
+ if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
|
|
+ strcat(pname, local);
|
|
+ else
|
|
+ strcat(pname, Connection->NetworkAddr);
|
|
+ strcat(pname, Connection->Endpoint);
|
|
+ r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
|
|
I_RpcFree(pname);
|
|
|
|
return r;
|
|
@@ -366,9 +386,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;
|
|
- new_npc->listen_thread = old_npc->listen_thread;
|
|
+ new_npc->ovl = old_npc->ovl;
|
|
old_npc->pipe = 0;
|
|
- old_npc->listen_thread = 0;
|
|
+ memset(&old_npc->ovl, 0, sizeof(old_npc->ovl));
|
|
old_npc->listening = FALSE;
|
|
}
|
|
|
|
@@ -413,11 +433,17 @@ static int rpcrt4_conn_np_read(RpcConnec
|
|
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_read;
|
|
- ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
|
|
+ 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)
|
|
@@ -425,6 +451,7 @@ static int rpcrt4_conn_np_read(RpcConnec
|
|
bytes_left -= bytes_read;
|
|
buf += bytes_read;
|
|
}
|
|
+ CloseHandle(ovl.hEvent);
|
|
return ret ? count : -1;
|
|
}
|
|
|
|
@@ -435,16 +462,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;
|
|
}
|
|
|
|
@@ -456,9 +490,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;
|
|
}
|
|
@@ -662,7 +696,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);
|
|
}
|
|
@@ -683,7 +717,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);
|
|
}
|
|
@@ -730,18 +764,12 @@ static int rpcrt4_protseq_np_wait_for_ne
|
|
EnterCriticalSection(&protseq->cs);
|
|
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
|
|
while (conn) {
|
|
- if (b_handle == conn->listen_thread) break;
|
|
+ if (b_handle == conn->ovl.hEvent) break;
|
|
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
|
|
}
|
|
cconn = NULL;
|
|
if (conn)
|
|
- {
|
|
- DWORD exit_code;
|
|
- if (GetExitCodeThread(conn->listen_thread, &exit_code) && exit_code == RPC_S_OK)
|
|
- RPCRT4_SpawnConnection(&cconn, &conn->common);
|
|
- CloseHandle(conn->listen_thread);
|
|
- conn->listen_thread = 0;
|
|
- }
|
|
+ RPCRT4_SpawnConnection(&cconn, &conn->common);
|
|
else
|
|
ERR("failed to locate connection for handle %p\n", b_handle);
|
|
LeaveCriticalSection(&protseq->cs);
|
|
diff -prudN e:\Wine\dlls\rpcrt4/rpcrt4.spec e:\reactos\dll\win32\rpcrt4/rpcrt4.spec
|
|
--- e:\Wine\dlls\rpcrt4/rpcrt4.spec 2012-09-09 19:47:53.677232900 +0100
|
|
+++ e:\reactos\dll\win32\rpcrt4/rpcrt4.spec 2013-12-06 20:29:09.804227500 +0100
|
|
@@ -266,7 +266,7 @@
|
|
@ stdcall NdrRangeUnmarshall(ptr ptr ptr long)
|
|
@ stub NdrRpcSmClientAllocate
|
|
@ stub NdrRpcSmClientFree
|
|
-@ stub NdrRpcSmSetClientToOsf
|
|
+@ stdcall NdrRpcSmSetClientToOsf(ptr)
|
|
@ stub NdrRpcSsDefaultAllocate
|
|
@ stub NdrRpcSsDefaultFree
|
|
@ stub NdrRpcSsDisableAllocate
|