From e69f65094429dc3df3d614811643784be274d58c Mon Sep 17 00:00:00 2001 From: Saveliy Tretiakov Date: Thu, 30 Mar 2006 19:07:08 +0000 Subject: [PATCH] Implement NDRCContextUnmarshall() svn path=/trunk/; revision=21419 --- reactos/dll/win32/rpcrt4/ndr_marshall.c | 43 +++++++++++++++++++++++-- reactos/dll/win32/rpcrt4/rpcrt4.spec | 2 +- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/rpcrt4/ndr_marshall.c b/reactos/dll/win32/rpcrt4/ndr_marshall.c index f7b394f0813..808ef22cdf0 100644 --- a/reactos/dll/win32/rpcrt4/ndr_marshall.c +++ b/reactos/dll/win32/rpcrt4/ndr_marshall.c @@ -3233,10 +3233,10 @@ static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE pStubMsg, /*********************************************************************** * NDRCContextMarshall */ -void WINAPI NDRCContextMarshall(IN NDR_CCONTEXT CContext, OUT void *pBuff ) +void WINAPI NDRCContextMarshall(NDR_CCONTEXT CContext, void *pBuff ) { CContextHandle *ctx = (CContextHandle*)CContext; - memcpy(pBuff, ctx->Ndr, sizeof(ctx->Ndr)); + memcpy(pBuff, ctx->Ndr, 20); } /*********************************************************************** @@ -3256,6 +3256,45 @@ void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg, } + +/*********************************************************************** + * NDRCContextUnmarshall + */ +void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *pCContext, + RPC_BINDING_HANDLE hBinding, + void *pBuff, + unsigned long DataRepresentation ) +{ + CContextHandle *ctx; + RPC_STATUS status; + char *buf = (char*)pBuff; + int i; + + for(i = 0; i < 20 && !buf[i]; i++); + + if(i == 20) + { + ctx = (CContextHandle*)*pCContext; + if(ctx) + { + RPCRT4_DestroyBinding(ctx->Binding); + HeapFree(GetProcessHeap(), 0, ctx); + } + *pCContext = NULL; + } + else + { + ctx = HeapAlloc(GetProcessHeap(), 0, sizeof(CContextHandle)); + if(!ctx) RpcRaiseException(ERROR_OUTOFMEMORY); + + status = RpcBindingCopy(hBinding, (RPC_BINDING_HANDLE*) &ctx->Binding); + if(status != RPC_S_OK) RpcRaiseException(status); + + memcpy(ctx->Ndr, pBuff, 20); + *pCContext = (NDR_CCONTEXT)ctx; + } +} + /*********************************************************************** * NdrClientContextUnmarshall */ diff --git a/reactos/dll/win32/rpcrt4/rpcrt4.spec b/reactos/dll/win32/rpcrt4/rpcrt4.spec index 9295b9e0dfd..7cbfc9f1be3 100644 --- a/reactos/dll/win32/rpcrt4/rpcrt4.spec +++ b/reactos/dll/win32/rpcrt4/rpcrt4.spec @@ -139,7 +139,7 @@ @ stub MqRegisterQueue # win9x @ stdcall NDRCContextBinding(ptr) @ stdcall NDRCContextMarshall(ptr ptr) -@ stub NDRCContextUnmarshall +@ stdcall NDRCContextUnmarshall(ptr ptr ptr long) @ stub NDRSContextMarshall2 @ stub NDRSContextMarshall @ stub NDRSContextMarshallEx