xref: /reactos/dll/win32/rpcrt4/rpcrt4_ros.diff (revision f4d29a74)
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@@ -237,14 +258,24 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
122   return r;
123 }
124
125-static char *ncacn_pipe_name(const char *endpoint)
126+static char *ncacn_pipe_name(const char *server, const char *endpoint)
127 {
128-  static const char prefix[] = "\\\\.";
129+  static const char prefix[] = "\\\\";
130+  static const char local[] = ".";
131+  char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
132   char *pipe_name;
133+  DWORD bufLen = ARRAYSIZE(ComputerName);
134+
135+  GetComputerNameA(ComputerName, &bufLen);
136+
137+  if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0)
138+      server = local;
139
140   /* protseq=ncacn_np: named pipes */
141-  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
142-  strcat(strcpy(pipe_name, prefix), endpoint);
143+  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint));
144+  strcpy(pipe_name, prefix);
145+  strcat(pipe_name, server);
146+  strcat(pipe_name, endpoint);
147   return pipe_name;
148 }
149
150@@ -258,7 +289,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(R
151   if (npc->pipe)
152     return RPC_S_OK;
153
154-  pname = ncacn_pipe_name(Connection->Endpoint);
155+  pname = ncacn_pipe_name(Connection->NetworkAddr, Connection->Endpoint);
156   r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
157   I_RpcFree(pname);
158
159@@ -286,7 +317,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_n
160   if (r != RPC_S_OK)
161     return r;
162
163-  ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(Connection->Endpoint);
164+  ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(NULL, Connection->Endpoint);
165   r = rpcrt4_conn_create_pipe(Connection);
166
167   EnterCriticalSection(&protseq->cs);
168@@ -337,7 +368,7 @@ static RPC_STATUS rpcrt4_ncacn_np_is_ser
169   char *pipe_name;
170   RPC_STATUS status;
171
172-  pipe_name = ncacn_pipe_name(endpoint);
173+  pipe_name = ncacn_pipe_name(NULL, endpoint);
174   status = is_pipe_listening(pipe_name);
175   I_RpcFree(pipe_name);
176   return status;
177@@ -395,10 +426,14 @@ static int rpcrt4_conn_np_read(RpcConnec
178         if (connection->read_closed)
179         {
180             IO_STATUS_BLOCK io_status;
181+#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
182+            NtCancelIoFile(connection->pipe, &io_status);
183+#else
184             NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
185+#endif
186         }
187         WaitForSingleObject(event, INFINITE);
188-        status = connection->io_status.Status;
189+        status = connection->io_status.u.Status;
190     }
191     release_np_event(connection, event);
192     return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information;
193@@ -419,7 +454,7 @@ static int rpcrt4_conn_np_write(RpcConne
194     if (status == STATUS_PENDING)
195     {
196         WaitForSingleObject(event, INFINITE);
197-        status = io_status.Status;
198+        status = io_status.u.Status;
199     }
200     release_np_event(connection, event);
201     if (status)
202@@ -457,7 +492,11 @@ static void rpcrt4_conn_np_close_read(Rp
203     IO_STATUS_BLOCK io_status;
204
205     connection->read_closed = TRUE;
206+#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
207+    NtCancelIoFile(connection->pipe, &io_status);
208+#else
209     NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
210+#endif
211 }
212
213 static void rpcrt4_conn_np_cancel_call(RpcConnection *conn)
214@@ -675,7 +714,7 @@ static void *rpcrt4_protseq_np_get_wait_
215             {
216             case STATUS_SUCCESS:
217             case STATUS_PIPE_CONNECTED:
218-                conn->io_status.Status = status;
219+                conn->io_status.u.Status = status;
220                 SetEvent(event);
221                 break;
222             case STATUS_PENDING:
223@@ -756,10 +795,10 @@ static int rpcrt4_protseq_np_wait_for_ne
224             {
225                 release_np_event(conn, conn->listen_event);
226                 conn->listen_event = NULL;
227-                if (conn->io_status.Status == STATUS_SUCCESS || conn->io_status.Status == STATUS_PIPE_CONNECTED)
228+                if (conn->io_status.u.Status == STATUS_SUCCESS || conn->io_status.u.Status == STATUS_PIPE_CONNECTED)
229                     cconn = rpcrt4_spawn_connection(&conn->common);
230                 else
231-                    ERR("listen failed %x\n", conn->io_status.Status);
232+                    ERR("listen failed %x\n", conn->io_status.u.Status);
233                 break;
234             }
235         }
236