From Jürgen Schmied's RPC patches. Minor changes may exist between this and the original patch but it's intended to be basically the same stuff. LICENSE: X11 CHANGELOG: * dlls/rpcrt4: rpcrt4.spec, mdr_midl.c (new), Makefile.in; include/rpcproxy.h: Ove Kaaven <ovek@transgaming.com> - NdrProxyFreeBuffer, NdrProxyGetBuffer, NdrProxyInitialize NdrProxySendReceive, NdrStubGetBuffer, NdrStubInitialize -- gmt "If ye love wealth better than liberty, the tranquility of servitude better than the animating contest of freedom, go home from us in peace. We ask not your counsels or your arms. Crouch down and lick the hands, which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen." -Samuel Adams
Index: include/rpcproxy.h =================================================================== RCS file: /home/wine/wine/include/rpcproxy.h,v retrieving revision 1.4 diff -u -r1.4 rpcproxy.h --- include/rpcproxy.h 9 Aug 2002 01:11:39 -0000 1.4 +++ include/rpcproxy.h 10 Oct 2002 07:55:36 -0000 @@ -16,13 +16,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __WINE_RPCPROXY_H -#define __WINE_RPCPROXY_H - #ifndef __RPCPROXY_H_VERSION__ -/* FIXME: I'm not sure what version though */ -#define __RPCPROXY_H_VERSION__ +/* FIXME: Find an appropriate version number. I guess something is better than nothing */ +#define __RPCPROXY_H_VERSION__ ( 399 ) #endif + +#ifndef __WINE_RPCPROXY_H +#define __WINE_RPCPROXY_H #include "basetsd.h" #include "guiddef.h" --- dlls/rpcrt4/Makefile.in.B_PL5 2002-10-10 01:25:29.000000000 -0500 +++ dlls/rpcrt4/Makefile.in 2002-10-10 02:44:09.000000000 -0500 @@ -17,6 +17,7 @@ rpc_binding.c \ rpc_message.c \ ndr_stubless.c \ + ndr_midl.c \ rpcrt4_main.c SUBDIRS = tests --- dlls/rpcrt4/rpcrt4.spec.B_PL5 2002-10-10 01:26:49.000000000 -0500 +++ dlls/rpcrt4/rpcrt4.spec 2002-10-10 02:43:34.000000000 -0500 @@ -253,10 +253,10 @@ @ stub NdrPipesDone @ stub NdrPipesInitialize @ stub NdrProxyErrorHandler -@ stub NdrProxyFreeBuffer -@ stub NdrProxyGetBuffer -@ stub NdrProxyInitialize -@ stub NdrProxySendReceive +@ stdcall NdrProxyFreeBuffer(ptr ptr) NdrProxyFreeBuffer +@ stdcall NdrProxyGetBuffer(ptr ptr) NdrProxyGetBuffer +@ stdcall NdrProxyInitialize(ptr ptr ptr ptr long) NdrProxyInitialize +@ stdcall NdrProxySendReceive(ptr ptr) NdrProxySendReceive @ stub NdrRangeUnmarshall @ stub NdrRpcSmClientAllocate @ stub NdrRpcSmClientFree @@ -271,7 +271,9 @@ @ stub NdrStubCall @ stub NdrStubCall2 @ stub NdrStubForwardingFunction -@ stub NdrStubGetBuffer +@ stdcall NdrStubGetBuffer(ptr ptr ptr) NdrStubGetBuffer +@ stdcall NdrStubInitialize(ptr ptr ptr ptr) NdrStubInitialize +@ stub NdrStubInitializeMarshall @ stub NdrpSetRpcSsDefaults @ stub NdrByteCountPointerBufferSize @@ -358,8 +360,6 @@ @ stub NdrSimpleStructUnmarshall @ stub NdrSimpleTypeMarshall @ stub NdrSimpleTypeUnmarshall -@ stub NdrStubInitialize -@ stub NdrStubInitializeMarshall @ stub NdrUserMarshalBufferSize @ stub NdrUserMarshalFree @ stub NdrUserMarshalMarshall --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ dlls/rpcrt4/ndr_midl.c 2002-10-10 02:30:57.000000000 -0500 @@ -0,0 +1,157 @@ +/* + * MIDL proxy/stub stuff + * + * Copyright 2002 Ove Kåven, TransGaming Technologies + * + * TODO: + * - figure out whether we *really* got this right + * - check for errors and throw exceptions + */ + +#include <stdio.h> +#include <string.h> + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winreg.h" + +#include "wine/obj_base.h" +#include "wine/obj_channel.h" + +#include "rpcproxy.h" + +#include "wine/debug.h" + +#include "cpsf.h" +#include "ndr_misc.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +/*********************************************************************** + * NdrProxyInitialize [RPCRT4.@] + */ +void WINAPI NdrProxyInitialize(void *This, + PRPC_MESSAGE pRpcMsg, + PMIDL_STUB_MESSAGE pStubMsg, + PMIDL_STUB_DESC pStubDescriptor, + unsigned int ProcNum) +{ + HRESULT hr; + + TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum); + memset(pRpcMsg, 0, sizeof(RPC_MESSAGE)); + memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE)); + pRpcMsg->ProcNum = ProcNum; + pRpcMsg->RpcInterfaceInformation = pStubDescriptor->RpcInterfaceInformation; + pStubMsg->RpcMsg = pRpcMsg; + pStubMsg->IsClient = 1; + pStubMsg->ReuseBuffer = 1; + pStubMsg->pfnAllocate = pStubDescriptor->pfnAllocate; + pStubMsg->pfnFree = pStubDescriptor->pfnFree; + pStubMsg->StubDesc = pStubDescriptor; + if (This) StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer); + if (pStubMsg->pRpcChannelBuffer) { + hr = IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer, + &pStubMsg->dwDestContext, + &pStubMsg->pvDestContext); + } + TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer); +} + +/*********************************************************************** + * NdrProxyGetBuffer [RPCRT4.@] + */ +void WINAPI NdrProxyGetBuffer(void *This, + PMIDL_STUB_MESSAGE pStubMsg) +{ + HRESULT hr; + const IID *riid = NULL; + + TRACE("(%p,%p)\n", This, pStubMsg); + pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength; + pStubMsg->dwStubPhase = PROXY_GETBUFFER; + hr = StdProxy_GetIID(This, &riid); + hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer, + (RPCOLEMESSAGE*)pStubMsg->RpcMsg, + riid); + pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; + pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; + pStubMsg->Buffer = pStubMsg->BufferStart; + pStubMsg->dwStubPhase = PROXY_MARSHAL; +} + +/*********************************************************************** + * NdrProxySendReceive [RPCRT4.@] + */ +void WINAPI NdrProxySendReceive(void *This, + PMIDL_STUB_MESSAGE pStubMsg) +{ + ULONG Status = 0; + HRESULT hr; + + TRACE("(%p,%p)\n", This, pStubMsg); + pStubMsg->dwStubPhase = PROXY_SENDRECEIVE; + hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer, + (RPCOLEMESSAGE*)pStubMsg->RpcMsg, + &Status); + pStubMsg->dwStubPhase = PROXY_UNMARSHAL; + pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength; + pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; + pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; + pStubMsg->Buffer = pStubMsg->BufferStart; +} + +/*********************************************************************** + * NdrProxyFreeBuffer [RPCRT4.@] + */ +void WINAPI NdrProxyFreeBuffer(void *This, + PMIDL_STUB_MESSAGE pStubMsg) +{ + HRESULT hr; + + TRACE("(%p,%p)\n", This, pStubMsg); + hr = IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer, + (RPCOLEMESSAGE*)pStubMsg->RpcMsg); +} + +/*********************************************************************** + * NdrStubInitialize [RPCRT4.@] + */ +void WINAPI NdrStubInitialize(PRPC_MESSAGE pRpcMsg, + PMIDL_STUB_MESSAGE pStubMsg, + PMIDL_STUB_DESC pStubDescriptor, + LPRPCCHANNELBUFFER pRpcChannelBuffer) +{ + TRACE("(%p,%p,%p,%p)\n", pRpcMsg, pStubMsg, pStubDescriptor, pRpcChannelBuffer); + memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE)); + pStubMsg->RpcMsg = pRpcMsg; + pStubMsg->IsClient = 0; + pStubMsg->ReuseBuffer = 1; + pStubMsg->pfnAllocate = pStubDescriptor->pfnAllocate; + pStubMsg->pfnFree = pStubDescriptor->pfnFree; + pStubMsg->StubDesc = pStubDescriptor; + pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer; + pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength; + pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; + pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; + pStubMsg->Buffer = pStubMsg->BufferStart; +} + +/*********************************************************************** + * NdrStubGetBuffer [RPCRT4.@] + */ +void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER This, + LPRPCCHANNELBUFFER pRpcChannelBuffer, + PMIDL_STUB_MESSAGE pStubMsg) +{ + TRACE("(%p,%p)\n", This, pStubMsg); + pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer; + pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength; + I_RpcGetBuffer(pStubMsg->RpcMsg); /* ? */ + pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; + pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; + pStubMsg->Buffer = pStubMsg->BufferStart; +} + +