[LT2013]
[reactos.git] / dll / win32 / rpcrt4 / rpcrt4_ros.diff
1 Index: epm_towers.h
2 ===================================================================
3 --- epm_towers.h (working copy)
4 +++ epm_towers.h (working copy)
5 @@ -19,7 +19,7 @@
6 *
7 */
8
9 -#include "epm.h"
10 +#include "epm_c.h"
11
12 #define EPM_PROTOCOL_DNET_NSP 0x04
13 #define EPM_PROTOCOL_OSI_TP4 0x05
14 Index: ndr_marshall.c
15 ===================================================================
16 --- ndr_marshall.c (working copy)
17 +++ ndr_marshall.c (working copy)
18 @@ -6159,6 +6159,7 @@ static LONG unmarshall_discriminant(PMID
19 case RPC_FC_WCHAR:
20 case RPC_FC_SHORT:
21 case RPC_FC_USHORT:
22 + case RPC_FC_ENUM16:
23 {
24 USHORT d;
25 align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
26 Index: ndr_stubless.c
27 ===================================================================
28 --- ndr_stubless.c (working copy)
29 +++ ndr_stubless.c (working copy)
30 @@ -981,11 +981,12 @@ __declspec(naked) LONG_PTR __cdecl call_
31 __asm
32 {
33 push ebp
34 + mov ebp, esp
35 push edi ; Save registers
36 push esi
37 - mov ebp, esp
38 mov eax, [ebp+16] ; Get stack size
39 sub esp, eax ; Make room in stack for arguments
40 + and esp, 0xFFFFFFF0
41 mov edi, esp
42 mov ecx, eax
43 mov esi, [ebp+12]
44 Index: rpc_epmap.c
45 ===================================================================
46 --- rpc_epmap.c (working copy)
47 +++ rpc_epmap.c (working copy)
48 @@ -32,7 +32,7 @@
49 #include "wine/exception.h"
50
51 #include "rpc_binding.h"
52 -#include "epm.h"
53 +#include "epm_c.h"
54 #include "epm_towers.h"
55
56 WINE_DEFAULT_DEBUG_CHANNEL(ole);
57 @@ -162,7 +162,7 @@ static RPC_STATUS get_epm_handle_server(
58
59 static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr)
60 {
61 - switch (GetExceptionCode())
62 + switch (__eptr->ExceptionRecord->ExceptionCode)
63 {
64 case EXCEPTION_ACCESS_VIOLATION:
65 case EXCEPTION_ILLEGAL_INSTRUCTION:
66 Index: rpc_server.c
67 ===================================================================
68 --- rpc_server.c (working copy)
69 +++ rpc_server.c (working copy)
70 @@ -1071,8 +1071,6 @@ void RPCRT4_destroy_all_protseqs(void)
71 EnterCriticalSection(&server_cs);
72 LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry)
73 {
74 - if (listen_count != 0)
75 - RPCRT4_sync_with_server_thread(cps);
76 destroy_serverprotoseq(cps);
77 }
78 LeaveCriticalSection(&server_cs);
79 Index: rpc_transport.c
80 ===================================================================
81 --- rpc_transport.c (working copy)
82 +++ rpc_transport.c (working copy)
83 @@ -224,6 +224,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
84 if (err == ERROR_PIPE_BUSY) {
85 TRACE("connection failed, error=%x\n", err);
86 return RPC_S_SERVER_TOO_BUSY;
87 + } else if (err == ERROR_BAD_NETPATH) {
88 + TRACE("connection failed, error=%x\n", err);
89 + return RPC_S_SERVER_UNAVAILABLE;
90 }
91 if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
92 err = GetLastError();
93 @@ -305,18 +308,32 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
94 static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
95 {
96 RpcConnection_np *npc = (RpcConnection_np *) Connection;
97 - static const char prefix[] = "\\\\.";
98 + static const char prefix[] = "\\\\";
99 + static const char local[] =".";
100 RPC_STATUS r;
101 LPSTR pname;
102 + INT size;
103
104 /* already connected? */
105 if (npc->pipe)
106 return RPC_S_OK;
107
108 /* protseq=ncacn_np: named pipes */
109 - pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
110 - strcat(strcpy(pname, prefix), Connection->Endpoint);
111 - r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
112 + size = strlen(prefix);
113 + if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
114 + size += strlen(local);
115 + else
116 + size += strlen(Connection->NetworkAddr);
117 + size += strlen(Connection->Endpoint) + 1;
118 +
119 + pname = I_RpcAllocate(size);
120 + strcpy(pname, prefix);
121 + if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
122 + strcat(pname, local);
123 + else
124 + strcat(pname, Connection->NetworkAddr);
125 + strcat(pname, Connection->Endpoint);
126 + r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
127 I_RpcFree(pname);
128
129 return r;
130 @@ -412,11 +429,17 @@ static int rpcrt4_conn_np_read(RpcConnec
131 char *buf = buffer;
132 BOOL ret = TRUE;
133 unsigned int bytes_left = count;
134 + OVERLAPPED ovl;
135 +
136 + ZeroMemory(&ovl, sizeof(ovl));
137 + ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
138
139 while (bytes_left)
140 {
141 DWORD bytes_read;
142 - ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
143 + ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &ovl);
144 + if (!ret && GetLastError() == ERROR_IO_PENDING)
145 + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_read, TRUE);
146 if (!ret && GetLastError() == ERROR_MORE_DATA)
147 ret = TRUE;
148 if (!ret || !bytes_read)
149 @@ -424,6 +447,7 @@ static int rpcrt4_conn_np_read(RpcConnec
150 bytes_left -= bytes_read;
151 buf += bytes_read;
152 }
153 + CloseHandle(ovl.hEvent);
154 return ret ? count : -1;
155 }
156
157 @@ -434,16 +458,23 @@ static int rpcrt4_conn_np_write(RpcConne
158 const char *buf = buffer;
159 BOOL ret = TRUE;
160 unsigned int bytes_left = count;
161 + OVERLAPPED ovl;
162 +
163 + ZeroMemory(&ovl, sizeof(ovl));
164 + ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
165
166 while (bytes_left)
167 {
168 DWORD bytes_written;
169 - ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL);
170 + ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &ovl);
171 + if (!ret && GetLastError() == ERROR_IO_PENDING)
172 + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_written, TRUE);
173 if (!ret || !bytes_written)
174 break;
175 bytes_left -= bytes_written;
176 buf += bytes_written;
177 }
178 + CloseHandle(ovl.hEvent);
179 return ret ? count : -1;
180 }
181
182 Index: rpcrt4.spec
183 ===================================================================
184 --- rpcrt4.spec (working copy)
185 +++ rpcrt4.spec (working copy)
186 @@ -53,7 +53,7 @@
187 @ stub I_RpcIfInqTransferSyntaxes
188 @ stub I_RpcLogEvent
189 @ stdcall I_RpcMapWin32Status(long)
190 -@ stub I_RpcNegotiateTransferSyntax # wxp
191 +@ stdcall I_RpcNegotiateTransferSyntax(ptr)
192 @ stub I_RpcNsBindingSetEntryName
193 @ stub I_RpcNsBindingSetEntryNameA
194 @ stub I_RpcNsBindingSetEntryNameW
195 @@ -266,7 +266,7 @@
196 @ stdcall NdrRangeUnmarshall(ptr ptr ptr long)
197 @ stub NdrRpcSmClientAllocate
198 @ stub NdrRpcSmClientFree
199 -@ stub NdrRpcSmSetClientToOsf
200 +@ stdcall NdrRpcSmSetClientToOsf(ptr)
201 @ stub NdrRpcSsDefaultAllocate
202 @ stub NdrRpcSsDefaultFree
203 @ stub NdrRpcSsDisableAllocate