- Make rpcrt4_ros.diff actually reflect our difference to Wine

svn path=/trunk/; revision=57363
This commit is contained in:
Thomas Faber 2012-09-22 11:08:44 +00:00
parent c721fa52d8
commit 96ee78be1e

View file

@ -2,9 +2,7 @@ Index: epm_towers.h
=================================================================== ===================================================================
--- epm_towers.h (working copy) --- epm_towers.h (working copy)
+++ epm_towers.h (working copy) +++ epm_towers.h (working copy)
@@ -17,11 +17,11 @@ @@ -19,7 +19,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* *
*/ */
@ -13,27 +11,41 @@ Index: epm_towers.h
#define EPM_PROTOCOL_DNET_NSP 0x04 #define EPM_PROTOCOL_DNET_NSP 0x04
#define EPM_PROTOCOL_OSI_TP4 0x05 #define EPM_PROTOCOL_OSI_TP4 0x05
#define EPM_PROTOCOL_OSI_CLNS 0x06
#define EPM_PROTOCOL_TCP 0x07
Index: ndr_marshall.c Index: ndr_marshall.c
=================================================================== ===================================================================
--- ndr_marshall.c (working copy) --- ndr_marshall.c (working copy)
+++ ndr_marshall.c (working copy) +++ ndr_marshall.c (working copy)
@@ -6032,6 +6032,7 @@ @@ -6159,6 +6159,7 @@ static LONG unmarshall_discriminant(PMID
case RPC_FC_WCHAR: case RPC_FC_WCHAR:
case RPC_FC_SHORT: case RPC_FC_SHORT:
case RPC_FC_USHORT: case RPC_FC_USHORT:
+ case RPC_FC_ENUM16: + case RPC_FC_ENUM16:
{ {
USHORT d; USHORT d;
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
Index: ndr_stubless.c
===================================================================
--- ndr_stubless.c (working copy)
+++ ndr_stubless.c (working copy)
@@ -981,11 +981,12 @@ __declspec(naked) LONG_PTR __cdecl call_
__asm
{
push ebp
+ mov ebp, esp
push edi ; Save registers
push esi
- mov ebp, esp
mov eax, [ebp+16] ; Get stack size
sub esp, eax ; Make room in stack for arguments
+ and esp, 0xFFFFFFF0
mov edi, esp
mov ecx, eax
mov esi, [ebp+12]
Index: rpc_epmap.c Index: rpc_epmap.c
=================================================================== ===================================================================
--- rpc_epmap.c (working copy) --- rpc_epmap.c (working copy)
+++ rpc_epmap.c (working copy) +++ rpc_epmap.c (working copy)
@@ -30,11 +30,11 @@ @@ -32,7 +32,7 @@
#include "wine/debug.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "rpc_binding.h" #include "rpc_binding.h"
@ -42,261 +54,154 @@ Index: rpc_epmap.c
#include "epm_towers.h" #include "epm_towers.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -162,7 +162,7 @@ static RPC_STATUS get_epm_handle_server(
/* The "real" RPC portmapper endpoints that I know of are: static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr)
{
- switch (GetExceptionCode())
+ switch (__eptr->ExceptionRecord->ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
case EXCEPTION_ILLEGAL_INSTRUCTION:
Index: rpc_server.c Index: rpc_server.c
=================================================================== ===================================================================
--- rpc_server.c (working copy) --- rpc_server.c (working copy)
+++ rpc_server.c (working copy) +++ rpc_server.c (working copy)
@@ -1040,22 +1040,28 @@ @@ -1071,8 +1071,6 @@ void RPCRT4_destroy_all_protseqs(void)
/*********************************************************************** EnterCriticalSection(&server_cs);
* RpcMgmtServerWaitListen (RPCRT4.@) LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry)
*/ {
RPC_STATUS WINAPI RpcMgmtWaitServerListen( void ) - if (listen_count != 0)
{ - RPCRT4_sync_with_server_thread(cps);
- TRACE("()\n"); destroy_serverprotoseq(cps);
+ RpcServerProtseq *cps; }
LeaveCriticalSection(&server_cs);
EnterCriticalSection(&listen_cs);
if (!std_listen) {
LeaveCriticalSection(&listen_cs);
return RPC_S_NOT_LISTENING;
}
+ do {
LeaveCriticalSection(&listen_cs);
+ LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
+ WaitForSingleObject(cps->server_ready_event, INFINITE);
- FIXME("not waiting for server calls to finish\n");
+ EnterCriticalSection(&listen_cs);
+ } while (!std_listen);
+
+ LeaveCriticalSection(&listen_cs);
return RPC_S_OK;
}
/***********************************************************************
Index: rpc_transport.c Index: rpc_transport.c
=================================================================== ===================================================================
--- rpc_transport.c (working copy) --- rpc_transport.c (working copy)
+++ rpc_transport.c (working copy) +++ rpc_transport.c (working copy)
@@ -65,10 +65,13 @@ @@ -224,6 +224,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
# include <sys/poll.h> if (err == ERROR_PIPE_BUSY) {
# endif TRACE("connection failed, error=%x\n", err);
# define closesocket close return RPC_S_SERVER_TOO_BUSY;
#endif /* defined(__MINGW32__) || defined (_MSC_VER) */ + } else if (err == ERROR_BAD_NETPATH) {
+ TRACE("connection failed, error=%x\n", err);
+#include <winsock2.h> + return RPC_S_SERVER_UNAVAILABLE;
+#include <ws2tcpip.h> }
+ if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
#include "windef.h" err = GetLastError();
#include "winbase.h" @@ -305,18 +308,32 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
#include "winnls.h" static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
#include "winerror.h"
#include "winternl.h"
@@ -82,10 +85,12 @@
#include "rpc_binding.h"
#include "rpc_message.h"
#include "rpc_server.h"
#include "epm_towers.h"
+#include "unix_func.h"
+
#ifndef SOL_TCP
# define SOL_TCP IPPROTO_TCP
#endif
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
@@ -94,11 +99,11 @@
typedef struct _RpcConnection_np
{
RpcConnection common;
HANDLE pipe;
- OVERLAPPED ovl;
+ OVERLAPPED ovl[2];
BOOL listening;
} RpcConnection_np;
static RpcConnection *rpcrt4_conn_np_alloc(void)
{
@@ -118,17 +123,17 @@
return RPC_S_OK;
npc->listening = TRUE;
for (;;)
{
- if (ConnectNamedPipe(npc->pipe, &npc->ovl))
+ if (ConnectNamedPipe(npc->pipe, &npc->ovl[0]))
return RPC_S_OK;
switch(GetLastError())
{
case ERROR_PIPE_CONNECTED:
- SetEvent(npc->ovl.hEvent);
+ SetEvent(npc->ovl[0].hEvent);
return RPC_S_OK;
case ERROR_IO_PENDING:
/* will be completed in rpcrt4_protseq_np_wait_for_new_connection */
return RPC_S_OK;
case ERROR_NO_DATA_DETECTED:
@@ -146,11 +151,11 @@
static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname)
{ {
RpcConnection_np *npc = (RpcConnection_np *) Connection; RpcConnection_np *npc = (RpcConnection_np *) Connection;
TRACE("listening on %s\n", pname); - static const char prefix[] = "\\\\.";
+ static const char prefix[] = "\\\\";
+ static const char local[] =".";
RPC_STATUS r;
LPSTR pname;
+ INT size;
- npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX, /* already connected? */
+ npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, if (npc->pipe)
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, return RPC_S_OK;
PIPE_UNLIMITED_INSTANCES,
RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
if (npc->pipe == INVALID_HANDLE_VALUE) {
WARN("CreateNamedPipe failed with error %d\n", GetLastError());
@@ -159,11 +164,12 @@
else
return RPC_S_CANT_CREATE_ENDPOINT;
}
memset(&npc->ovl, 0, sizeof(npc->ovl)); /* protseq=ncacn_np: named pipes */
- npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
+ npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - strcat(strcpy(pname, prefix), Connection->Endpoint);
+ npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
+ size = strlen(prefix);
+ if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
+ size += strlen(local);
+ else
+ size += strlen(Connection->NetworkAddr);
+ size += strlen(Connection->Endpoint) + 1;
+
+ pname = I_RpcAllocate(size);
+ strcpy(pname, prefix);
+ if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
+ strcat(pname, local);
+ else
+ strcat(pname, Connection->NetworkAddr);
+ strcat(pname, Connection->Endpoint);
+ r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
I_RpcFree(pname);
/* Note: we don't call ConnectNamedPipe here because it must be done in the return r;
* server thread as the thread must be alertable */ @@ -412,18 +429,24 @@ static int rpcrt4_conn_np_read(RpcConnec
return RPC_S_OK; char *buf = buffer;
} BOOL ret = TRUE;
@@ -220,11 +226,12 @@
/* success */
memset(&npc->ovl, 0, sizeof(npc->ovl));
/* pipe is connected; change to message-read mode. */
dwMode = PIPE_READMODE_MESSAGE;
SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
- npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
+ npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
+ npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
npc->pipe = pipe;
return RPC_S_OK;
}
@@ -326,11 +333,12 @@
{
/* because of the way named pipes work, we'll transfer the connected pipe
* to the child, then reopen the server binding to continue listening */
new_npc->pipe = old_npc->pipe;
- new_npc->ovl = old_npc->ovl;
+ new_npc->ovl[0] = old_npc->ovl[0];
+ new_npc->ovl[1] = old_npc->ovl[1];
old_npc->pipe = 0;
memset(&old_npc->ovl, 0, sizeof(old_npc->ovl));
old_npc->listening = FALSE;
}
@@ -377,13 +385,18 @@
unsigned int bytes_left = count; unsigned int bytes_left = count;
+ OVERLAPPED ovl;
+
+ ZeroMemory(&ovl, sizeof(ovl));
+ ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
while (bytes_left) while (bytes_left)
{ {
DWORD bytes_read; DWORD bytes_read;
- ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL); - ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
- if (!ret && GetLastError() == ERROR_MORE_DATA)
- ret = TRUE;
- if (!ret || !bytes_read) - if (!ret || !bytes_read)
+ ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &npc->ovl[0]); + ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &ovl);
+ if ((!ret || !bytes_read) && (GetLastError() != ERROR_IO_PENDING)) + if ((!ret || !bytes_read) && (GetLastError() != ERROR_IO_PENDING))
+ break; + break;
+ + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_read, TRUE);
+ ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE);
+ if (!ret && (GetLastError() != ERROR_MORE_DATA)) + if (!ret && (GetLastError() != ERROR_MORE_DATA))
break; break;
+
bytes_left -= bytes_read; bytes_left -= bytes_read;
buf += bytes_read; buf += bytes_read;
} }
+ CloseHandle(ovl.hEvent);
return ret ? count : -1; return ret ? count : -1;
} }
@@ -397,13 +410,18 @@
@@ -434,16 +457,24 @@ static int rpcrt4_conn_np_write(RpcConne
const char *buf = buffer;
BOOL ret = TRUE;
unsigned int bytes_left = count; unsigned int bytes_left = count;
+ OVERLAPPED ovl;
+
+ ZeroMemory(&ovl, sizeof(ovl));
+ ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
while (bytes_left) while (bytes_left)
{ {
DWORD bytes_written; DWORD bytes_written;
- ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL); - ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL);
- if (!ret || !bytes_written) - if (!ret || !bytes_written)
+ ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &npc->ovl[1]); + ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &ovl);
+ if ((!ret || !bytes_written) && (GetLastError() != ERROR_IO_PENDING)) + if ((!ret || !bytes_written) && (GetLastError() != ERROR_IO_PENDING))
+ break; + break;
+ + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_written, TRUE);
+ ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE);
+ if (!ret && (GetLastError() != ERROR_MORE_DATA)) + if (!ret && (GetLastError() != ERROR_MORE_DATA))
break; break;
+
bytes_left -= bytes_written; bytes_left -= bytes_written;
buf += bytes_written; buf += bytes_written;
} }
+ CloseHandle(ovl.hEvent);
return ret ? count : -1; return ret ? count : -1;
} }
@@ -414,13 +432,17 @@
if (npc->pipe) {
FlushFileBuffers(npc->pipe);
CloseHandle(npc->pipe);
npc->pipe = 0;
}
- if (npc->ovl.hEvent) {
- CloseHandle(npc->ovl.hEvent);
- npc->ovl.hEvent = 0;
+ if (npc->ovl[0].hEvent) {
+ CloseHandle(npc->ovl[0].hEvent);
+ npc->ovl[0].hEvent = 0;
+ }
+ if (npc->ovl[1].hEvent) {
+ CloseHandle(npc->ovl[1].hEvent);
+ npc->ovl[1].hEvent = 0;
}
return 0;
}
static void rpcrt4_conn_np_cancel_call(RpcConnection *Connection) Index: rpcrt4.spec
@@ -579,11 +601,11 @@ ===================================================================
/* open and count connections */ --- rpcrt4.spec (working copy)
*count = 1; +++ rpcrt4.spec (working copy)
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); @@ -53,7 +53,7 @@
while (conn) { @ stub I_RpcIfInqTransferSyntaxes
rpcrt4_conn_listen_pipe(conn); @ stub I_RpcLogEvent
- if (conn->ovl.hEvent) @ stdcall I_RpcMapWin32Status(long)
+ if (conn->ovl[0].hEvent) -@ stub I_RpcNegotiateTransferSyntax # wxp
(*count)++; +@ stdcall I_RpcNegotiateTransferSyntax(ptr)
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); @ stub I_RpcNsBindingSetEntryName
} @ stub I_RpcNsBindingSetEntryNameA
@ stub I_RpcNsBindingSetEntryNameW
/* make array of connections */ @@ -266,7 +266,7 @@
@@ -600,11 +622,11 @@ @ stdcall NdrRangeUnmarshall(ptr ptr ptr long)
@ stub NdrRpcSmClientAllocate
objs[0] = npps->mgr_event; @ stub NdrRpcSmClientFree
*count = 1; -@ stub NdrRpcSmSetClientToOsf
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); +@ stdcall NdrRpcSmSetClientToOsf(ptr)
while (conn) { @ stub NdrRpcSsDefaultAllocate
- if ((objs[*count] = conn->ovl.hEvent)) @ stub NdrRpcSsDefaultFree
+ if ((objs[*count] = conn->ovl[0].hEvent)) @ stub NdrRpcSsDisableAllocate
(*count)++;
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
}
LeaveCriticalSection(&protseq->cs);
return objs;
@@ -647,11 +669,11 @@
b_handle = objs[res - WAIT_OBJECT_0];
/* find which connection got a RPC */
EnterCriticalSection(&protseq->cs);
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
while (conn) {
- if (b_handle == conn->ovl.hEvent) break;
+ if (b_handle == conn->ovl[0].hEvent) break;
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
}
cconn = NULL;
if (conn)
RPCRT4_SpawnConnection(&cconn, &conn->common);