2 ===================================================================
3 --- epm_towers.h (working copy)
4 +++ epm_towers.h (working copy)
6 * License along with this library; if not, write to the Free Software
7 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
14 #define EPM_PROTOCOL_DNET_NSP 0x04
15 #define EPM_PROTOCOL_OSI_TP4 0x05
16 #define EPM_PROTOCOL_OSI_CLNS 0x06
17 #define EPM_PROTOCOL_TCP 0x07
19 ===================================================================
20 --- ndr_marshall.c (working copy)
21 +++ ndr_marshall.c (working copy)
29 ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
31 ===================================================================
32 --- rpc_epmap.c (working copy)
33 +++ rpc_epmap.c (working copy)
36 #include "wine/debug.h"
37 #include "wine/exception.h"
39 #include "rpc_binding.h"
42 #include "epm_towers.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(ole);
46 /* The "real" RPC portmapper endpoints that I know of are:
48 ===================================================================
49 --- rpc_server.c (working copy)
50 +++ rpc_server.c (working copy)
51 @@ -1040,22 +1040,28 @@
52 /***********************************************************************
53 * RpcMgmtServerWaitListen (RPCRT4.@)
55 RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
58 + RpcServerProtseq *cps;
60 EnterCriticalSection(&listen_cs);
63 LeaveCriticalSection(&listen_cs);
64 return RPC_S_NOT_LISTENING;
68 LeaveCriticalSection(&listen_cs);
69 + LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
70 + WaitForSingleObject(cps->server_ready_event, INFINITE);
72 - FIXME("not waiting for server calls to finish\n");
73 + EnterCriticalSection(&listen_cs);
74 + } while (!std_listen);
76 + LeaveCriticalSection(&listen_cs);
81 /***********************************************************************
82 Index: rpc_transport.c
83 ===================================================================
84 --- rpc_transport.c (working copy)
85 +++ rpc_transport.c (working copy)
87 # include <sys/poll.h>
89 # define closesocket close
90 #endif /* defined(__MINGW32__) || defined (_MSC_VER) */
92 +#include <winsock2.h>
93 +#include <ws2tcpip.h>
101 #include "rpc_binding.h"
102 #include "rpc_message.h"
103 #include "rpc_server.h"
104 #include "epm_towers.h"
106 +#include "unix_func.h"
109 # define SOL_TCP IPPROTO_TCP
112 WINE_DEFAULT_DEBUG_CHANNEL(rpc);
115 typedef struct _RpcConnection_np
117 RpcConnection common;
124 static RpcConnection *rpcrt4_conn_np_alloc(void)
126 @@ -118,17 +123,17 @@
129 npc->listening = TRUE;
132 - if (ConnectNamedPipe(npc->pipe, &npc->ovl))
133 + if (ConnectNamedPipe(npc->pipe, &npc->ovl[0]))
136 switch(GetLastError())
138 case ERROR_PIPE_CONNECTED:
139 - SetEvent(npc->ovl.hEvent);
140 + SetEvent(npc->ovl[0].hEvent);
142 case ERROR_IO_PENDING:
143 /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */
145 case ERROR_NO_DATA_DETECTED:
146 @@ -146,11 +151,11 @@
147 static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname)
149 RpcConnection_np *npc = (RpcConnection_np *) Connection;
150 TRACE("listening on %s\n", pname);
152 - npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX,
153 + npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
154 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
155 PIPE_UNLIMITED_INSTANCES,
156 RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
157 if (npc->pipe == INVALID_HANDLE_VALUE) {
158 WARN("CreateNamedPipe failed with error %d\n", GetLastError());
159 @@ -159,11 +164,12 @@
161 return RPC_S_CANT_CREATE_ENDPOINT;
164 memset(&npc->ovl, 0, sizeof(npc->ovl));
165 - npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
166 + npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
167 + npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
169 /* Note: we don't call ConnectNamedPipe here because it must be done in the
170 * server thread as the thread must be alertable */
173 @@ -220,11 +226,12 @@
175 memset(&npc->ovl, 0, sizeof(npc->ovl));
176 /* pipe is connected; change to message-read mode. */
177 dwMode = PIPE_READMODE_MESSAGE;
178 SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
179 - npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
180 + npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
181 + npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
187 @@ -326,11 +333,12 @@
189 /* because of the way named pipes work, we'll transfer the connected pipe
190 * to the child, then reopen the server binding to continue listening */
192 new_npc->pipe = old_npc->pipe;
193 - new_npc->ovl = old_npc->ovl;
194 + new_npc->ovl[0] = old_npc->ovl[0];
195 + new_npc->ovl[1] = old_npc->ovl[1];
197 memset(&old_npc->ovl, 0, sizeof(old_npc->ovl));
198 old_npc->listening = FALSE;
201 @@ -377,13 +385,18 @@
202 unsigned int bytes_left = count;
207 - ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
208 - if (!ret || !bytes_read)
209 + ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &npc->ovl[0]);
210 + if ((!ret || !bytes_read) && (GetLastError() != ERROR_IO_PENDING))
213 + ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE);
214 + if (!ret && (GetLastError() != ERROR_MORE_DATA))
217 bytes_left -= bytes_read;
220 return ret ? count : -1;
222 @@ -397,13 +410,18 @@
223 unsigned int bytes_left = count;
228 - ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL);
229 - if (!ret || !bytes_written)
230 + ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &npc->ovl[1]);
231 + if ((!ret || !bytes_written) && (GetLastError() != ERROR_IO_PENDING))
234 + ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE);
235 + if (!ret && (GetLastError() != ERROR_MORE_DATA))
238 bytes_left -= bytes_written;
239 buf += bytes_written;
241 return ret ? count : -1;
243 @@ -414,13 +432,17 @@
245 FlushFileBuffers(npc->pipe);
246 CloseHandle(npc->pipe);
249 - if (npc->ovl.hEvent) {
250 - CloseHandle(npc->ovl.hEvent);
251 - npc->ovl.hEvent = 0;
252 + if (npc->ovl[0].hEvent) {
253 + CloseHandle(npc->ovl[0].hEvent);
254 + npc->ovl[0].hEvent = 0;
256 + if (npc->ovl[1].hEvent) {
257 + CloseHandle(npc->ovl[1].hEvent);
258 + npc->ovl[1].hEvent = 0;
263 static void rpcrt4_conn_np_cancel_call(RpcConnection *Connection)
264 @@ -579,11 +601,11 @@
265 /* open and count connections */
267 conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
269 rpcrt4_conn_listen_pipe(conn);
270 - if (conn->ovl.hEvent)
271 + if (conn->ovl[0].hEvent)
273 conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
276 /* make array of connections */
277 @@ -600,11 +622,11 @@
279 objs[0] = npps->mgr_event;
281 conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
283 - if ((objs[*count] = conn->ovl.hEvent))
284 + if ((objs[*count] = conn->ovl[0].hEvent))
286 conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
288 LeaveCriticalSection(&protseq->cs);
290 @@ -647,11 +669,11 @@
291 b_handle = objs[res - WAIT_OBJECT_0];
292 /* find which connection got a RPC */
293 EnterCriticalSection(&protseq->cs);
294 conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
296 - if (b_handle == conn->ovl.hEvent) break;
297 + if (b_handle == conn->ovl[0].hEvent) break;
298 conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
302 RPCRT4_SpawnConnection(&cconn, &conn->common);