1 diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/cproxy.c e:\reactos\dll\win32\rpcrt4/cproxy.c
2 --- e:\wine\dlls\rpcrt4/cproxy.c 2016-05-31 18:02:22 +0100
3 +++ e:\reactos\dll\win32\rpcrt4/cproxy.c 2015-08-27 22:03:34 +0100
4 @@ -150,6 +150,30 @@ static inline void init_thunk( struct th
5 thunk->call_stubless = call_stubless_func;
8 +#elif defined(__arm__)
10 +extern void call_stubless_func(void);
11 +__ASM_GLOBAL_FUNC(call_stubless_func,
12 + "DCD 0xDEFC\n\t" // _assertfail
15 +#include "pshpack1.h"
22 +static const struct thunk thunk_template =
24 + { 0xDEFC } /* _assertfail */
27 +static inline void init_thunk( struct thunk *thunk, unsigned int index )
29 + *thunk = thunk_template;
34 #warning You must implement stubless proxies for your CPU
35 diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/cstub.c e:\reactos\dll\win32\rpcrt4/cstub.c
36 --- e:\wine\dlls\rpcrt4/cstub.c 2016-05-31 18:02:22 +0100
37 +++ e:\reactos\dll\win32\rpcrt4/cstub.c 2016-05-20 23:26:31 +0100
38 @@ -156,6 +156,13 @@ typedef struct
40 static const BYTE opcodes[16] = { 0x48, 0x8b, 0x49, 0x20, 0x48, 0x8b, 0x01,
41 0xff, 0xa0, 0, 0, 0, 0, 0x48, 0x8d, 0x36 };
42 +#elif defined(__arm__)
47 +static const BYTE opcodes[1];
51 #warning You must implement delegated proxies/stubs for your CPU
52 diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/rpc_epmap.c e:\reactos\dll\win32\rpcrt4/rpc_epmap.c
53 --- e:\wine\dlls\rpcrt4/rpc_epmap.c 2016-05-31 18:02:22 +0100
54 +++ e:\reactos\dll\win32\rpcrt4/rpc_epmap.c 2015-11-16 22:55:50 +0100
55 @@ -150,7 +150,7 @@ static RPC_STATUS get_epm_handle_server(
57 static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr)
59 - switch (GetExceptionCode())
60 + switch (__eptr->ExceptionRecord->ExceptionCode)
62 case EXCEPTION_ACCESS_VIOLATION:
63 case EXCEPTION_ILLEGAL_INSTRUCTION:
64 diff -pudN --strip-trailing-cr e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_transport.c
65 --- e:\wine\dlls\rpcrt4/rpc_transport.c 2016-05-31 18:02:23 +0100
66 +++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2015-11-16 22:55:50 +0100
69 #define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000)
72 #define ARRAYSIZE(a) (sizeof((a)) / sizeof((a)[0]))
74 WINE_DEFAULT_DEBUG_CHANNEL(rpc);
75 @@ -91,31 +92,41 @@ typedef struct _RpcConnection_np
79 - HANDLE listen_thread;
84 static RpcConnection *rpcrt4_conn_np_alloc(void)
86 RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_np));
90 + memset(&npc->ovl, 0, sizeof(npc->ovl));
91 + npc->listening = FALSE;
96 -static DWORD CALLBACK listen_thread(void *arg)
97 +static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
99 - RpcConnection_np *npc = arg;
100 + if (npc->listening)
103 + npc->listening = TRUE;
106 - if (ConnectNamedPipe(npc->pipe, NULL))
107 + if (ConnectNamedPipe(npc->pipe, &npc->ovl))
110 switch(GetLastError())
112 case ERROR_PIPE_CONNECTED:
113 + SetEvent(npc->ovl.hEvent);
115 + case ERROR_IO_PENDING:
116 + /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */
118 - case ERROR_HANDLES_CLOSED:
119 - /* connection closed during listen */
120 - return RPC_S_NO_CONTEXT_AVAILABLE;
121 case ERROR_NO_DATA_DETECTED:
122 /* client has disconnected, retry */
123 DisconnectNamedPipe( npc->pipe );
124 @@ -128,6 +139,7 @@ static DWORD CALLBACK listen_thread(void
129 static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
132 @@ -143,13 +155,14 @@ static RPC_STATUS rpcrt4_conn_listen_pip
138 static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname)
140 RpcConnection_np *npc = (RpcConnection_np *) Connection;
141 TRACE("listening on %s\n", pname);
143 - npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX,
144 + npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
145 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
146 PIPE_UNLIMITED_INSTANCES,
147 RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
148 @@ -161,6 +174,9 @@ static RPC_STATUS rpcrt4_conn_create_pip
149 return RPC_S_CANT_CREATE_ENDPOINT;
152 + memset(&npc->ovl, 0, sizeof(npc->ovl));
153 + npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
155 /* Note: we don't call ConnectNamedPipe here because it must be done in the
156 * server thread as the thread must be alertable */
158 @@ -207,6 +223,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
159 if (err == ERROR_PIPE_BUSY) {
160 TRACE("connection failed, error=%x\n", err);
161 return RPC_S_SERVER_TOO_BUSY;
162 + } else if (err == ERROR_BAD_NETPATH) {
163 + TRACE("connection failed, error=%x\n", err);
164 + return RPC_S_SERVER_UNAVAILABLE;
166 if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
167 err = GetLastError();
168 @@ -216,9 +235,11 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
172 + memset(&npc->ovl, 0, sizeof(npc->ovl));
173 /* pipe is connected; change to message-read mode. */
174 dwMode = PIPE_READMODE_MESSAGE;
175 SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
176 + npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
180 @@ -239,6 +260,7 @@ static char *ncalrpc_pipe_name(const cha
181 static RPC_STATUS rpcrt4_ncalrpc_open(RpcConnection* Connection)
183 RpcConnection_np *npc = (RpcConnection_np *) Connection;
184 + static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
188 @@ -246,7 +268,10 @@ static RPC_STATUS rpcrt4_ncalrpc_open(Rp
192 - pname = ncalrpc_pipe_name(Connection->Endpoint);
193 + /* protseq=ncalrpc: supposed to use NT LPC ports,
194 + * but we'll implement it with named pipes for now */
195 + pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
196 + strcat(strcpy(pname, prefix), Connection->Endpoint);
197 r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
200 @@ -255,6 +280,7 @@ static RPC_STATUS rpcrt4_ncalrpc_open(Rp
202 static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq, const char *endpoint)
204 + static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
207 RpcConnection *Connection;
208 @@ -275,7 +301,10 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
212 - pname = ncalrpc_pipe_name(Connection->Endpoint);
213 + /* protseq=ncalrpc: supposed to use NT LPC ports,
214 + * but we'll implement it with named pipes for now */
215 + pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
216 + strcat(strcpy(pname, prefix), Connection->Endpoint);
217 r = rpcrt4_conn_create_pipe(Connection, pname);
220 @@ -301,15 +330,64 @@ static char *ncacn_pipe_name(const char
221 static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
223 RpcConnection_np *npc = (RpcConnection_np *) Connection;
224 + static const char prefix[] = "\\\\";
225 + static const char local[] = ".";
226 + BOOL bUseLocalName = TRUE;
227 + CHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
228 + DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]);
234 /* already connected? */
238 - pname = ncacn_pipe_name(Connection->Endpoint);
239 - r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
240 + /* protseq=ncacn_np: named pipes */
241 + size = strlen(prefix);
243 + if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
245 + bUseLocalName = TRUE;
246 + size += strlen(local);
250 + NetworkAddr = Connection->NetworkAddr;
251 + if (NetworkAddr[0] == '\\' && NetworkAddr[1] == '\\')
254 + if (GetComputerNameA(ComputerName, &bufLen))
256 + if (stricmp(ComputerName, NetworkAddr) == 0)
258 + bUseLocalName = TRUE;
259 + size += strlen(local);
263 + bUseLocalName = FALSE;
264 + size += strlen(NetworkAddr);
269 + bUseLocalName = FALSE;
270 + size += strlen(NetworkAddr);
274 + size += strlen(Connection->Endpoint) + 1;
276 + pname = I_RpcAllocate(size);
277 + strcpy(pname, prefix);
279 + strcat(pname, local);
281 + strcat(pname, NetworkAddr);
282 + strcat(pname, Connection->Endpoint);
283 + r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
287 @@ -317,6 +395,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(R
289 static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protseq, const char *endpoint)
291 + static const char prefix[] = "\\\\.";
294 RpcConnection *Connection;
295 @@ -337,7 +416,9 @@ static RPC_STATUS rpcrt4_protseq_ncacn_n
299 - pname = ncacn_pipe_name(Connection->Endpoint);
300 + /* protseq=ncacn_np: named pipes */
301 + pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
302 + strcat(strcpy(pname, prefix), Connection->Endpoint);
303 r = rpcrt4_conn_create_pipe(Connection, pname);
306 @@ -355,9 +436,9 @@ static void rpcrt4_conn_np_handoff(RpcCo
307 * to the child, then reopen the server binding to continue listening */
309 new_npc->pipe = old_npc->pipe;
310 - new_npc->listen_thread = old_npc->listen_thread;
311 + new_npc->ovl = old_npc->ovl;
313 - old_npc->listen_thread = 0;
314 + memset(&old_npc->ovl, 0, sizeof(old_npc->ovl));
315 old_npc->listening = FALSE;
318 @@ -365,10 +446,12 @@ static RPC_STATUS rpcrt4_ncacn_np_handof
322 + static const char prefix[] = "\\\\.";
324 rpcrt4_conn_np_handoff((RpcConnection_np *)old_conn, (RpcConnection_np *)new_conn);
326 - pname = ncacn_pipe_name(old_conn->Endpoint);
327 + pname = I_RpcAllocate(strlen(prefix) + strlen(old_conn->Endpoint) + 1);
328 + strcat(strcpy(pname, prefix), old_conn->Endpoint);
329 status = rpcrt4_conn_create_pipe(old_conn, pname);
332 @@ -406,12 +489,14 @@ static RPC_STATUS rpcrt4_ncalrpc_handoff
336 + static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
338 TRACE("%s\n", old_conn->Endpoint);
340 rpcrt4_conn_np_handoff((RpcConnection_np *)old_conn, (RpcConnection_np *)new_conn);
342 - pname = ncalrpc_pipe_name(old_conn->Endpoint);
343 + pname = I_RpcAllocate(strlen(prefix) + strlen(old_conn->Endpoint) + 1);
344 + strcat(strcpy(pname, prefix), old_conn->Endpoint);
345 status = rpcrt4_conn_create_pipe(old_conn, pname);
348 @@ -425,12 +510,17 @@ static int rpcrt4_conn_np_read(RpcConnec
351 unsigned int bytes_left = count;
352 - DWORD err = GetLastError();
355 + ZeroMemory(&ovl, sizeof(ovl));
356 + ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
361 - ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
362 + ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &ovl);
363 + if (!ret && GetLastError() == ERROR_IO_PENDING)
364 + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_read, TRUE);
365 if (!ret && GetLastError() == ERROR_MORE_DATA)
367 if (!ret || !bytes_read)
368 @@ -438,7 +528,7 @@ static int rpcrt4_conn_np_read(RpcConnec
369 bytes_left -= bytes_read;
372 - if (ret) SetLastError(err);
373 + CloseHandle(ovl.hEvent);
374 return ret ? count : -1;
377 @@ -449,16 +539,23 @@ static int rpcrt4_conn_np_write(RpcConne
378 const char *buf = buffer;
380 unsigned int bytes_left = count;
383 + ZeroMemory(&ovl, sizeof(ovl));
384 + ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
389 - ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL);
390 + ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &ovl);
391 + if (!ret && GetLastError() == ERROR_IO_PENDING)
392 + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_written, TRUE);
393 if (!ret || !bytes_written)
395 bytes_left -= bytes_written;
396 buf += bytes_written;
398 + CloseHandle(ovl.hEvent);
399 return ret ? count : -1;
402 @@ -470,9 +567,9 @@ static int rpcrt4_conn_np_close(RpcConne
403 CloseHandle(npc->pipe);
406 - if (npc->listen_thread) {
407 - CloseHandle(npc->listen_thread);
408 - npc->listen_thread = 0;
409 + if (npc->ovl.hEvent) {
410 + CloseHandle(npc->ovl.hEvent);
411 + npc->ovl.hEvent = 0;
415 @@ -676,7 +773,7 @@ static void *rpcrt4_protseq_np_get_wait_
416 conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
418 rpcrt4_conn_listen_pipe(conn);
419 - if (conn->listen_thread)
420 + if (conn->ovl.hEvent)
422 conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
424 @@ -697,7 +794,7 @@ static void *rpcrt4_protseq_np_get_wait_
426 conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
428 - if ((objs[*count] = conn->listen_thread))
429 + if ((objs[*count] = conn->ovl.hEvent))
431 conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
433 @@ -744,18 +841,12 @@ static int rpcrt4_protseq_np_wait_for_ne
434 EnterCriticalSection(&protseq->cs);
435 conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
437 - if (b_handle == conn->listen_thread) break;
438 + if (b_handle == conn->ovl.hEvent) break;
439 conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
445 - if (GetExitCodeThread(conn->listen_thread, &exit_code) && exit_code == RPC_S_OK)
446 - RPCRT4_SpawnConnection(&cconn, &conn->common);
447 - CloseHandle(conn->listen_thread);
448 - conn->listen_thread = 0;
450 + RPCRT4_SpawnConnection(&cconn, &conn->common);
452 ERR("failed to locate connection for handle %p\n", b_handle);
453 LeaveCriticalSection(&protseq->cs);