Commit 6a0fccd3 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

rpcrt4: Add tests for NdrStubForwardingFunction and write a commented out implementation.

This shows that the IRpcStubBuffer for a delegated stub's base interface is stored at (void**)This-1.
parent a5dcb3e3
......@@ -224,3 +224,27 @@ const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface)
CStdStubBuffer *This = (CStdStubBuffer *)iface;
return STUB_HEADER(This).pServerInfo;
}
/************************************************************************
* NdrStubForwardingFunction [RPCRT4.@]
*/
void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
PRPC_MESSAGE pMsg, DWORD *pdwStubPhase )
{
/* Once stub delegation is implemented, this should call
IRpcStubBuffer_Invoke on the stub's base interface. The
IRpcStubBuffer for this interface is stored at (void**)This-1.
The pChannel and pMsg parameters are passed intact
(RPCOLEMESSAGE is basically a RPC_MESSAGE). If Invoke returns
with a failure then an exception is raised (to see this, change
the return value in the test).
IRpcStubBuffer *base_this = *(IRpcStubBuffer**)((void**)This - 1);
HRESULT r = IRpcStubBuffer_Invoke(base_this, (RPCOLEMESSAGE*)pMsg, pChannel);
if(FAILED(r)) RpcRaiseException(r);
return;
*/
FIXME("Not implemented\n");
return;
}
......@@ -338,13 +338,3 @@ RPC_STATUS RPC_ENTRY NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg,
return RPC_S_OK;
}
/************************************************************************
* NdrStubForwardingFunction [RPCRT4.@]
*/
void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel,
PRPC_MESSAGE pMsg, DWORD *pdwStubPhase )
{
FIXME("Not implemented\n");
return;
}
......@@ -443,8 +443,6 @@ static void test_NdrDllGetClassObject(void)
void *CStd_DebugServerQueryInterface = GetProcAddress(hmod, "CStdStubBuffer_DebugServerQueryInterface");
void *CStd_DebugServerRelease = GetProcAddress(hmod, "CStdStubBuffer_DebugServerRelease");
OleInitialize(NULL);
r = NdrDllGetClassObject(&PSDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
&PSDispatch, &PSFactoryBuffer);
......@@ -528,7 +526,56 @@ todo_wine {
ok(PSFactoryBuffer.RefCount == 1, "ref count %ld\n", PSFactoryBuffer.RefCount);
}
static int base_buffer_invoke_called;
static HRESULT WINAPI base_buffer_Invoke(IRpcStubBuffer *This, RPCOLEMESSAGE *msg, IRpcChannelBuffer *channel)
{
base_buffer_invoke_called++;
ok(msg == (RPCOLEMESSAGE*)0xcafebabe, "msg ptr changed\n");
ok(channel == (IRpcChannelBuffer*)0xdeadbeef, "channel ptr changed\n");
return S_OK; /* returning any failure here results in an exception */
}
static IRpcStubBufferVtbl base_buffer_vtbl = {
(void*)0xcafebab0,
(void*)0xcafebab1,
(void*)0xcafebab2,
(void*)0xcafebab3,
(void*)0xcafebab4,
base_buffer_Invoke,
(void*)0xcafebab6,
(void*)0xcafebab7,
(void*)0xcafebab8,
(void*)0xcafebab9
};
static void test_NdrStubForwardingFunction(void)
{
void *This[5];
void *real_this;
IRpcChannelBuffer *channel = (IRpcChannelBuffer*)0xdeadbeef;
RPC_MESSAGE *msg = (RPC_MESSAGE*)0xcafebabe;
DWORD *phase = (DWORD*)0x12345678;
IRpcStubBufferVtbl *base_buffer_vtbl_ptr = &base_buffer_vtbl;
IRpcStubBuffer *base_stub_buffer = (IRpcStubBuffer*)&base_buffer_vtbl_ptr;
memset(This, 0xcc, sizeof(This));
This[0] = base_stub_buffer;
real_this = &This[1];
NdrStubForwardingFunction( real_this, channel, msg, phase );
todo_wine {
ok(base_buffer_invoke_called == 1, "base_buffer_invoke called %d times\n", base_buffer_invoke_called);
}
}
START_TEST( cstub )
{
OleInitialize(NULL);
test_NdrDllGetClassObject();
test_NdrStubForwardingFunction();
OleUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment