From e3abd2b3ff140e4ec43fb6b3f95ce045643b6ea9 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 23 Jan 2007 11:50:06 +0000 Subject: [PATCH] rpcrt4: Implement NdrSimpleType{Marshall,Unmarshall}. --- dlls/rpcrt4/ndr_marshall.c | 4 ++-- dlls/rpcrt4/tests/ndr_marshall.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index f5aee7691b8..3dc52657c82 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -1524,7 +1524,7 @@ void WINAPI NdrPointerFree(PMIDL_STUB_MESSAGE pStubMsg, void WINAPI NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar ) { - FIXME("stub\n"); + NdrBaseTypeMarshall(pStubMsg, pMemory, &FormatChar); } /*********************************************************************** @@ -1533,7 +1533,7 @@ void WINAPI NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* p void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar ) { - FIXME("stub\n"); + NdrBaseTypeUnmarshall(pStubMsg, &pMemory, &FormatChar, 0); } /*********************************************************************** diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c index 4a5566f0a37..a1d8f5e8f95 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -73,6 +73,42 @@ static const MIDL_STUB_DESC Object_StubDesc = }; +static void test_ndr_simple_type(void) +{ + RPC_MESSAGE RpcMessage; + MIDL_STUB_MESSAGE StubMsg; + MIDL_STUB_DESC StubDesc; + long l, l2 = 0; + + StubDesc = Object_StubDesc; + StubDesc.pFormatTypes = NULL; + + NdrClientInitializeNew( + &RpcMessage, + &StubMsg, + &StubDesc, + 0); + + StubMsg.BufferLength = 16; + StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength); + l = 0xcafebabe; + NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, 8 /* FC_LONG */); + ok(StubMsg.Buffer == StubMsg.BufferStart + 4, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart); + ok(*(long*)StubMsg.BufferStart == l, "%ld\n", *(long*)StubMsg.BufferStart); + + StubMsg.Buffer = StubMsg.BufferStart + 1; + NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, 8 /* FC_LONG */); + ok(StubMsg.Buffer == StubMsg.BufferStart + 8, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart); + ok(*(long*)(StubMsg.BufferStart + 4) == l, "%ld\n", *(long*)StubMsg.BufferStart); + + StubMsg.Buffer = StubMsg.BufferStart + 1; + NdrSimpleTypeUnmarshall(&StubMsg, (unsigned char*)&l2, 8 /* FC_LONG */); + ok(StubMsg.Buffer == StubMsg.BufferStart + 8, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart); + ok(l2 == l, "%ld\n", l2); + + HeapFree(GetProcessHeap(), 0, StubMsg.BufferStart); +} + static void test_pointer_marshal(const unsigned char *formattypes, void *memsrc, long srcsize, @@ -950,6 +986,7 @@ todo_wine { START_TEST( ndr_marshall ) { + test_ndr_simple_type(); test_simple_types(); test_simple_struct(); test_fullpointer_xlat(); -- 2.11.4.GIT