Robert Shearman : rpcrt4: Handle the RPC_FC_PROC_BYVAL flag correctly
in stubless
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jan 31 06:04:21 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 7f15d9bc4fac5f1366bca91a1704c74a061d3aaa
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=7f15d9bc4fac5f1366bca91a1704c74a061d3aaa
Author: Robert Shearman <rob at codeweavers.com>
Date: Tue Jan 31 12:21:20 2006 +0100
rpcrt4: Handle the RPC_FC_PROC_BYVAL flag correctly in stubless
proxies and stubs.
---
dlls/rpcrt4/ndr_stubless.c | 51 +++++++++++++++++++++++++++++++++++---------
1 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c
index b083d2a..7c10621 100644
--- a/dlls/rpcrt4/ndr_stubless.c
+++ b/dlls/rpcrt4/ndr_stubless.c
@@ -780,11 +780,21 @@ LONG_PTR WINAPIV NdrClientCall2(PMIDL_ST
{
case PROXY_CALCSIZE:
if (pParam->param_attributes & RPC_FC_PROC_PF_IN)
- call_buffer_sizer(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
+ {
+ if (pParam->param_attributes & RPC_FC_PROC_PF_BYVAL)
+ call_buffer_sizer(&stubMsg, pArg, pTypeFormat);
+ else
+ call_buffer_sizer(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
+ }
break;
case PROXY_MARSHAL:
if (pParam->param_attributes & RPC_FC_PROC_PF_IN)
- call_marshaller(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
+ {
+ if (pParam->param_attributes & RPC_FC_PROC_PF_BYVAL)
+ call_marshaller(&stubMsg, pArg, pTypeFormat);
+ else
+ call_marshaller(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
+ }
break;
case PROXY_UNMARSHAL:
if (pParam->param_attributes & RPC_FC_PROC_PF_OUT)
@@ -792,6 +802,8 @@ LONG_PTR WINAPIV NdrClientCall2(PMIDL_ST
unsigned char *pRetVal = (unsigned char *)&RetVal;
if (pParam->param_attributes & RPC_FC_PROC_PF_RETURN)
call_unmarshaller(&stubMsg, &pRetVal, pTypeFormat, 0);
+ else if (pParam->param_attributes & RPC_FC_PROC_PF_BYVAL)
+ call_unmarshaller(&stubMsg, &pArg, pTypeFormat, 0);
else
call_unmarshaller(&stubMsg, (unsigned char **)pArg, pTypeFormat, 0);
}
@@ -1192,6 +1204,11 @@ long WINAPI NdrStubCall2(
pServerInfo->ThunkTable[pRpcMsg->ProcNum](&stubMsg);
/* FIXME: RetVal is stored as the last argument - retrieve it */
}
+ else if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ {
+ SERVER_ROUTINE *vtbl = *(SERVER_ROUTINE **)((CStdStubBuffer *)pThis)->pvServerObject;
+ RetVal = call_server_func(vtbl[pRpcMsg->ProcNum], args, stack_size);
+ }
else
RetVal = call_server_func(pServerInfo->DispatchTable[pRpcMsg->ProcNum], args, stack_size);
@@ -1311,16 +1328,26 @@ long WINAPI NdrStubCall2(
call_marshaller(&stubMsg, (unsigned char *)&RetVal, pTypeFormat);
else if (pParam->param_attributes & RPC_FC_PROC_PF_OUT)
{
- /* we have to dereference the pointer again for complex types */
- call_marshaller(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
- stubMsg.pfnFree(*(void **)pArg);
+ if (pParam->param_attributes & RPC_FC_PROC_PF_BYVAL)
+ call_marshaller(&stubMsg, pArg, pTypeFormat);
+ else
+ {
+ call_marshaller(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
+ stubMsg.pfnFree(*(void **)pArg);
+ }
}
- /* FIXME: call call_freer here */
+ /* FIXME: call call_freer here for IN types */
break;
case STUBLESS_UNMARSHAL:
if (pParam->param_attributes & RPC_FC_PROC_PF_IN)
- call_unmarshaller(&stubMsg, (unsigned char **)pArg, pTypeFormat, 0);
- else if (pParam->param_attributes & RPC_FC_PROC_PF_OUT)
+ {
+ if (pParam->param_attributes & RPC_FC_PROC_PF_BYVAL)
+ call_unmarshaller(&stubMsg, &pArg, pTypeFormat, 0);
+ else
+ call_unmarshaller(&stubMsg, (unsigned char **)pArg, pTypeFormat, 0);
+ }
+ else if ((pParam->param_attributes & RPC_FC_PROC_PF_OUT) &&
+ !(pParam->param_attributes & RPC_FC_PROC_PF_BYVAL))
{
*(void **)pArg = NdrAllocate(&stubMsg, sizeof(void *));
**(void ***)pArg = 0;
@@ -1330,8 +1357,12 @@ long WINAPI NdrStubCall2(
if (pParam->param_attributes & RPC_FC_PROC_PF_RETURN)
call_buffer_sizer(&stubMsg, (unsigned char *)&RetVal, pTypeFormat);
else if (pParam->param_attributes & RPC_FC_PROC_PF_OUT)
- /* we have to dereference the pointer again for complex types */
- call_buffer_sizer(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
+ {
+ if (pParam->param_attributes & RPC_FC_PROC_PF_BYVAL)
+ call_buffer_sizer(&stubMsg, pArg, pTypeFormat);
+ else
+ call_buffer_sizer(&stubMsg, *(unsigned char **)pArg, pTypeFormat);
+ }
break;
default:
RpcRaiseException(RPC_S_INTERNAL_ERROR);
More information about the wine-cvs
mailing list