1diff -pudN e:\wine\dlls\rpcrt4/cproxy.c e:\reactos\dll\win32\rpcrt4/cproxy.c 2--- e:\wine\dlls\rpcrt4/cproxy.c 2016-11-16 17:29:34 +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; 6 } 7 8+#elif defined(__arm__) 9+ 10+extern void call_stubless_func(void); 11+__ASM_GLOBAL_FUNC(call_stubless_func, 12+ "DCD 0xDEFC\n\t" // _assertfail 13+ "" ); 14+ 15+#include "pshpack1.h" 16+struct thunk 17+{ 18+ DWORD assertfail; 19+}; 20+#include "poppack.h" 21+ 22+static const struct thunk thunk_template = 23+{ 24+ { 0xDEFC } /* _assertfail */ 25+}; 26+ 27+static inline void init_thunk( struct thunk *thunk, unsigned int index ) 28+{ 29+ *thunk = thunk_template; 30+} 31+ 32 #else /* __i386__ */ 33 34 #warning You must implement stubless proxies for your CPU 35diff -pudN e:\wine\dlls\rpcrt4/cstub.c e:\reactos\dll\win32\rpcrt4/cstub.c 36--- e:\wine\dlls\rpcrt4/cstub.c 2016-11-16 17:29:34 +0100 37+++ e:\reactos\dll\win32\rpcrt4/cstub.c 2016-05-20 23:26:31 +0100 38@@ -156,6 +156,13 @@ typedef struct 39 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__) 43+typedef struct 44+{ 45+ DWORD offset; 46+} vtbl_method_t; 47+static const BYTE opcodes[1]; 48+ 49 #else 50 51 #warning You must implement delegated proxies/stubs for your CPU 52 53diff -pudN e:\wine\dlls\rpcrt4/rpc_epmap.c e:\reactos\dll\win32\rpcrt4/rpc_epmap.c 54--- e:\wine\dlls\rpcrt4/rpc_epmap.c 2016-11-16 17:29:34 +0100 55+++ e:\reactos\dll\win32\rpcrt4/rpc_epmap.c 2016-11-17 12:09:06 +0100 56@@ -171,7 +173,7 @@ static RPC_STATUS get_epm_handle_server( 57 58 static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr) 59 { 60- switch (GetExceptionCode()) 61+ switch (__eptr->ExceptionRecord->ExceptionCode) 62 { 63 case EXCEPTION_ACCESS_VIOLATION: 64 case EXCEPTION_ILLEGAL_INSTRUCTION: 65diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_transport.c 66--- e:\wine\dlls\rpcrt4/rpc_transport.c 2018-07-28 18:12:19 +0000 67+++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2018-07-28 18:28:54 +0000 68@@ -25,6 +25,9 @@ 69 70 #include "ntstatus.h" 71 #define WIN32_NO_STATUS 72+#ifdef __REACTOS__ 73+#define NONAMELESSUNION 74+#endif 75 #include "ws2tcpip.h" 76 77 #include <stdarg.h> 78@@ -32,12 +35,14 @@ 79 #include <string.h> 80 #include <assert.h> 81 82+ 83+ 84 #include "windef.h" 85 #include "winbase.h" 86 #include "winnls.h" 87 #include "winerror.h" 88 #include "wininet.h" 89-#include "winternl.h" 90+#include "wine/winternl.h" 91 #include "winioctl.h" 92 #include "wine/unicode.h" 93 94@@ -54,10 +59,26 @@ 95 96 #define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000) 97 98+#undef ARRAYSIZE 99 #define ARRAYSIZE(a) (sizeof((a)) / sizeof((a)[0])) 100 101 WINE_DEFAULT_DEBUG_CHANNEL(rpc); 102 103+#ifdef __REACTOS__ /* FIXME: Inspect */ 104+BOOL WINAPI CancelIoEx(HANDLE handle, LPOVERLAPPED lpOverlapped) 105+{ 106+ IO_STATUS_BLOCK io_status; 107+ 108+ NtCancelIoFile(handle, &io_status); 109+ if (io_status.u.Status) 110+ { 111+ SetLastError( RtlNtStatusToDosError( io_status.u.Status ) ); 112+ return FALSE; 113+ } 114+ return TRUE; 115+} 116+#endif 117+ 118 static RpcConnection *rpcrt4_spawn_connection(RpcConnection *old_connection); 119 120 /**** ncacn_np support ****/ 121@@ -174,6 +174,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname, 122 } 123 TRACE("connection failed, error=%x\n", err); 124 return RPC_S_SERVER_TOO_BUSY; 125+ } else if (err == ERROR_BAD_NETPATH) { 126+ TRACE("connection failed, error=%x\n", err); 127+ return RPC_S_SERVER_UNAVAILABLE; 128 } 129 if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { 130 err = GetLastError(); 131@@ -237,14 +258,24 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc 132 return r; 133 } 134 135-static char *ncacn_pipe_name(const char *endpoint) 136+static char *ncacn_pipe_name(const char *server, const char *endpoint) 137 { 138- static const char prefix[] = "\\\\."; 139+ static const char prefix[] = "\\\\"; 140+ static const char local[] = "."; 141+ char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; 142+ DWORD bufLen = ARRAY_SIZE(ComputerName); 143 char *pipe_name; 144+ 145+ if (server != NULL && *server != 0) 146+ { 147+ /* Trim any leading UNC server prefix. */ 148+ if (server[0] == '\\' && server[1] == '\\') 149+ server += 2; 150+ 151+ /* If the server represents the local computer, use instead 152+ * the local prefix to avoid a round in UNC name resolution. */ 153+ if (GetComputerNameA(ComputerName, &bufLen) && 154+ (stricmp(ComputerName, server) == 0)) 155+ { 156+ server = local; 157+ } 158+ } 159+ else 160+ { 161+ server = local; 162+ } 163 164 /* protseq=ncacn_np: named pipes */ 165- pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint)); 166- strcat(strcpy(pipe_name, prefix), endpoint); 167+ pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint)); 168+ strcpy(pipe_name, prefix); 169+ strcat(pipe_name, server); 170+ strcat(pipe_name, endpoint); 171 return pipe_name; 172 } 173 174@@ -258,7 +289,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(R 175 if (npc->pipe) 176 return RPC_S_OK; 177 178- pname = ncacn_pipe_name(Connection->Endpoint); 179+ pname = ncacn_pipe_name(Connection->NetworkAddr, Connection->Endpoint); 180 r = rpcrt4_conn_open_pipe(Connection, pname, FALSE); 181 I_RpcFree(pname); 182 183@@ -286,7 +317,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_n 184 if (r != RPC_S_OK) 185 return r; 186 187- ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(Connection->Endpoint); 188+ ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(NULL, Connection->Endpoint); 189 r = rpcrt4_conn_create_pipe(Connection); 190 191 EnterCriticalSection(&protseq->cs); 192@@ -337,7 +368,7 @@ static RPC_STATUS rpcrt4_ncacn_np_is_ser 193 char *pipe_name; 194 RPC_STATUS status; 195 196- pipe_name = ncacn_pipe_name(endpoint); 197+ pipe_name = ncacn_pipe_name(NULL, endpoint); 198 status = is_pipe_listening(pipe_name); 199 I_RpcFree(pipe_name); 200 return status; 201@@ -395,10 +426,14 @@ static int rpcrt4_conn_np_read(RpcConnec 202 if (connection->read_closed) 203 { 204 IO_STATUS_BLOCK io_status; 205+#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */ 206+ NtCancelIoFile(connection->pipe, &io_status); 207+#else 208 NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status); 209+#endif 210 } 211 WaitForSingleObject(event, INFINITE); 212- status = connection->io_status.Status; 213+ status = connection->io_status.u.Status; 214 } 215 release_np_event(connection, event); 216 return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information; 217@@ -419,7 +454,7 @@ static int rpcrt4_conn_np_write(RpcConne 218 if (status == STATUS_PENDING) 219 { 220 WaitForSingleObject(event, INFINITE); 221- status = io_status.Status; 222+ status = io_status.u.Status; 223 } 224 release_np_event(connection, event); 225 if (status) 226@@ -457,7 +492,11 @@ static void rpcrt4_conn_np_close_read(Rp 227 IO_STATUS_BLOCK io_status; 228 229 connection->read_closed = TRUE; 230+#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */ 231+ NtCancelIoFile(connection->pipe, &io_status); 232+#else 233 NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status); 234+#endif 235 } 236 237 static void rpcrt4_conn_np_cancel_call(RpcConnection *conn) 238@@ -675,7 +714,7 @@ static void *rpcrt4_protseq_np_get_wait_ 239 { 240 case STATUS_SUCCESS: 241 case STATUS_PIPE_CONNECTED: 242- conn->io_status.Status = status; 243+ conn->io_status.u.Status = status; 244 SetEvent(event); 245 break; 246 case STATUS_PENDING: 247@@ -756,10 +795,10 @@ static int rpcrt4_protseq_np_wait_for_ne 248 { 249 release_np_event(conn, conn->listen_event); 250 conn->listen_event = NULL; 251- if (conn->io_status.Status == STATUS_SUCCESS || conn->io_status.Status == STATUS_PIPE_CONNECTED) 252+ if (conn->io_status.u.Status == STATUS_SUCCESS || conn->io_status.u.Status == STATUS_PIPE_CONNECTED) 253 cconn = rpcrt4_spawn_connection(&conn->common); 254 else 255- ERR("listen failed %x\n", conn->io_status.Status); 256+ ERR("listen failed %x\n", conn->io_status.u.Status); 257 break; 258 } 259 } 260@@ -1257,6 +1257,18 @@ static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned char *tower_data, 261 hints.ai_canonname = NULL; 262 hints.ai_next = NULL; 263 264+#ifdef __REACTOS__ 265+ static BOOL wsa_inited; 266+ if (!wsa_inited) 267+ { 268+ WSADATA wsadata; 269+ WSAStartup(MAKEWORD(2, 2), &wsadata); 270+ /* Note: WSAStartup can be called more than once so we don't bother with 271+ * making accesses to wsa_inited thread-safe */ 272+ wsa_inited = TRUE; 273+ } 274+#endif 275+ 276 ret = getaddrinfo(networkaddr, endpoint, &hints, &ai); 277 if (ret) 278 { 279