rpcrt4: Implement NdrNonEncapsulatedUnionMemorySize.

This commit is contained in:
Robert Shearman 2006-05-18 03:39:34 +01:00 committed by Alexandre Julliard
parent 62bbaf70b3
commit c1d00c547b
1 changed files with 51 additions and 7 deletions

View File

@ -3834,15 +3834,59 @@ void WINAPI NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned long WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg, unsigned long WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat) PFORMAT_STRING pFormat)
{ {
pFormat += 2; unsigned long discriminant;
if (pStubMsg->fHasNewCorrDesc) unsigned short type, size;
pFormat += 6;
else pFormat++;
pFormat += 4; /* Unmarshall discriminant */
discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
TRACE("unmarshalled discriminant 0x%lx\n", discriminant);
pFormat += *(const SHORT*)pFormat; pFormat += *(const SHORT*)pFormat;
TRACE("size %d\n", *(const SHORT*)pFormat);
return *(const SHORT*)pFormat; size = *(const unsigned short*)pFormat;
pFormat += 2;
pFormat = get_arm_offset_from_union_arm_selector(pStubMsg, discriminant, pFormat);
if(!pFormat)
return 0;
pStubMsg->Memory += size;
type = *(const unsigned short*)pFormat;
if((type & 0xff00) == 0x8000)
{
return NdrBaseTypeMemorySize(pStubMsg, pFormat);
}
else
{
PFORMAT_STRING desc = pFormat + *(const SHORT*)pFormat;
NDR_MEMORYSIZE m = NdrMemorySizer[*desc & NDR_TABLE_MASK];
unsigned char *saved_buffer;
if (m)
{
switch(*desc)
{
case RPC_FC_RP:
case RPC_FC_UP:
case RPC_FC_OP:
case RPC_FC_FP:
ALIGN_POINTER(pStubMsg->Buffer, 4);
saved_buffer = pStubMsg->Buffer;
pStubMsg->Buffer += 4;
ALIGN_LENGTH(pStubMsg->MemorySize, 4);
pStubMsg->MemorySize += 4;
PointerMemorySize(pStubMsg, saved_buffer, pFormat);
break;
default:
return m(pStubMsg, desc);
}
}
else FIXME("no marshaller for embedded type %02x\n", *desc);
}
TRACE("size %d\n", size);
return size;
} }
/*********************************************************************** /***********************************************************************