mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
rpcrt4: Move NdrStub* functions to cstub.c and move NdrProxy*
functions to cproxy.c since both sets of functions depend on the implementations of the standard stubs and proxies.
This commit is contained in:
parent
4d7b23069b
commit
583ae12233
@ -285,8 +285,8 @@ static const IRpcProxyBufferVtbl StdProxy_Vtbl =
|
||||
StdProxy_Disconnect
|
||||
};
|
||||
|
||||
HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
|
||||
LPRPCCHANNELBUFFER *ppChannel)
|
||||
static HRESULT StdProxy_GetChannel(LPVOID iface,
|
||||
LPRPCCHANNELBUFFER *ppChannel)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
|
||||
@ -295,8 +295,8 @@ HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
|
||||
const IID **ppiid)
|
||||
static HRESULT StdProxy_GetIID(LPVOID iface,
|
||||
const IID **ppiid)
|
||||
{
|
||||
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
|
||||
TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
|
||||
@ -340,6 +340,108 @@ ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface)
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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);
|
||||
NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
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);
|
||||
|
||||
if (!pStubMsg->pRpcChannelBuffer)
|
||||
{
|
||||
WARN("Trying to use disconnected proxy %p\n", This);
|
||||
RpcRaiseException(RPC_E_DISCONNECTED);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* raise exception if call failed */
|
||||
if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
|
||||
else if (FAILED(hr)) RpcRaiseException(hr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyErrorHandler [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
|
||||
{
|
||||
WARN("(0x%08lx): a proxy call failed\n", dwExceptionCode);
|
||||
|
||||
if (FAILED(dwExceptionCode))
|
||||
return dwExceptionCode;
|
||||
else
|
||||
return HRESULT_FROM_WIN32(dwExceptionCode);
|
||||
}
|
||||
|
||||
HRESULT WINAPI
|
||||
CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid,
|
||||
LPRPCPROXYBUFFER *ppProxy, LPVOID *ppv )
|
||||
|
@ -28,10 +28,6 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||
LPPSFACTORYBUFFER pPSFactory,
|
||||
LPRPCPROXYBUFFER *ppProxy,
|
||||
LPVOID *ppvObj);
|
||||
HRESULT WINAPI StdProxy_GetChannel(LPVOID iface,
|
||||
LPRPCCHANNELBUFFER *ppChannel);
|
||||
HRESULT WINAPI StdProxy_GetIID(LPVOID iface,
|
||||
const IID **piid);
|
||||
|
||||
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
|
||||
LPUNKNOWN pUnkServer,
|
||||
|
@ -263,3 +263,32 @@ void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuff
|
||||
FIXME("Not implemented\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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);
|
||||
NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
|
||||
pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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;
|
||||
}
|
||||
|
@ -40,143 +40,11 @@
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "cpsf.h"
|
||||
#include "ndr_misc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
|
||||
|
||||
/***********************************************************************
|
||||
* 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);
|
||||
NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
|
||||
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);
|
||||
|
||||
if (!pStubMsg->pRpcChannelBuffer)
|
||||
{
|
||||
WARN("Trying to use disconnected proxy %p\n", This);
|
||||
RpcRaiseException(RPC_E_DISCONNECTED);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* raise exception if call failed */
|
||||
if (hr == RPC_S_CALL_FAILED) RpcRaiseException(*(DWORD*)pStubMsg->Buffer);
|
||||
else if (FAILED(hr)) RpcRaiseException(hr);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NdrProxyErrorHandler [RPCRT4.@]
|
||||
*/
|
||||
HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
|
||||
{
|
||||
WARN("(0x%08lx): a proxy call failed\n", dwExceptionCode);
|
||||
|
||||
if (FAILED(dwExceptionCode))
|
||||
return dwExceptionCode;
|
||||
else
|
||||
return HRESULT_FROM_WIN32(dwExceptionCode);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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);
|
||||
NdrServerInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor);
|
||||
pStubMsg->pRpcChannelBuffer = pRpcChannelBuffer;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* NdrClientInitializeNew [RPCRT4.@]
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user