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, cstub.c (new), Makefile.in: Ove Kaaven <ovek@transgaming.com> - implement the CStdStubBuffer methods -- 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
--- dlls/rpcrt4/Makefile.in.B_PL3 2002-10-09 21:28:29.000000000 -0500 +++ dlls/rpcrt4/Makefile.in 2002-10-10 00:31:08.000000000 -0500 @@ -11,6 +11,7 @@ C_SRCS = \ cproxy.c \ + cstub.c \ rpc_binding.c \ rpc_message.c \ ndr_stubless.c \ --- dlls/rpcrt4/rpcrt4.spec.B_PL3 2002-10-10 00:22:03.000000000 -0500 +++ dlls/rpcrt4/rpcrt4.spec 2002-10-10 00:27:03.000000000 -0500 @@ -183,17 +183,17 @@ @ stdcall UuidToStringA(ptr ptr) UuidToStringA @ stdcall UuidToStringW(ptr ptr) UuidToStringW -@ stub CStdStubBuffer_QueryInterface -@ stub CStdStubBuffer_AddRef -@ stub CStdStubBuffer_Connect -@ stub CStdStubBuffer_Disconnect -@ stub CStdStubBuffer_Invoke -@ stub CStdStubBuffer_IsIIDSupported -@ stub CStdStubBuffer_CountRefs -@ stub CStdStubBuffer_DebugServerQueryInterface -@ stub CStdStubBuffer_DebugServerRelease +@ stdcall CStdStubBuffer_QueryInterface(ptr ptr) CStdStubBuffer_QueryInterface +@ stdcall CStdStubBuffer_AddRef(ptr) CStdStubBuffer_AddRef +@ stdcall CStdStubBuffer_Connect(ptr ptr) CStdStubBuffer_Connect +@ stdcall CStdStubBuffer_Disconnect(ptr) CStdStubBuffer_Disconnect +@ stdcall CStdStubBuffer_Invoke(ptr ptr ptr) CStdStubBuffer_Invoke +@ stdcall CStdStubBuffer_IsIIDSupported(ptr ptr) CStdStubBuffer_IsIIDSupported +@ stdcall CStdStubBuffer_CountRefs(ptr) CStdStubBuffer_CountRefs +@ stdcall CStdStubBuffer_DebugServerQueryInterface(ptr ptr) CStdStubBuffer_DebugServerQueryInterface +@ stdcall CStdStubBuffer_DebugServerRelease(ptr ptr) CStdStubBuffer_DebugServerRelease +@ stdcall NdrCStdStubBuffer_Release(ptr ptr) NdrCStdStubBuffer_Release @ stub NdrCStdStubBuffer2_Release -@ stub NdrCStdStubBuffer_Release @ stdcall IUnknown_QueryInterface_Proxy(ptr ptr ptr) IUnknown_QueryInterface_Proxy @ stdcall IUnknown_AddRef_Proxy(ptr) IUnknown_AddRef_Proxy --- /dev/null 1969-12-31 18:00:00.000000000 -0600 +++ dlls/rpcrt4/cstub.c 2002-10-10 00:20:19.000000000 -0500 @@ -0,0 +1,149 @@ +/* + * COM stub (CStdStubBuffer) implementation + * + * Copyright 2001 Ove Kåven, TransGaming Technologies + */ + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" + +#include "wine/obj_base.h" +#include "wine/obj_channel.h" + +#include "rpcproxy.h" + +#include "wine/debug.h" + +#include "cpsf.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ole); + +#define STUB_HEADER(This) (((CInterfaceStubHeader*)((This)->lpVtbl))[-1]) + +HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid, + LPUNKNOWN pUnkServer, + CInterfaceStubVtbl *vtbl, + LPPSFACTORYBUFFER pPSFactory, + LPRPCSTUBBUFFER *ppStub) +{ + CStdStubBuffer *This; + + TRACE("(%p,%p,%p,%p)\n", pUnkServer, vtbl, pPSFactory, ppStub); + TRACE("iid=%s\n", debugstr_guid(vtbl->header.piid)); + TRACE("vtbl=%p\n", &vtbl->Vtbl); + + if (!IsEqualGUID(vtbl->header.piid, riid)) { + ERR("IID mismatch during stub creation\n"); + return RPC_E_UNEXPECTED; + } + + This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CStdStubBuffer)); + if (!This) return E_OUTOFMEMORY; + + This->lpVtbl = &vtbl->Vtbl; + This->RefCount = 1; + This->pvServerObject = pUnkServer; + This->pPSFactory = pPSFactory; + *ppStub = (LPRPCSTUBBUFFER)This; + + IPSFactoryBuffer_AddRef(pPSFactory); + return S_OK; +} + +HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface, + REFIID riid, + LPVOID *obj) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj); + + if (IsEqualGUID(&IID_IUnknown,riid) || + IsEqualGUID(&IID_IRpcStubBuffer,riid)) { + *obj = This; + This->RefCount++; + return S_OK; + } + return E_NOINTERFACE; +} + +ULONG WINAPI CStdStubBuffer_AddRef(LPRPCSTUBBUFFER iface) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->AddRef()\n",This); + return ++(This->RefCount); +} + +ULONG WINAPI NdrCStdStubBuffer_Release(LPRPCSTUBBUFFER iface, + LPPSFACTORYBUFFER pPSF) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->Release()\n",This); + + if (!--(This->RefCount)) { + IUnknown_Release(This->pvServerObject); + IPSFactoryBuffer_Release(This->pPSFactory); + HeapFree(GetProcessHeap(),0,This); + return 0; + } + return This->RefCount; +} + +HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, + LPUNKNOWN lpUnkServer) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->Connect(%p)\n",This,lpUnkServer); + This->pvServerObject = lpUnkServer; + return S_OK; +} + +void WINAPI CStdStubBuffer_Disconnect(LPRPCSTUBBUFFER iface) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->Disconnect()\n",This); + This->pvServerObject = NULL; +} + +HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, + PRPCOLEMESSAGE pMsg, + LPRPCCHANNELBUFFER pChannel) +{ + ICOM_THIS(CStdStubBuffer,iface); + DWORD dwPhase = STUB_UNMARSHAL; + TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel); + + STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase); + return S_OK; +} + +LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface, + REFIID riid) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->IsIIDSupported(%s)\n",This,debugstr_guid(riid)); + return IsEqualGUID(STUB_HEADER(This).piid, riid) ? iface : NULL; +} + +ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->CountRefs()\n",This); + return This->RefCount; +} + +HRESULT WINAPI CStdStubBuffer_DebugServerQueryInterface(LPRPCSTUBBUFFER iface, + LPVOID *ppv) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->DebugServerQueryInterface(%p)\n",This,ppv); + return S_OK; +} + +void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface, + LPVOID pv) +{ + ICOM_THIS(CStdStubBuffer,iface); + TRACE("(%p)->DebugServerRelease(%p)\n",This,pv); +} +