Robert Shearman : rpcrt4: Implement fixed array functions.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue May 16 06:25:13 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 0f7e4a877a11039cb67c2abba7f40f78abc2fccc
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=0f7e4a877a11039cb67c2abba7f40f78abc2fccc
Author: Robert Shearman <rob at codeweavers.com>
Date: Mon May 15 16:57:21 2006 +0100
rpcrt4: Implement fixed array functions.
---
dlls/rpcrt4/ndr_marshall.c | 167 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 161 insertions(+), 6 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index c947ec5..312af8f 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -3188,6 +3188,20 @@ void WINAPI NdrConformantVaryingStructFr
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
}
+typedef struct
+{
+ unsigned char type;
+ unsigned char alignment;
+ unsigned short total_size;
+} NDR_SMFARRAY_FORMAT;
+
+typedef struct
+{
+ unsigned char type;
+ unsigned char alignment;
+ unsigned long total_size;
+} NDR_LGFARRAY_FORMAT;
+
/***********************************************************************
* NdrFixedArrayMarshall [RPCRT4.@]
*/
@@ -3195,7 +3209,37 @@ unsigned char * WINAPI NdrFixedArrayMar
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
- FIXME("stub\n");
+ const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat;
+ unsigned long total_size;
+
+ TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
+
+ if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ {
+ ERR("invalid format type %x\n", pSmFArrayFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return NULL;
+ }
+
+ ALIGN_POINTER(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1);
+
+ if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ {
+ total_size = pSmFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pSmFArrayFormat + 1);
+ }
+ else
+ {
+ const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
+ total_size = pLgFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pLgFArrayFormat + 1);
+ }
+ memcpy(pStubMsg->Buffer, pMemory, total_size);
+ pStubMsg->Buffer += total_size;
+
+ pFormat = EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
+
return NULL;
}
@@ -3207,7 +3251,40 @@ unsigned char * WINAPI NdrFixedArrayUnm
PFORMAT_STRING pFormat,
unsigned char fMustAlloc)
{
- FIXME("stub\n");
+ const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat;
+ unsigned long total_size;
+
+ TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
+
+ if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ {
+ ERR("invalid format type %x\n", pSmFArrayFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return NULL;
+ }
+
+ ALIGN_POINTER(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1);
+
+ if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ {
+ total_size = pSmFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pSmFArrayFormat + 1);
+ }
+ else
+ {
+ const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
+ total_size = pLgFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pLgFArrayFormat + 1);
+ }
+
+ if (fMustAlloc || !*ppMemory)
+ *ppMemory = NdrAllocate(pStubMsg, total_size);
+ memcpy(*ppMemory, pStubMsg->Buffer, total_size);
+ pStubMsg->Buffer += total_size;
+
+ pFormat = EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
+
return NULL;
}
@@ -3218,7 +3295,35 @@ void WINAPI NdrFixedArrayBufferSize(PMID
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
- FIXME("stub\n");
+ const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat;
+ unsigned long total_size;
+
+ TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
+
+ if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ {
+ ERR("invalid format type %x\n", pSmFArrayFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return;
+ }
+
+ ALIGN_LENGTH(pStubMsg->BufferLength, pSmFArrayFormat->alignment + 1);
+
+ if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ {
+ total_size = pSmFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pSmFArrayFormat + 1);
+ }
+ else
+ {
+ const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
+ total_size = pLgFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pLgFArrayFormat + 1);
+ }
+ pStubMsg->BufferLength += total_size;
+
+ EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
}
/***********************************************************************
@@ -3227,8 +3332,38 @@ void WINAPI NdrFixedArrayBufferSize(PMID
unsigned long WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
- FIXME("stub\n");
- return 0;
+ const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat;
+ unsigned long total_size;
+
+ TRACE("(%p, %p)\n", pStubMsg, pFormat);
+
+ if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ {
+ ERR("invalid format type %x\n", pSmFArrayFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return 0;
+ }
+
+ ALIGN_POINTER(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1);
+
+ if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ {
+ total_size = pSmFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pSmFArrayFormat + 1);
+ }
+ else
+ {
+ const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
+ total_size = pLgFArrayFormat->total_size;
+ pFormat = (unsigned char *)(pLgFArrayFormat + 1);
+ }
+ pStubMsg->Buffer += total_size;
+ pStubMsg->MemorySize += total_size;
+
+ EmbeddedPointerMemorySize(pStubMsg, pFormat);
+
+ return total_size;
}
/***********************************************************************
@@ -3238,7 +3373,27 @@ void WINAPI NdrFixedArrayFree(PMIDL_STUB
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
- FIXME("stub\n");
+ const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat;
+
+ TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
+
+ if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ {
+ ERR("invalid format type %x\n", pSmFArrayFormat->type);
+ RpcRaiseException(RPC_S_INTERNAL_ERROR);
+ return;
+ }
+
+ if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ pFormat = (unsigned char *)(pSmFArrayFormat + 1);
+ else
+ {
+ const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
+ pFormat = (unsigned char *)(pLgFArrayFormat + 1);
+ }
+
+ EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
}
/***********************************************************************
More information about the wine-cvs
mailing list