rpcrt4: Implement NdrSimpleType{Marshall,Unmarshall}.

oldstable
Huw Davies 2007-01-23 11:50:06 +00:00 committed by Alexandre Julliard
parent dfcdbba181
commit e3abd2b3ff
2 changed files with 39 additions and 2 deletions

View File

@ -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);
}
/***********************************************************************

View File

@ -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();