2002-10-22 02:41:17 +02:00
|
|
|
/*
|
|
|
|
* NDR data marshalling
|
|
|
|
*
|
|
|
|
* Copyright 2002 Greg Turner
|
2006-05-19 12:03:06 +02:00
|
|
|
* Copyright 2003-2006 CodeWeavers
|
2002-10-22 02:41:17 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-10-22 02:41:17 +02:00
|
|
|
*
|
|
|
|
* TODO:
|
2006-05-19 12:03:06 +02:00
|
|
|
* - Non-conformant strings
|
|
|
|
* - String structs
|
|
|
|
* - Encapsulated unions
|
|
|
|
* - Byte count pointers
|
|
|
|
* - transmit_as/represent as
|
|
|
|
* - Multi-dimensional arrays
|
|
|
|
* - Conversion functions (NdrConvert)
|
2006-06-10 13:33:01 +02:00
|
|
|
* - Checks for integer addition overflow
|
2006-05-19 12:03:06 +02:00
|
|
|
* - Checks for out-of-memory conditions
|
2002-10-22 02:41:17 +02:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2002-10-22 02:41:17 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2002-10-25 21:03:43 +02:00
|
|
|
#include <assert.h>
|
2006-03-01 13:21:56 +01:00
|
|
|
#include <limits.h>
|
2002-10-22 02:41:17 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
|
2002-10-25 21:03:43 +02:00
|
|
|
#include "ndr_misc.h"
|
2002-11-01 00:35:46 +01:00
|
|
|
#include "rpcndr.h"
|
2002-10-25 21:03:43 +02:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
#include "wine/unicode.h"
|
2002-10-25 21:03:43 +02:00
|
|
|
#include "wine/rpcfc.h"
|
2002-10-22 02:41:17 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2006-06-01 06:09:49 +02:00
|
|
|
#include "wine/list.h"
|
2002-10-22 02:41:17 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|
|
|
|
2002-10-28 19:47:41 +01:00
|
|
|
#if defined(__i386__)
|
2005-03-02 13:23:20 +01:00
|
|
|
# define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32) \
|
2002-11-01 00:35:46 +01:00
|
|
|
(*((UINT32 *)(pchar)) = (uint32))
|
2002-10-28 19:47:41 +01:00
|
|
|
|
2005-03-02 13:23:20 +01:00
|
|
|
# define LITTLE_ENDIAN_UINT32_READ(pchar) \
|
2002-10-28 19:47:41 +01:00
|
|
|
(*((UINT32 *)(pchar)))
|
|
|
|
#else
|
|
|
|
/* these would work for i386 too, but less efficient */
|
2005-03-02 13:23:20 +01:00
|
|
|
# define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32) \
|
2002-11-01 00:35:46 +01:00
|
|
|
(*(pchar) = LOBYTE(LOWORD(uint32)), \
|
|
|
|
*((pchar)+1) = HIBYTE(LOWORD(uint32)), \
|
|
|
|
*((pchar)+2) = LOBYTE(HIWORD(uint32)), \
|
|
|
|
*((pchar)+3) = HIBYTE(HIWORD(uint32)), \
|
|
|
|
(uint32)) /* allow as r-value */
|
2002-10-28 19:47:41 +01:00
|
|
|
|
2005-03-02 13:23:20 +01:00
|
|
|
# define LITTLE_ENDIAN_UINT32_READ(pchar) \
|
2002-10-28 19:47:41 +01:00
|
|
|
(MAKELONG( \
|
2002-10-30 21:26:51 +01:00
|
|
|
MAKEWORD(*(pchar), *((pchar)+1)), \
|
|
|
|
MAKEWORD(*((pchar)+2), *((pchar)+3))))
|
2002-10-28 19:47:41 +01:00
|
|
|
#endif
|
|
|
|
|
2002-11-01 00:35:46 +01:00
|
|
|
#define BIG_ENDIAN_UINT32_WRITE(pchar, uint32) \
|
|
|
|
(*((pchar)+3) = LOBYTE(LOWORD(uint32)), \
|
|
|
|
*((pchar)+2) = HIBYTE(LOWORD(uint32)), \
|
|
|
|
*((pchar)+1) = LOBYTE(HIWORD(uint32)), \
|
|
|
|
*(pchar) = HIBYTE(HIWORD(uint32)), \
|
|
|
|
(uint32)) /* allow as r-value */
|
|
|
|
|
|
|
|
#define BIG_ENDIAN_UINT32_READ(pchar) \
|
|
|
|
(MAKELONG( \
|
2002-11-01 02:47:04 +01:00
|
|
|
MAKEWORD(*((pchar)+3), *((pchar)+2)), \
|
2002-11-01 00:35:46 +01:00
|
|
|
MAKEWORD(*((pchar)+1), *(pchar))))
|
|
|
|
|
|
|
|
#ifdef NDR_LOCAL_IS_BIG_ENDIAN
|
2005-03-02 13:23:20 +01:00
|
|
|
# define NDR_LOCAL_UINT32_WRITE(pchar, uint32) \
|
2002-11-01 00:35:46 +01:00
|
|
|
BIG_ENDIAN_UINT32_WRITE(pchar, uint32)
|
2005-03-02 13:23:20 +01:00
|
|
|
# define NDR_LOCAL_UINT32_READ(pchar) \
|
2002-11-01 00:35:46 +01:00
|
|
|
BIG_ENDIAN_UINT32_READ(pchar)
|
|
|
|
#else
|
2005-03-02 13:23:20 +01:00
|
|
|
# define NDR_LOCAL_UINT32_WRITE(pchar, uint32) \
|
2002-11-01 00:35:46 +01:00
|
|
|
LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32)
|
2005-03-02 13:23:20 +01:00
|
|
|
# define NDR_LOCAL_UINT32_READ(pchar) \
|
2002-11-01 00:35:46 +01:00
|
|
|
LITTLE_ENDIAN_UINT32_READ(pchar)
|
|
|
|
#endif
|
|
|
|
|
2006-05-10 14:12:07 +02:00
|
|
|
/* _Align must be the desired alignment,
|
|
|
|
* e.g. ALIGN_LENGTH(len, 4) to align on a dword boundary. */
|
|
|
|
#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align)-1)&~((_Align)-1))
|
2003-02-11 23:20:24 +01:00
|
|
|
#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
|
2003-02-01 01:44:51 +01:00
|
|
|
#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
|
|
|
|
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
#define STD_OVERFLOW_CHECK(_Msg) do { \
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("buffer=%d/%d\n", _Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer, _Msg->BufferLength); \
|
2005-11-29 10:41:17 +01:00
|
|
|
if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \
|
|
|
|
ERR("buffer overflow %d bytes\n", _Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength)); \
|
2003-02-17 02:48:24 +01:00
|
|
|
} while (0)
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
#define NDR_TABLE_SIZE 128
|
|
|
|
#define NDR_TABLE_MASK 127
|
|
|
|
|
2005-11-28 11:24:21 +01:00
|
|
|
static unsigned char *WINAPI NdrBaseTypeMarshall(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
|
|
|
|
static unsigned char *WINAPI NdrBaseTypeUnmarshall(PMIDL_STUB_MESSAGE, unsigned char **, PFORMAT_STRING, unsigned char);
|
|
|
|
static void WINAPI NdrBaseTypeBufferSize(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
|
|
|
|
static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
|
2006-11-09 23:02:49 +01:00
|
|
|
static ULONG WINAPI NdrBaseTypeMemorySize(PMIDL_STUB_MESSAGE, PFORMAT_STRING);
|
2005-11-28 11:24:21 +01:00
|
|
|
|
2006-04-14 14:38:41 +02:00
|
|
|
const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = {
|
2003-02-01 01:44:51 +01:00
|
|
|
0,
|
2005-11-28 11:24:21 +01:00
|
|
|
NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
|
|
|
|
NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
|
|
|
|
NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
|
|
|
|
NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall,
|
|
|
|
/* 0x10 */
|
|
|
|
NdrBaseTypeMarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x11 */
|
|
|
|
NdrPointerMarshall, NdrPointerMarshall,
|
|
|
|
NdrPointerMarshall, NdrPointerMarshall,
|
|
|
|
/* 0x15 */
|
|
|
|
NdrSimpleStructMarshall, NdrSimpleStructMarshall,
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantStructMarshall, NdrConformantStructMarshall,
|
|
|
|
NdrConformantVaryingStructMarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexStructMarshall,
|
|
|
|
/* 0x1b */
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantArrayMarshall,
|
|
|
|
NdrConformantVaryingArrayMarshall,
|
|
|
|
NdrFixedArrayMarshall, NdrFixedArrayMarshall,
|
|
|
|
NdrVaryingArrayMarshall, NdrVaryingArrayMarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexArrayMarshall,
|
|
|
|
/* 0x22 */
|
|
|
|
NdrConformantStringMarshall, 0, 0,
|
2005-08-03 16:55:57 +02:00
|
|
|
NdrConformantStringMarshall,
|
|
|
|
NdrNonConformantStringMarshall, 0, 0, 0,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2a */
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrEncapsulatedUnionMarshall,
|
|
|
|
NdrNonEncapsulatedUnionMarshall,
|
2006-05-17 15:45:40 +02:00
|
|
|
NdrByteCountPointerMarshall,
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrXmitOrRepAsMarshall, NdrXmitOrRepAsMarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2f */
|
|
|
|
NdrInterfacePointerMarshall,
|
|
|
|
/* 0xb0 */
|
|
|
|
0, 0, 0, 0,
|
|
|
|
NdrUserMarshalMarshall
|
|
|
|
};
|
2006-04-14 14:38:41 +02:00
|
|
|
const NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE] = {
|
2003-02-01 01:44:51 +01:00
|
|
|
0,
|
2005-11-28 11:24:21 +01:00
|
|
|
NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
|
|
|
|
NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
|
|
|
|
NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
|
|
|
|
NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall, NdrBaseTypeUnmarshall,
|
|
|
|
/* 0x10 */
|
|
|
|
NdrBaseTypeUnmarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x11 */
|
|
|
|
NdrPointerUnmarshall, NdrPointerUnmarshall,
|
|
|
|
NdrPointerUnmarshall, NdrPointerUnmarshall,
|
|
|
|
/* 0x15 */
|
|
|
|
NdrSimpleStructUnmarshall, NdrSimpleStructUnmarshall,
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantStructUnmarshall, NdrConformantStructUnmarshall,
|
|
|
|
NdrConformantVaryingStructUnmarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexStructUnmarshall,
|
|
|
|
/* 0x1b */
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantArrayUnmarshall,
|
|
|
|
NdrConformantVaryingArrayUnmarshall,
|
|
|
|
NdrFixedArrayUnmarshall, NdrFixedArrayUnmarshall,
|
|
|
|
NdrVaryingArrayUnmarshall, NdrVaryingArrayUnmarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexArrayUnmarshall,
|
|
|
|
/* 0x22 */
|
|
|
|
NdrConformantStringUnmarshall, 0, 0,
|
2005-08-03 16:55:57 +02:00
|
|
|
NdrConformantStringUnmarshall,
|
|
|
|
NdrNonConformantStringUnmarshall, 0, 0, 0,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2a */
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrEncapsulatedUnionUnmarshall,
|
|
|
|
NdrNonEncapsulatedUnionUnmarshall,
|
2006-05-17 15:45:40 +02:00
|
|
|
NdrByteCountPointerUnmarshall,
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrXmitOrRepAsUnmarshall, NdrXmitOrRepAsUnmarshall,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2f */
|
|
|
|
NdrInterfacePointerUnmarshall,
|
|
|
|
/* 0xb0 */
|
|
|
|
0, 0, 0, 0,
|
|
|
|
NdrUserMarshalUnmarshall
|
|
|
|
};
|
2006-04-14 14:38:41 +02:00
|
|
|
const NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE] = {
|
2003-02-01 01:44:51 +01:00
|
|
|
0,
|
2005-11-28 11:24:21 +01:00
|
|
|
NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
|
|
|
|
NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
|
|
|
|
NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
|
|
|
|
NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize, NdrBaseTypeBufferSize,
|
|
|
|
/* 0x10 */
|
|
|
|
NdrBaseTypeBufferSize,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x11 */
|
|
|
|
NdrPointerBufferSize, NdrPointerBufferSize,
|
|
|
|
NdrPointerBufferSize, NdrPointerBufferSize,
|
|
|
|
/* 0x15 */
|
|
|
|
NdrSimpleStructBufferSize, NdrSimpleStructBufferSize,
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantStructBufferSize, NdrConformantStructBufferSize,
|
|
|
|
NdrConformantVaryingStructBufferSize,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexStructBufferSize,
|
|
|
|
/* 0x1b */
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantArrayBufferSize,
|
|
|
|
NdrConformantVaryingArrayBufferSize,
|
|
|
|
NdrFixedArrayBufferSize, NdrFixedArrayBufferSize,
|
|
|
|
NdrVaryingArrayBufferSize, NdrVaryingArrayBufferSize,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexArrayBufferSize,
|
|
|
|
/* 0x22 */
|
|
|
|
NdrConformantStringBufferSize, 0, 0,
|
2005-08-03 16:55:57 +02:00
|
|
|
NdrConformantStringBufferSize,
|
|
|
|
NdrNonConformantStringBufferSize, 0, 0, 0,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2a */
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrEncapsulatedUnionBufferSize,
|
|
|
|
NdrNonEncapsulatedUnionBufferSize,
|
2006-05-17 15:45:40 +02:00
|
|
|
NdrByteCountPointerBufferSize,
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrXmitOrRepAsBufferSize, NdrXmitOrRepAsBufferSize,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2f */
|
|
|
|
NdrInterfacePointerBufferSize,
|
|
|
|
/* 0xb0 */
|
|
|
|
0, 0, 0, 0,
|
|
|
|
NdrUserMarshalBufferSize
|
|
|
|
};
|
2006-04-14 14:38:41 +02:00
|
|
|
const NDR_MEMORYSIZE NdrMemorySizer[NDR_TABLE_SIZE] = {
|
2003-02-01 01:44:51 +01:00
|
|
|
0,
|
2005-11-28 11:24:21 +01:00
|
|
|
NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
|
|
|
|
NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
|
|
|
|
NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
|
|
|
|
NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize, NdrBaseTypeMemorySize,
|
|
|
|
/* 0x10 */
|
|
|
|
NdrBaseTypeMemorySize,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x11 */
|
|
|
|
NdrPointerMemorySize, NdrPointerMemorySize,
|
|
|
|
NdrPointerMemorySize, NdrPointerMemorySize,
|
|
|
|
/* 0x15 */
|
|
|
|
NdrSimpleStructMemorySize, NdrSimpleStructMemorySize,
|
2006-05-17 15:45:40 +02:00
|
|
|
NdrConformantStructMemorySize, NdrConformantStructMemorySize,
|
|
|
|
NdrConformantVaryingStructMemorySize,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexStructMemorySize,
|
|
|
|
/* 0x1b */
|
2006-05-17 15:45:40 +02:00
|
|
|
NdrConformantArrayMemorySize,
|
|
|
|
NdrConformantVaryingArrayMemorySize,
|
|
|
|
NdrFixedArrayMemorySize, NdrFixedArrayMemorySize,
|
|
|
|
NdrVaryingArrayMemorySize, NdrVaryingArrayMemorySize,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexArrayMemorySize,
|
|
|
|
/* 0x22 */
|
|
|
|
NdrConformantStringMemorySize, 0, 0,
|
2005-08-03 16:55:57 +02:00
|
|
|
NdrConformantStringMemorySize,
|
|
|
|
NdrNonConformantStringMemorySize, 0, 0, 0,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2a */
|
2006-05-17 15:45:40 +02:00
|
|
|
NdrEncapsulatedUnionMemorySize,
|
|
|
|
NdrNonEncapsulatedUnionMemorySize,
|
|
|
|
NdrByteCountPointerMemorySize,
|
|
|
|
NdrXmitOrRepAsMemorySize, NdrXmitOrRepAsMemorySize,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2f */
|
|
|
|
NdrInterfacePointerMemorySize,
|
|
|
|
/* 0xb0 */
|
|
|
|
0, 0, 0, 0,
|
|
|
|
NdrUserMarshalMemorySize
|
|
|
|
};
|
2006-04-14 14:38:41 +02:00
|
|
|
const NDR_FREE NdrFreer[NDR_TABLE_SIZE] = {
|
2003-02-01 01:44:51 +01:00
|
|
|
0,
|
2005-11-28 11:24:21 +01:00
|
|
|
NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
|
|
|
|
NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
|
|
|
|
NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
|
|
|
|
NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree, NdrBaseTypeFree,
|
|
|
|
/* 0x10 */
|
|
|
|
NdrBaseTypeFree,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x11 */
|
|
|
|
NdrPointerFree, NdrPointerFree,
|
|
|
|
NdrPointerFree, NdrPointerFree,
|
|
|
|
/* 0x15 */
|
|
|
|
NdrSimpleStructFree, NdrSimpleStructFree,
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantStructFree, NdrConformantStructFree,
|
|
|
|
NdrConformantVaryingStructFree,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexStructFree,
|
|
|
|
/* 0x1b */
|
2005-07-18 15:14:05 +02:00
|
|
|
NdrConformantArrayFree,
|
|
|
|
NdrConformantVaryingArrayFree,
|
|
|
|
NdrFixedArrayFree, NdrFixedArrayFree,
|
|
|
|
NdrVaryingArrayFree, NdrVaryingArrayFree,
|
2003-02-01 01:44:51 +01:00
|
|
|
NdrComplexArrayFree,
|
|
|
|
/* 0x22 */
|
2005-07-18 15:14:05 +02:00
|
|
|
0, 0, 0,
|
2003-02-01 01:44:51 +01:00
|
|
|
0, 0, 0, 0, 0,
|
2005-07-18 15:14:05 +02:00
|
|
|
/* 0x2a */
|
|
|
|
NdrEncapsulatedUnionFree,
|
|
|
|
NdrNonEncapsulatedUnionFree,
|
|
|
|
0,
|
|
|
|
NdrXmitOrRepAsFree, NdrXmitOrRepAsFree,
|
2003-02-01 01:44:51 +01:00
|
|
|
/* 0x2f */
|
|
|
|
NdrInterfacePointerFree,
|
|
|
|
/* 0xb0 */
|
|
|
|
0, 0, 0, 0,
|
|
|
|
NdrUserMarshalFree
|
|
|
|
};
|
|
|
|
|
|
|
|
void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, size_t len)
|
|
|
|
{
|
|
|
|
/* hmm, this is probably supposed to do more? */
|
|
|
|
return pStubMsg->pfnAllocate(len);
|
|
|
|
}
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
static void WINAPI NdrFree(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *Pointer)
|
|
|
|
{
|
|
|
|
pStubMsg->pfnFree(Pointer);
|
|
|
|
}
|
|
|
|
|
2006-01-06 21:07:27 +01:00
|
|
|
static inline BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
return (*(const ULONG *)pFormat != -1);
|
|
|
|
}
|
|
|
|
|
2006-05-23 13:06:23 +02:00
|
|
|
static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
2006-05-10 14:13:25 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount);
|
2006-01-20 16:15:11 +01:00
|
|
|
if (pStubMsg->fHasNewCorrDesc)
|
|
|
|
return pFormat+6;
|
|
|
|
else
|
|
|
|
return pFormat+4;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:32:47 +02:00
|
|
|
static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, ULONG MaxValue)
|
2005-11-28 11:16:44 +01:00
|
|
|
{
|
2006-05-13 17:58:31 +02:00
|
|
|
if (pFormat && !IsConformanceOrVariancePresent(pFormat))
|
2006-01-09 17:21:01 +01:00
|
|
|
{
|
|
|
|
pStubMsg->Offset = 0;
|
|
|
|
pStubMsg->ActualCount = pStubMsg->MaxCount;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2006-05-10 14:13:25 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
2006-01-09 17:21:01 +01:00
|
|
|
pStubMsg->Offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
|
|
|
|
pStubMsg->Buffer += 4;
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("offset is %d\n", pStubMsg->Offset);
|
2005-11-28 11:16:44 +01:00
|
|
|
pStubMsg->ActualCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
|
|
|
|
pStubMsg->Buffer += 4;
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("variance is %d\n", pStubMsg->ActualCount);
|
2006-01-09 17:21:01 +01:00
|
|
|
|
2006-06-10 13:32:47 +02:00
|
|
|
if ((pStubMsg->ActualCount > MaxValue) ||
|
|
|
|
(pStubMsg->ActualCount + pStubMsg->Offset > MaxValue))
|
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
ERR("invalid array bound(s): ActualCount = %d, Offset = %d, MaxValue = %d\n",
|
2006-06-10 13:32:47 +02:00
|
|
|
pStubMsg->ActualCount, pStubMsg->Offset, MaxValue);
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-01-09 17:21:01 +01:00
|
|
|
done:
|
2006-01-20 16:15:11 +01:00
|
|
|
if (pStubMsg->fHasNewCorrDesc)
|
|
|
|
return pFormat+6;
|
|
|
|
else
|
|
|
|
return pFormat+4;
|
2005-11-28 11:16:44 +01:00
|
|
|
}
|
|
|
|
|
2006-05-10 14:13:15 +02:00
|
|
|
/* writes the conformance value to the buffer */
|
|
|
|
static inline void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg)
|
|
|
|
{
|
2006-05-10 14:13:25 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
2006-05-10 14:13:15 +02:00
|
|
|
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount);
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* writes the variance values to the buffer */
|
|
|
|
static inline void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg)
|
|
|
|
{
|
2006-05-10 14:13:25 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
2006-05-10 14:13:15 +02:00
|
|
|
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset);
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount);
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* requests buffer space for the conformance value */
|
|
|
|
static inline void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg)
|
|
|
|
{
|
2006-05-10 14:13:25 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, 4);
|
2006-05-10 14:13:15 +02:00
|
|
|
pStubMsg->BufferLength += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* requests buffer space for the variance values */
|
|
|
|
static inline void SizeVariance(MIDL_STUB_MESSAGE *pStubMsg)
|
|
|
|
{
|
2006-05-10 14:13:25 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, 4);
|
2006-05-10 14:13:15 +02:00
|
|
|
pStubMsg->BufferLength += 8;
|
|
|
|
}
|
|
|
|
|
2005-11-28 11:16:44 +01:00
|
|
|
PFORMAT_STRING ComputeConformanceOrVariance(
|
|
|
|
MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
|
2006-11-09 23:02:49 +01:00
|
|
|
PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
|
|
|
BYTE dtype = pFormat[0] & 0xf;
|
2006-09-25 23:20:20 +02:00
|
|
|
short ofs = *(const short *)&pFormat[2];
|
2003-02-01 01:44:51 +01:00
|
|
|
LPVOID ptr = NULL;
|
|
|
|
DWORD data = 0;
|
|
|
|
|
2006-01-06 21:07:27 +01:00
|
|
|
if (!IsConformanceOrVariancePresent(pFormat)) {
|
2003-02-01 01:44:51 +01:00
|
|
|
/* null descriptor */
|
2005-11-28 11:16:44 +01:00
|
|
|
*pCount = def;
|
2003-02-01 01:44:51 +01:00
|
|
|
goto finish_conf;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (pFormat[0] & 0xf0) {
|
|
|
|
case RPC_FC_NORMAL_CONFORMANCE:
|
2005-11-28 10:58:40 +01:00
|
|
|
TRACE("normal conformance, ofs=%d\n", ofs);
|
2006-04-20 12:45:40 +02:00
|
|
|
ptr = pMemory;
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_POINTER_CONFORMANCE:
|
2005-11-28 10:58:40 +01:00
|
|
|
TRACE("pointer conformance, ofs=%d\n", ofs);
|
2006-04-20 12:45:40 +02:00
|
|
|
ptr = pStubMsg->Memory;
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_TOP_LEVEL_CONFORMANCE:
|
2005-11-28 10:58:40 +01:00
|
|
|
TRACE("toplevel conformance, ofs=%d\n", ofs);
|
2003-02-01 01:44:51 +01:00
|
|
|
if (pStubMsg->StackTop) {
|
2006-04-20 12:45:40 +02:00
|
|
|
ptr = pStubMsg->StackTop;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
else {
|
2005-11-28 11:16:44 +01:00
|
|
|
/* -Os mode, *pCount is already set */
|
2003-02-01 01:44:51 +01:00
|
|
|
goto finish_conf;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RPC_FC_CONSTANT_CONFORMANCE:
|
|
|
|
data = ofs | ((DWORD)pFormat[1] << 16);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("constant conformance, val=%d\n", data);
|
2005-11-28 11:16:44 +01:00
|
|
|
*pCount = data;
|
2003-02-01 01:44:51 +01:00
|
|
|
goto finish_conf;
|
|
|
|
case RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE:
|
2005-11-28 10:58:40 +01:00
|
|
|
FIXME("toplevel multidimensional conformance, ofs=%d\n", ofs);
|
2003-02-01 01:44:51 +01:00
|
|
|
if (pStubMsg->StackTop) {
|
2006-04-20 12:45:40 +02:00
|
|
|
ptr = pStubMsg->StackTop;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* ? */
|
|
|
|
goto done_conf_grab;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unknown conformance type %x\n", pFormat[0] & 0xf0);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (pFormat[1]) {
|
|
|
|
case RPC_FC_DEREFERENCE:
|
2006-04-20 12:45:40 +02:00
|
|
|
ptr = *(LPVOID*)((char *)ptr + ofs);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_CALLBACK:
|
2006-01-03 12:07:17 +01:00
|
|
|
{
|
|
|
|
unsigned char *old_stack_top = pStubMsg->StackTop;
|
|
|
|
pStubMsg->StackTop = ptr;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
/* ofs is index into StubDesc->apfnExprEval */
|
2006-01-03 12:07:17 +01:00
|
|
|
TRACE("callback conformance into apfnExprEval[%d]\n", ofs);
|
|
|
|
pStubMsg->StubDesc->apfnExprEval[ofs](pStubMsg);
|
|
|
|
|
|
|
|
pStubMsg->StackTop = old_stack_top;
|
2006-07-14 01:02:44 +02:00
|
|
|
|
|
|
|
/* the callback function always stores the computed value in MaxCount */
|
|
|
|
*pCount = pStubMsg->MaxCount;
|
2003-02-01 01:44:51 +01:00
|
|
|
goto finish_conf;
|
2006-01-03 12:07:17 +01:00
|
|
|
}
|
2003-02-01 01:44:51 +01:00
|
|
|
default:
|
2006-04-20 12:45:40 +02:00
|
|
|
ptr = (char *)ptr + ofs;
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (dtype) {
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
|
|
|
data = *(DWORD*)ptr;
|
|
|
|
break;
|
|
|
|
case RPC_FC_SHORT:
|
|
|
|
data = *(SHORT*)ptr;
|
|
|
|
break;
|
|
|
|
case RPC_FC_USHORT:
|
|
|
|
data = *(USHORT*)ptr;
|
|
|
|
break;
|
2006-05-15 17:56:45 +02:00
|
|
|
case RPC_FC_CHAR:
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_SMALL:
|
|
|
|
data = *(CHAR*)ptr;
|
|
|
|
break;
|
2006-05-15 17:56:45 +02:00
|
|
|
case RPC_FC_BYTE:
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_USMALL:
|
|
|
|
data = *(UCHAR*)ptr;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unknown conformance data type %x\n", dtype);
|
|
|
|
goto done_conf_grab;
|
|
|
|
}
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("dereferenced data type %x at %p, got %d\n", dtype, ptr, data);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
done_conf_grab:
|
|
|
|
switch (pFormat[1]) {
|
2006-05-26 16:50:49 +02:00
|
|
|
case RPC_FC_DEREFERENCE: /* already handled */
|
2003-02-01 01:44:51 +01:00
|
|
|
case 0: /* no op */
|
2005-11-28 11:16:44 +01:00
|
|
|
*pCount = data;
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2006-05-15 17:56:45 +02:00
|
|
|
case RPC_FC_ADD_1:
|
|
|
|
*pCount = data + 1;
|
|
|
|
break;
|
|
|
|
case RPC_FC_SUB_1:
|
|
|
|
*pCount = data - 1;
|
|
|
|
break;
|
|
|
|
case RPC_FC_MULT_2:
|
|
|
|
*pCount = data * 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_DIV_2:
|
|
|
|
*pCount = data / 2;
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
default:
|
|
|
|
FIXME("unknown conformance op %d\n", pFormat[1]);
|
|
|
|
goto finish_conf;
|
|
|
|
}
|
|
|
|
|
|
|
|
finish_conf:
|
2005-11-28 11:16:44 +01:00
|
|
|
TRACE("resulting conformance is %ld\n", *pCount);
|
2006-01-20 16:15:11 +01:00
|
|
|
if (pStubMsg->fHasNewCorrDesc)
|
|
|
|
return pFormat+6;
|
|
|
|
else
|
|
|
|
return pFormat+4;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
2006-06-10 13:31:45 +02:00
|
|
|
/* multiply two numbers together, raising an RPC_S_INVALID_BOUND exception if
|
|
|
|
* the result overflows 32-bits */
|
2007-03-22 19:26:46 +01:00
|
|
|
static inline ULONG safe_multiply(ULONG a, ULONG b)
|
2006-06-10 13:31:45 +02:00
|
|
|
{
|
|
|
|
ULONGLONG ret = (ULONGLONG)a * b;
|
|
|
|
if (ret > 0xffffffff)
|
|
|
|
{
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2002-10-30 00:07:33 +01:00
|
|
|
/*
|
|
|
|
* NdrConformantString:
|
|
|
|
*
|
|
|
|
* What MS calls a ConformantString is, in DCE terminology,
|
2002-10-31 23:45:12 +01:00
|
|
|
* a Varying-Conformant String.
|
2002-10-30 00:07:33 +01:00
|
|
|
* [
|
|
|
|
* maxlen: DWORD (max # of CHARTYPE characters, inclusive of '\0')
|
2002-10-31 23:45:12 +01:00
|
|
|
* offset: DWORD (actual string data begins at (offset) CHARTYPE's
|
|
|
|
* into unmarshalled string)
|
2002-10-30 00:07:33 +01:00
|
|
|
* length: DWORD (# of CHARTYPE characters, inclusive of '\0')
|
|
|
|
* [
|
|
|
|
* data: CHARTYPE[maxlen]
|
|
|
|
* ]
|
|
|
|
* ], where CHARTYPE is the appropriate character type (specified externally)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2002-10-22 02:41:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantStringMarshall [RPCRT4.@]
|
|
|
|
*/
|
2002-11-01 00:35:46 +01:00
|
|
|
unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg,
|
|
|
|
unsigned char *pszMessage, PFORMAT_STRING pFormat)
|
2002-10-22 02:41:17 +02:00
|
|
|
{
|
2006-06-10 13:31:45 +02:00
|
|
|
ULONG esize, size;
|
2002-10-25 21:03:43 +02:00
|
|
|
|
|
|
|
TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat);
|
|
|
|
|
|
|
|
if (*pFormat == RPC_FC_C_CSTRING) {
|
2005-08-30 10:56:35 +02:00
|
|
|
TRACE("string=%s\n", debugstr_a((char*)pszMessage));
|
2006-05-15 17:57:13 +02:00
|
|
|
pStubMsg->ActualCount = strlen((char*)pszMessage)+1;
|
2003-02-01 01:44:51 +01:00
|
|
|
esize = 1;
|
|
|
|
}
|
|
|
|
else if (*pFormat == RPC_FC_C_WSTRING) {
|
|
|
|
TRACE("string=%s\n", debugstr_w((LPWSTR)pszMessage));
|
2006-05-15 17:57:13 +02:00
|
|
|
pStubMsg->ActualCount = strlenW((LPWSTR)pszMessage)+1;
|
2003-02-01 01:44:51 +01:00
|
|
|
esize = 2;
|
|
|
|
}
|
|
|
|
else {
|
2002-10-25 21:03:43 +02:00
|
|
|
ERR("Unhandled string type: %#x\n", *pFormat);
|
2002-10-29 00:53:23 +01:00
|
|
|
/* FIXME: raise an exception. */
|
2002-10-25 21:03:43 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-15 17:57:13 +02:00
|
|
|
if (pFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pszMessage, pFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
2006-05-10 14:13:15 +02:00
|
|
|
pStubMsg->Offset = 0;
|
|
|
|
WriteConformance(pStubMsg);
|
|
|
|
WriteVariance(pStubMsg);
|
|
|
|
|
2006-06-10 13:31:45 +02:00
|
|
|
size = safe_multiply(esize, pStubMsg->ActualCount);
|
|
|
|
memcpy(pStubMsg->Buffer, pszMessage, size); /* the string itself */
|
|
|
|
pStubMsg->Buffer += size;
|
2003-02-17 02:48:24 +01:00
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2002-10-25 21:03:43 +02:00
|
|
|
/* success */
|
|
|
|
return NULL; /* is this always right? */
|
2002-10-22 02:41:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantStringBufferSize [RPCRT4.@]
|
|
|
|
*/
|
2002-11-01 00:35:46 +01:00
|
|
|
void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char* pMemory, PFORMAT_STRING pFormat)
|
2002-10-22 02:41:17 +02:00
|
|
|
{
|
2006-06-10 13:31:45 +02:00
|
|
|
ULONG esize;
|
|
|
|
|
2002-10-25 21:03:43 +02:00
|
|
|
TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-05-10 14:13:15 +02:00
|
|
|
SizeConformance(pStubMsg);
|
|
|
|
SizeVariance(pStubMsg);
|
|
|
|
|
2002-10-25 21:03:43 +02:00
|
|
|
if (*pFormat == RPC_FC_C_CSTRING) {
|
2005-08-30 10:56:35 +02:00
|
|
|
TRACE("string=%s\n", debugstr_a((char*)pMemory));
|
2006-06-10 13:31:45 +02:00
|
|
|
pStubMsg->ActualCount = strlen((char*)pMemory)+1;
|
|
|
|
esize = 1;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
else if (*pFormat == RPC_FC_C_WSTRING) {
|
|
|
|
TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory));
|
2006-06-10 13:31:45 +02:00
|
|
|
pStubMsg->ActualCount = strlenW((LPWSTR)pMemory)+1;
|
|
|
|
esize = 2;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
else {
|
2002-10-25 21:03:43 +02:00
|
|
|
ERR("Unhandled string type: %#x\n", *pFormat);
|
2002-10-29 00:53:23 +01:00
|
|
|
/* FIXME: raise an exception */
|
2006-06-10 13:31:45 +02:00
|
|
|
return;
|
2002-10-25 21:03:43 +02:00
|
|
|
}
|
2006-06-10 13:31:45 +02:00
|
|
|
|
|
|
|
if (pFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
|
|
|
|
|
|
|
pStubMsg->BufferLength += safe_multiply(esize, pStubMsg->ActualCount);
|
2002-10-22 02:41:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* NdrConformantStringMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
|
2002-11-01 00:35:46 +01:00
|
|
|
PFORMAT_STRING pFormat )
|
2002-10-22 02:41:17 +02:00
|
|
|
{
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG rslt = 0;
|
2002-10-30 00:07:33 +01:00
|
|
|
|
2006-07-24 12:45:15 +02:00
|
|
|
FIXME("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat);
|
2006-11-09 23:01:58 +01:00
|
|
|
|
2002-10-30 00:07:33 +01:00
|
|
|
assert(pStubMsg && pFormat);
|
|
|
|
|
|
|
|
if (*pFormat == RPC_FC_C_CSTRING) {
|
2002-11-01 00:35:46 +01:00
|
|
|
rslt = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); /* maxlen */
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
else if (*pFormat == RPC_FC_C_WSTRING) {
|
|
|
|
rslt = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer)*2; /* maxlen */
|
|
|
|
}
|
|
|
|
else {
|
2002-10-30 00:07:33 +01:00
|
|
|
ERR("Unhandled string type: %#x\n", *pFormat);
|
|
|
|
/* FIXME: raise an exception */
|
|
|
|
}
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (pFormat[1] != RPC_FC_PAD) {
|
|
|
|
FIXME("sized string format=%d\n", pFormat[1]);
|
|
|
|
}
|
|
|
|
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE(" --> %u\n", rslt);
|
2002-10-30 00:07:33 +01:00
|
|
|
return rslt;
|
2002-10-22 02:41:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* NdrConformantStringUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
2002-11-01 00:35:46 +01:00
|
|
|
unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc )
|
2002-10-22 02:41:17 +02:00
|
|
|
{
|
2006-07-24 12:45:15 +02:00
|
|
|
ULONG bufsize, memsize, esize, i;
|
2002-10-29 00:53:23 +01:00
|
|
|
|
|
|
|
TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n",
|
2002-10-28 21:07:01 +01:00
|
|
|
pStubMsg, *ppMemory, pFormat, fMustAlloc);
|
2002-10-29 00:53:23 +01:00
|
|
|
|
|
|
|
assert(pFormat && ppMemory && pStubMsg);
|
|
|
|
|
2006-05-13 17:58:31 +02:00
|
|
|
ReadConformance(pStubMsg, NULL);
|
2006-06-10 13:32:47 +02:00
|
|
|
ReadVariance(pStubMsg, NULL, pStubMsg->MaxCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
if (*pFormat == RPC_FC_C_CSTRING) esize = 1;
|
|
|
|
else if (*pFormat == RPC_FC_C_WSTRING) esize = 2;
|
|
|
|
else {
|
|
|
|
ERR("Unhandled string type: %#x\n", *pFormat);
|
2002-10-29 00:53:23 +01:00
|
|
|
/* FIXME: raise an exception */
|
2003-02-01 01:44:51 +01:00
|
|
|
esize = 0;
|
2002-10-29 00:53:23 +01:00
|
|
|
}
|
|
|
|
|
2006-07-24 12:45:15 +02:00
|
|
|
memsize = safe_multiply(esize, pStubMsg->MaxCount);
|
|
|
|
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
2006-05-13 17:58:31 +02:00
|
|
|
|
2006-06-10 13:32:01 +02:00
|
|
|
/* strings must always have null terminating bytes */
|
2006-07-24 12:45:15 +02:00
|
|
|
if (bufsize < esize)
|
2006-06-10 13:32:01 +02:00
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
ERR("invalid string length of %d\n", pStubMsg->ActualCount);
|
2006-06-10 13:32:01 +02:00
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-07-24 12:45:15 +02:00
|
|
|
for (i = bufsize - esize; i < bufsize; i++)
|
2006-06-10 13:32:01 +02:00
|
|
|
if (pStubMsg->Buffer[i] != 0)
|
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
ERR("string not null-terminated at byte position %d, data is 0x%x\n",
|
2006-06-10 13:32:01 +02:00
|
|
|
i, pStubMsg->Buffer[i]);
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-11-28 10:39:10 +01:00
|
|
|
if (fMustAlloc || !*ppMemory)
|
2006-07-24 12:45:15 +02:00
|
|
|
*ppMemory = NdrAllocate(pStubMsg, memsize);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-07-24 12:45:15 +02:00
|
|
|
memcpy(*ppMemory, pStubMsg->Buffer, bufsize);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-07-24 12:45:15 +02:00
|
|
|
pStubMsg->Buffer += bufsize;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2002-10-29 00:53:23 +01:00
|
|
|
if (*pFormat == RPC_FC_C_CSTRING) {
|
2005-11-28 10:39:10 +01:00
|
|
|
TRACE("string=%s\n", debugstr_a((char*)*ppMemory));
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
else if (*pFormat == RPC_FC_C_WSTRING) {
|
2005-11-28 10:39:10 +01:00
|
|
|
TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory));
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
2002-10-29 00:53:23 +01:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL; /* FIXME: is this always right? */
|
|
|
|
}
|
|
|
|
|
2005-08-03 16:55:57 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonConformantStringMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonConformantStringUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonConformantStringBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonConformantStringMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-08-03 16:55:57 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-06-01 13:04:03 +02:00
|
|
|
static inline void dump_pointer_attr(unsigned char attr)
|
|
|
|
{
|
|
|
|
if (attr & RPC_FC_P_ALLOCALLNODES)
|
|
|
|
TRACE(" RPC_FC_P_ALLOCALLNODES");
|
|
|
|
if (attr & RPC_FC_P_DONTFREE)
|
|
|
|
TRACE(" RPC_FC_P_DONTFREE");
|
|
|
|
if (attr & RPC_FC_P_ONSTACK)
|
|
|
|
TRACE(" RPC_FC_P_ONSTACK");
|
|
|
|
if (attr & RPC_FC_P_SIMPLEPOINTER)
|
|
|
|
TRACE(" RPC_FC_P_SIMPLEPOINTER");
|
|
|
|
if (attr & RPC_FC_P_DEREF)
|
|
|
|
TRACE(" RPC_FC_P_DEREF");
|
|
|
|
TRACE("\n");
|
|
|
|
}
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* PointerMarshall [internal]
|
2003-02-01 01:44:51 +01:00
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *Buffer,
|
|
|
|
unsigned char *Pointer,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned type = pFormat[0], attr = pFormat[1];
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_MARSHALL m;
|
2006-11-09 23:02:49 +01:00
|
|
|
ULONG pointer_id;
|
2006-05-29 17:27:27 +02:00
|
|
|
int pointer_needs_marshaling;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p,%p,%p)\n", pStubMsg, Buffer, Pointer, pFormat);
|
2005-06-01 13:04:03 +02:00
|
|
|
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
|
2004-11-30 22:38:57 +01:00
|
|
|
else desc = pFormat + *(const SHORT*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case RPC_FC_RP: /* ref pointer (always non-null) */
|
2005-06-01 13:04:03 +02:00
|
|
|
#if 0 /* this causes problems for InstallShield so is disabled - we need more tests */
|
|
|
|
if (!Pointer)
|
|
|
|
RpcRaiseException(RPC_X_NULL_REF_POINTER);
|
|
|
|
#endif
|
2006-05-29 17:27:27 +02:00
|
|
|
pointer_needs_marshaling = 1;
|
2005-06-01 13:04:03 +02:00
|
|
|
break;
|
|
|
|
case RPC_FC_UP: /* unique pointer */
|
|
|
|
case RPC_FC_OP: /* object pointer - same as unique here */
|
2006-05-29 17:27:27 +02:00
|
|
|
if (Pointer)
|
|
|
|
pointer_needs_marshaling = 1;
|
|
|
|
else
|
|
|
|
pointer_needs_marshaling = 0;
|
2006-11-09 23:02:49 +01:00
|
|
|
pointer_id = (ULONG)Pointer;
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("writing 0x%08x to buffer\n", pointer_id);
|
2006-05-29 17:27:27 +02:00
|
|
|
NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2005-06-01 13:04:03 +02:00
|
|
|
case RPC_FC_FP:
|
2006-05-29 17:27:27 +02:00
|
|
|
pointer_needs_marshaling = !NdrFullPointerQueryPointer(
|
|
|
|
pStubMsg->FullPtrXlatTables, Pointer, 1, &pointer_id);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("writing 0x%08x to buffer\n", pointer_id);
|
2006-05-29 17:27:27 +02:00
|
|
|
NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
default:
|
|
|
|
FIXME("unhandled ptr type=%02x\n", type);
|
2005-06-01 13:04:03 +02:00
|
|
|
RpcRaiseException(RPC_X_BAD_STUB_DATA);
|
2006-05-29 17:27:27 +02:00
|
|
|
return;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
2005-06-01 13:04:03 +02:00
|
|
|
TRACE("calling marshaller for type 0x%x\n", (int)*desc);
|
|
|
|
|
2006-05-29 17:27:27 +02:00
|
|
|
if (pointer_needs_marshaling) {
|
2006-05-01 11:37:11 +02:00
|
|
|
if (attr & RPC_FC_P_DEREF) {
|
|
|
|
Pointer = *(unsigned char**)Pointer;
|
|
|
|
TRACE("deref => %p\n", Pointer);
|
|
|
|
}
|
2005-06-01 13:04:03 +02:00
|
|
|
m = NdrMarshaller[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, Pointer, desc);
|
|
|
|
else FIXME("no marshaller for data type=%02x\n", *desc);
|
|
|
|
}
|
2003-02-17 02:48:24 +01:00
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* PointerUnmarshall [internal]
|
2003-02-01 01:44:51 +01:00
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *Buffer,
|
|
|
|
unsigned char **pPointer,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
|
|
|
unsigned type = pFormat[0], attr = pFormat[1];
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_UNMARSHALL m;
|
2005-06-01 13:04:03 +02:00
|
|
|
DWORD pointer_id = 0;
|
2006-05-29 17:27:27 +02:00
|
|
|
int pointer_needs_unmarshaling;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p,%p,%p,%d)\n", pStubMsg, Buffer, pPointer, pFormat, fMustAlloc);
|
2005-06-01 13:04:03 +02:00
|
|
|
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
|
2004-11-30 22:38:57 +01:00
|
|
|
else desc = pFormat + *(const SHORT*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case RPC_FC_RP: /* ref pointer (always non-null) */
|
2006-05-29 17:27:27 +02:00
|
|
|
pointer_needs_unmarshaling = 1;
|
2005-06-01 13:04:03 +02:00
|
|
|
break;
|
|
|
|
case RPC_FC_UP: /* unique pointer */
|
2006-05-10 14:13:45 +02:00
|
|
|
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("pointer_id is 0x%08x\n", pointer_id);
|
2006-05-29 17:27:27 +02:00
|
|
|
if (pointer_id)
|
|
|
|
pointer_needs_unmarshaling = 1;
|
2006-05-29 17:28:29 +02:00
|
|
|
else {
|
|
|
|
*pPointer = NULL;
|
2006-05-29 17:27:27 +02:00
|
|
|
pointer_needs_unmarshaling = 0;
|
2006-05-29 17:28:29 +02:00
|
|
|
}
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2005-06-01 13:04:03 +02:00
|
|
|
case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
|
2006-05-10 14:13:45 +02:00
|
|
|
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("pointer_id is 0x%08x\n", pointer_id);
|
2006-05-19 17:04:11 +02:00
|
|
|
if (!fMustAlloc && *pPointer)
|
2006-06-09 18:29:28 +02:00
|
|
|
{
|
2005-09-02 13:19:26 +02:00
|
|
|
FIXME("free object pointer %p\n", *pPointer);
|
2006-06-09 18:29:28 +02:00
|
|
|
*pPointer = NULL;
|
|
|
|
}
|
2006-05-29 17:27:27 +02:00
|
|
|
if (pointer_id)
|
|
|
|
pointer_needs_unmarshaling = 1;
|
|
|
|
else
|
|
|
|
pointer_needs_unmarshaling = 0;
|
2005-09-02 13:19:26 +02:00
|
|
|
break;
|
2005-06-01 13:04:03 +02:00
|
|
|
case RPC_FC_FP:
|
2006-05-29 17:27:27 +02:00
|
|
|
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("pointer_id is 0x%08x\n", pointer_id);
|
2006-05-29 17:27:27 +02:00
|
|
|
pointer_needs_unmarshaling = !NdrFullPointerQueryRefId(
|
|
|
|
pStubMsg->FullPtrXlatTables, pointer_id, 1, (void **)pPointer);
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
default:
|
|
|
|
FIXME("unhandled ptr type=%02x\n", type);
|
2005-06-01 13:04:03 +02:00
|
|
|
RpcRaiseException(RPC_X_BAD_STUB_DATA);
|
2006-05-29 17:27:27 +02:00
|
|
|
return;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
2006-05-29 17:27:27 +02:00
|
|
|
if (pointer_needs_unmarshaling) {
|
2006-05-01 11:37:11 +02:00
|
|
|
if (attr & RPC_FC_P_DEREF) {
|
|
|
|
if (!*pPointer || fMustAlloc)
|
|
|
|
*pPointer = NdrAllocate(pStubMsg, sizeof(void *));
|
|
|
|
pPointer = *(unsigned char***)pPointer;
|
|
|
|
TRACE("deref => %p\n", pPointer);
|
|
|
|
}
|
2005-06-01 13:04:03 +02:00
|
|
|
m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, pPointer, desc, fMustAlloc);
|
|
|
|
else FIXME("no unmarshaller for data type=%02x\n", *desc);
|
2006-05-29 17:27:27 +02:00
|
|
|
|
|
|
|
if (type == RPC_FC_FP)
|
|
|
|
NdrFullPointerInsertRefId(pStubMsg->FullPtrXlatTables, pointer_id,
|
|
|
|
*pPointer);
|
2005-06-01 13:04:03 +02:00
|
|
|
}
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("pointer=%p\n", *pPointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* PointerBufferSize [internal]
|
2003-02-01 01:44:51 +01:00
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *Pointer,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned type = pFormat[0], attr = pFormat[1];
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_BUFFERSIZE m;
|
2006-05-29 17:27:27 +02:00
|
|
|
int pointer_needs_sizing;
|
2006-11-09 23:02:49 +01:00
|
|
|
ULONG pointer_id;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
|
2006-05-01 11:36:52 +02:00
|
|
|
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
|
2004-11-30 22:38:57 +01:00
|
|
|
else desc = pFormat + *(const SHORT*)pFormat;
|
2002-10-30 00:07:33 +01:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
switch (type) {
|
|
|
|
case RPC_FC_RP: /* ref pointer (always non-null) */
|
|
|
|
break;
|
2005-06-01 13:04:03 +02:00
|
|
|
case RPC_FC_OP:
|
|
|
|
case RPC_FC_UP:
|
|
|
|
/* NULL pointer has no further representation */
|
|
|
|
if (!Pointer)
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case RPC_FC_FP:
|
2006-05-29 17:27:27 +02:00
|
|
|
pointer_needs_sizing = !NdrFullPointerQueryPointer(
|
|
|
|
pStubMsg->FullPtrXlatTables, Pointer, 0, &pointer_id);
|
|
|
|
if (!pointer_needs_sizing)
|
|
|
|
return;
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
default:
|
|
|
|
FIXME("unhandled ptr type=%02x\n", type);
|
2005-06-01 13:04:03 +02:00
|
|
|
RpcRaiseException(RPC_X_BAD_STUB_DATA);
|
2006-05-29 17:27:27 +02:00
|
|
|
return;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
2006-05-01 11:37:11 +02:00
|
|
|
if (attr & RPC_FC_P_DEREF) {
|
|
|
|
Pointer = *(unsigned char**)Pointer;
|
|
|
|
TRACE("deref => %p\n", Pointer);
|
|
|
|
}
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
m = NdrBufferSizer[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, Pointer, desc);
|
|
|
|
else FIXME("no buffersizer for data type=%02x\n", *desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* PointerMemorySize [internal]
|
2003-02-01 01:44:51 +01:00
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static unsigned long PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *Buffer,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned type = pFormat[0], attr = pFormat[1];
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_MEMORYSIZE m;
|
2002-10-29 00:53:23 +01:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
FIXME("(%p,%p,%p): stub\n", pStubMsg, Buffer, pFormat);
|
2006-05-01 11:36:52 +02:00
|
|
|
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
|
2004-11-30 22:38:57 +01:00
|
|
|
else desc = pFormat + *(const SHORT*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case RPC_FC_RP: /* ref pointer (always non-null) */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unhandled ptr type=%02x\n", type);
|
2005-06-01 13:04:03 +02:00
|
|
|
RpcRaiseException(RPC_X_BAD_STUB_DATA);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
2006-05-01 11:37:11 +02:00
|
|
|
if (attr & RPC_FC_P_DEREF) {
|
|
|
|
TRACE("deref\n");
|
|
|
|
}
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
m = NdrMemorySizer[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, desc);
|
|
|
|
else FIXME("no memorysizer for data type=%02x\n", *desc);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* PointerFree [internal]
|
2003-02-01 01:44:51 +01:00
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *Pointer,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned type = pFormat[0], attr = pFormat[1];
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_FREE m;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
|
2006-05-01 11:36:52 +02:00
|
|
|
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
|
2003-02-01 01:44:51 +01:00
|
|
|
if (attr & RPC_FC_P_DONTFREE) return;
|
|
|
|
pFormat += 2;
|
|
|
|
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
|
2004-11-30 22:38:57 +01:00
|
|
|
else desc = pFormat + *(const SHORT*)pFormat;
|
2006-05-01 11:37:11 +02:00
|
|
|
|
|
|
|
if (!Pointer) return;
|
|
|
|
|
2006-05-29 17:27:27 +02:00
|
|
|
if (type == RPC_FC_FP) {
|
|
|
|
int pointer_needs_freeing = NdrFullPointerFree(
|
|
|
|
pStubMsg->FullPtrXlatTables, Pointer);
|
|
|
|
if (!pointer_needs_freeing)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-05-20 04:17:49 +02:00
|
|
|
if (attr & RPC_FC_P_DEREF) {
|
|
|
|
Pointer = *(unsigned char**)Pointer;
|
|
|
|
TRACE("deref => %p\n", Pointer);
|
|
|
|
}
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
m = NdrFreer[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, Pointer, desc);
|
|
|
|
|
|
|
|
/* hmm... is this sensible?
|
|
|
|
* perhaps we should check if the memory comes from NdrAllocate,
|
|
|
|
* and deallocate only if so - checking if the pointer is between
|
|
|
|
* BufferStart and BufferEnd is probably no good since the buffer
|
|
|
|
* may be reallocated when the server wants to marshal the reply */
|
|
|
|
switch (*desc) {
|
|
|
|
case RPC_FC_BOGUS_STRUCT:
|
|
|
|
case RPC_FC_BOGUS_ARRAY:
|
2003-02-17 02:48:24 +01:00
|
|
|
case RPC_FC_USER_MARSHAL:
|
2006-04-20 12:45:16 +02:00
|
|
|
case RPC_FC_CARRAY:
|
|
|
|
case RPC_FC_CVARRAY:
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unhandled data type=%02x\n", *desc);
|
2006-04-20 12:45:16 +02:00
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_C_CSTRING:
|
|
|
|
case RPC_FC_C_WSTRING:
|
|
|
|
if (pStubMsg->ReuseBuffer) goto notfree;
|
|
|
|
break;
|
2003-05-20 04:17:49 +02:00
|
|
|
case RPC_FC_IP:
|
|
|
|
goto notfree;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (attr & RPC_FC_P_ONSTACK) {
|
|
|
|
TRACE("not freeing stack ptr %p\n", Pointer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
TRACE("freeing %p\n", Pointer);
|
2003-02-17 02:48:24 +01:00
|
|
|
NdrFree(pStubMsg, Pointer);
|
2003-02-01 01:44:51 +01:00
|
|
|
return;
|
|
|
|
notfree:
|
|
|
|
TRACE("not freeing %p\n", Pointer);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* EmbeddedPointerMarshall
|
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static unsigned char * EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned char *Mark = pStubMsg->BufferMark;
|
|
|
|
unsigned long Offset = pStubMsg->Offset;
|
|
|
|
unsigned ofs, rep, count, stride, xofs;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned i;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
if (*pFormat != RPC_FC_PP) return NULL;
|
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
while (pFormat[0] != RPC_FC_END) {
|
|
|
|
switch (pFormat[0]) {
|
|
|
|
default:
|
|
|
|
FIXME("unknown repeat type %d\n", pFormat[0]);
|
|
|
|
case RPC_FC_NO_REPEAT:
|
|
|
|
rep = 1;
|
|
|
|
stride = 0;
|
|
|
|
ofs = 0;
|
|
|
|
count = 1;
|
|
|
|
xofs = 0;
|
|
|
|
pFormat += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_FIXED_REPEAT:
|
2004-11-30 22:38:57 +01:00
|
|
|
rep = *(const WORD*)&pFormat[2];
|
|
|
|
stride = *(const WORD*)&pFormat[4];
|
|
|
|
ofs = *(const WORD*)&pFormat[6];
|
|
|
|
count = *(const WORD*)&pFormat[8];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = 0;
|
|
|
|
pFormat += 10;
|
|
|
|
break;
|
|
|
|
case RPC_FC_VARIABLE_REPEAT:
|
2006-06-02 21:25:44 +02:00
|
|
|
rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
|
2004-11-30 22:38:57 +01:00
|
|
|
stride = *(const WORD*)&pFormat[2];
|
|
|
|
ofs = *(const WORD*)&pFormat[4];
|
|
|
|
count = *(const WORD*)&pFormat[6];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
|
|
|
|
pFormat += 8;
|
|
|
|
break;
|
|
|
|
}
|
2006-05-15 14:34:47 +02:00
|
|
|
for (i = 0; i < rep; i++) {
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING info = pFormat;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *membase = pMemory + (i * stride);
|
|
|
|
unsigned char *bufbase = Mark + (i * stride);
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned u;
|
2006-05-15 14:34:47 +02:00
|
|
|
/* ofs doesn't seem to matter in this context */
|
2003-02-01 01:44:51 +01:00
|
|
|
for (u=0; u<count; u++,info+=8) {
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned char *memptr = membase + *(const SHORT*)&info[0];
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
|
2006-05-25 00:04:35 +02:00
|
|
|
unsigned char *saved_memory = pStubMsg->Memory;
|
|
|
|
|
|
|
|
pStubMsg->Memory = pMemory;
|
2003-02-01 01:44:51 +01:00
|
|
|
PointerMarshall(pStubMsg, bufptr, *(unsigned char**)memptr, info+4);
|
2006-05-25 00:04:35 +02:00
|
|
|
pStubMsg->Memory = saved_memory;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pFormat += 8 * count;
|
|
|
|
}
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* EmbeddedPointerUnmarshall
|
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static unsigned char * EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
|
|
|
unsigned char *Mark = pStubMsg->BufferMark;
|
|
|
|
unsigned long Offset = pStubMsg->Offset;
|
|
|
|
unsigned ofs, rep, count, stride, xofs;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned i;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
|
|
|
if (*pFormat != RPC_FC_PP) return NULL;
|
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
while (pFormat[0] != RPC_FC_END) {
|
2006-05-15 14:34:47 +02:00
|
|
|
TRACE("pFormat[0] = 0x%x\n", pFormat[0]);
|
2003-02-01 01:44:51 +01:00
|
|
|
switch (pFormat[0]) {
|
|
|
|
default:
|
|
|
|
FIXME("unknown repeat type %d\n", pFormat[0]);
|
|
|
|
case RPC_FC_NO_REPEAT:
|
|
|
|
rep = 1;
|
|
|
|
stride = 0;
|
|
|
|
ofs = 0;
|
|
|
|
count = 1;
|
|
|
|
xofs = 0;
|
|
|
|
pFormat += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_FIXED_REPEAT:
|
2004-11-30 22:38:57 +01:00
|
|
|
rep = *(const WORD*)&pFormat[2];
|
|
|
|
stride = *(const WORD*)&pFormat[4];
|
|
|
|
ofs = *(const WORD*)&pFormat[6];
|
|
|
|
count = *(const WORD*)&pFormat[8];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = 0;
|
|
|
|
pFormat += 10;
|
|
|
|
break;
|
|
|
|
case RPC_FC_VARIABLE_REPEAT:
|
2006-06-02 21:25:44 +02:00
|
|
|
rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
|
2004-11-30 22:38:57 +01:00
|
|
|
stride = *(const WORD*)&pFormat[2];
|
|
|
|
ofs = *(const WORD*)&pFormat[4];
|
|
|
|
count = *(const WORD*)&pFormat[6];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
|
|
|
|
pFormat += 8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* ofs doesn't seem to matter in this context */
|
2006-05-15 14:34:47 +02:00
|
|
|
for (i = 0; i < rep; i++) {
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING info = pFormat;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *membase = *ppMemory + (i * stride);
|
|
|
|
unsigned char *bufbase = Mark + (i * stride);
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned u;
|
|
|
|
for (u=0; u<count; u++,info+=8) {
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned char *memptr = membase + *(const SHORT*)&info[0];
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
|
2006-05-19 17:03:13 +02:00
|
|
|
PointerUnmarshall(pStubMsg, bufptr, (unsigned char**)memptr, info+4, TRUE);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pFormat += 8 * count;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* EmbeddedPointerBufferSize
|
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned long Offset = pStubMsg->Offset;
|
|
|
|
unsigned ofs, rep, count, stride, xofs;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned i;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
2006-05-15 14:34:47 +02:00
|
|
|
|
|
|
|
if (pStubMsg->IgnoreEmbeddedPointers) return;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (*pFormat != RPC_FC_PP) return;
|
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
while (pFormat[0] != RPC_FC_END) {
|
|
|
|
switch (pFormat[0]) {
|
|
|
|
default:
|
|
|
|
FIXME("unknown repeat type %d\n", pFormat[0]);
|
|
|
|
case RPC_FC_NO_REPEAT:
|
|
|
|
rep = 1;
|
|
|
|
stride = 0;
|
|
|
|
ofs = 0;
|
|
|
|
count = 1;
|
|
|
|
xofs = 0;
|
|
|
|
pFormat += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_FIXED_REPEAT:
|
2004-11-30 22:38:57 +01:00
|
|
|
rep = *(const WORD*)&pFormat[2];
|
|
|
|
stride = *(const WORD*)&pFormat[4];
|
|
|
|
ofs = *(const WORD*)&pFormat[6];
|
|
|
|
count = *(const WORD*)&pFormat[8];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = 0;
|
|
|
|
pFormat += 10;
|
|
|
|
break;
|
|
|
|
case RPC_FC_VARIABLE_REPEAT:
|
2006-06-02 21:25:44 +02:00
|
|
|
rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
|
2004-11-30 22:38:57 +01:00
|
|
|
stride = *(const WORD*)&pFormat[2];
|
|
|
|
ofs = *(const WORD*)&pFormat[4];
|
|
|
|
count = *(const WORD*)&pFormat[6];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
|
|
|
|
pFormat += 8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* ofs doesn't seem to matter in this context */
|
2006-05-15 14:34:47 +02:00
|
|
|
for (i = 0; i < rep; i++) {
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING info = pFormat;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *membase = pMemory + (i * stride);
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned u;
|
|
|
|
for (u=0; u<count; u++,info+=8) {
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned char *memptr = membase + *(const SHORT*)&info[0];
|
2006-05-25 00:04:35 +02:00
|
|
|
unsigned char *saved_memory = pStubMsg->Memory;
|
|
|
|
|
|
|
|
pStubMsg->Memory = pMemory;
|
2003-02-01 01:44:51 +01:00
|
|
|
PointerBufferSize(pStubMsg, *(unsigned char**)memptr, info+4);
|
2006-05-25 00:04:35 +02:00
|
|
|
pStubMsg->Memory = saved_memory;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pFormat += 8 * count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* EmbeddedPointerMemorySize [internal]
|
2003-02-01 01:44:51 +01:00
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static unsigned long EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned long Offset = pStubMsg->Offset;
|
|
|
|
unsigned char *Mark = pStubMsg->BufferMark;
|
|
|
|
unsigned ofs, rep, count, stride, xofs;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned i;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
|
2006-05-15 14:34:47 +02:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (*pFormat != RPC_FC_PP) return 0;
|
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
while (pFormat[0] != RPC_FC_END) {
|
|
|
|
switch (pFormat[0]) {
|
|
|
|
default:
|
|
|
|
FIXME("unknown repeat type %d\n", pFormat[0]);
|
|
|
|
case RPC_FC_NO_REPEAT:
|
|
|
|
rep = 1;
|
|
|
|
stride = 0;
|
|
|
|
ofs = 0;
|
|
|
|
count = 1;
|
|
|
|
xofs = 0;
|
|
|
|
pFormat += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_FIXED_REPEAT:
|
2004-11-30 22:38:57 +01:00
|
|
|
rep = *(const WORD*)&pFormat[2];
|
|
|
|
stride = *(const WORD*)&pFormat[4];
|
|
|
|
ofs = *(const WORD*)&pFormat[6];
|
|
|
|
count = *(const WORD*)&pFormat[8];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = 0;
|
|
|
|
pFormat += 10;
|
|
|
|
break;
|
|
|
|
case RPC_FC_VARIABLE_REPEAT:
|
2006-06-02 21:25:44 +02:00
|
|
|
rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
|
2004-11-30 22:38:57 +01:00
|
|
|
stride = *(const WORD*)&pFormat[2];
|
|
|
|
ofs = *(const WORD*)&pFormat[4];
|
|
|
|
count = *(const WORD*)&pFormat[6];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
|
|
|
|
pFormat += 8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* ofs doesn't seem to matter in this context */
|
2006-05-15 14:34:47 +02:00
|
|
|
for (i = 0; i < rep; i++) {
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING info = pFormat;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *bufbase = Mark + (i * stride);
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned u;
|
|
|
|
for (u=0; u<count; u++,info+=8) {
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
|
2003-02-01 01:44:51 +01:00
|
|
|
PointerMemorySize(pStubMsg, bufptr, info+4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pFormat += 8 * count;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* EmbeddedPointerFree [internal]
|
2003-02-01 01:44:51 +01:00
|
|
|
*/
|
2006-05-19 17:02:41 +02:00
|
|
|
static void EmbeddedPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned long Offset = pStubMsg->Offset;
|
|
|
|
unsigned ofs, rep, count, stride, xofs;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned i;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
if (*pFormat != RPC_FC_PP) return;
|
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
while (pFormat[0] != RPC_FC_END) {
|
|
|
|
switch (pFormat[0]) {
|
|
|
|
default:
|
|
|
|
FIXME("unknown repeat type %d\n", pFormat[0]);
|
|
|
|
case RPC_FC_NO_REPEAT:
|
|
|
|
rep = 1;
|
|
|
|
stride = 0;
|
|
|
|
ofs = 0;
|
|
|
|
count = 1;
|
|
|
|
xofs = 0;
|
|
|
|
pFormat += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_FIXED_REPEAT:
|
2004-11-30 22:38:57 +01:00
|
|
|
rep = *(const WORD*)&pFormat[2];
|
|
|
|
stride = *(const WORD*)&pFormat[4];
|
|
|
|
ofs = *(const WORD*)&pFormat[6];
|
|
|
|
count = *(const WORD*)&pFormat[8];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = 0;
|
|
|
|
pFormat += 10;
|
|
|
|
break;
|
|
|
|
case RPC_FC_VARIABLE_REPEAT:
|
2006-06-02 21:25:44 +02:00
|
|
|
rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
|
2004-11-30 22:38:57 +01:00
|
|
|
stride = *(const WORD*)&pFormat[2];
|
|
|
|
ofs = *(const WORD*)&pFormat[4];
|
|
|
|
count = *(const WORD*)&pFormat[6];
|
2003-02-01 01:44:51 +01:00
|
|
|
xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
|
|
|
|
pFormat += 8;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* ofs doesn't seem to matter in this context */
|
2006-05-15 14:34:47 +02:00
|
|
|
for (i = 0; i < rep; i++) {
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING info = pFormat;
|
2006-05-15 14:34:47 +02:00
|
|
|
unsigned char *membase = pMemory + (i * stride);
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned u;
|
|
|
|
for (u=0; u<count; u++,info+=8) {
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned char *memptr = membase + *(const SHORT*)&info[0];
|
2006-05-25 00:04:35 +02:00
|
|
|
unsigned char *saved_memory = pStubMsg->Memory;
|
|
|
|
|
|
|
|
pStubMsg->Memory = pMemory;
|
2003-02-01 01:44:51 +01:00
|
|
|
PointerFree(pStubMsg, *(unsigned char**)memptr, info+4);
|
2006-05-25 00:04:35 +02:00
|
|
|
pStubMsg->Memory = saved_memory;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pFormat += 8 * count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrPointerMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-10 14:13:45 +02:00
|
|
|
unsigned char *Buffer;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-05-10 14:13:45 +02:00
|
|
|
/* incremement the buffer here instead of in PointerMarshall,
|
|
|
|
* as that is used by embedded pointers which already handle the incrementing
|
|
|
|
* the buffer, and shouldn't write any additional pointer data to the wire */
|
|
|
|
if (*pFormat != RPC_FC_RP)
|
|
|
|
{
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
Buffer = pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Buffer = pStubMsg->Buffer;
|
|
|
|
|
2006-05-13 18:00:00 +02:00
|
|
|
PointerMarshall(pStubMsg, Buffer, pMemory, pFormat);
|
2003-02-17 02:48:24 +01:00
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrPointerUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-05-10 14:13:45 +02:00
|
|
|
unsigned char *Buffer;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2006-05-10 14:13:45 +02:00
|
|
|
/* incremement the buffer here instead of in PointerUnmarshall,
|
|
|
|
* as that is used by embedded pointers which already handle the incrementing
|
|
|
|
* the buffer, and shouldn't read any additional pointer data from the
|
|
|
|
* buffer */
|
|
|
|
if (*pFormat != RPC_FC_RP)
|
|
|
|
{
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
Buffer = pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Buffer = pStubMsg->Buffer;
|
|
|
|
|
|
|
|
PointerUnmarshall(pStubMsg, Buffer, ppMemory, pFormat, fMustAlloc);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrPointerBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
2006-05-10 14:13:45 +02:00
|
|
|
|
|
|
|
/* incremement the buffer length here instead of in PointerBufferSize,
|
|
|
|
* as that is used by embedded pointers which already handle the buffer
|
|
|
|
* length, and shouldn't write anything more to the wire */
|
|
|
|
if (*pFormat != RPC_FC_RP)
|
|
|
|
{
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, 4);
|
|
|
|
pStubMsg->BufferLength += 4;
|
|
|
|
}
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
PointerBufferSize(pStubMsg, pMemory, pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrPointerMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
|
|
|
/* unsigned size = *(LPWORD)(pFormat+2); */
|
|
|
|
FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
|
|
|
|
PointerMemorySize(pStubMsg, pStubMsg->Buffer, pFormat);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrPointerFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
2003-02-17 02:48:24 +01:00
|
|
|
PointerFree(pStubMsg, pMemory, pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
2006-05-23 12:54:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrSimpleTypeMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory,
|
|
|
|
unsigned char FormatChar )
|
|
|
|
{
|
2007-01-23 12:50:06 +01:00
|
|
|
NdrBaseTypeMarshall(pStubMsg, pMemory, &FormatChar);
|
2006-05-23 12:54:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrSimpleTypeUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory,
|
|
|
|
unsigned char FormatChar )
|
|
|
|
{
|
2007-01-23 12:50:06 +01:00
|
|
|
NdrBaseTypeUnmarshall(pStubMsg, &pMemory, &FormatChar, 0);
|
2006-05-23 12:54:17 +02:00
|
|
|
}
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrSimpleStructMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned size = *(const WORD*)(pFormat+2);
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
memcpy(pStubMsg->Buffer, pMemory, size);
|
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += size;
|
|
|
|
|
|
|
|
if (pFormat[0] != RPC_FC_STRUCT)
|
|
|
|
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat+4);
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrSimpleStructUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned size = *(const WORD*)(pFormat+2);
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (fMustAlloc) {
|
|
|
|
*ppMemory = NdrAllocate(pStubMsg, size);
|
|
|
|
memcpy(*ppMemory, pStubMsg->Buffer, size);
|
|
|
|
} else {
|
2006-05-19 12:47:20 +02:00
|
|
|
if (!pStubMsg->IsClient && !*ppMemory)
|
|
|
|
/* for servers, we just point straight into the RPC buffer */
|
2003-02-01 01:44:51 +01:00
|
|
|
*ppMemory = pStubMsg->Buffer;
|
|
|
|
else
|
|
|
|
/* for clients, memory should be provided by caller */
|
|
|
|
memcpy(*ppMemory, pStubMsg->Buffer, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += size;
|
|
|
|
|
|
|
|
if (pFormat[0] != RPC_FC_STRUCT)
|
|
|
|
EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat+4, fMustAlloc);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrSimpleStructBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned size = *(const WORD*)(pFormat+2);
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
2006-05-10 14:12:30 +02:00
|
|
|
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->BufferLength += size;
|
|
|
|
if (pFormat[0] != RPC_FC_STRUCT)
|
|
|
|
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat+4);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrSimpleStructMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrSimpleStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
unsigned short size = *(const WORD *)(pFormat+2);
|
2006-05-15 14:34:58 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", pStubMsg, pFormat);
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1);
|
|
|
|
pStubMsg->MemorySize += size;
|
|
|
|
pStubMsg->Buffer += size;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (pFormat[0] != RPC_FC_STRUCT)
|
|
|
|
EmbeddedPointerMemorySize(pStubMsg, pFormat+4);
|
2006-05-15 14:34:58 +02:00
|
|
|
return size;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrSimpleStructFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrSimpleStructFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
if (pFormat[0] != RPC_FC_STRUCT)
|
|
|
|
EmbeddedPointerFree(pStubMsg, pMemory, pFormat+4);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-17 15:45:30 +02:00
|
|
|
static unsigned long EmbeddedComplexSize(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-17 02:48:24 +01:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
switch (*pFormat) {
|
|
|
|
case RPC_FC_STRUCT:
|
|
|
|
case RPC_FC_PSTRUCT:
|
|
|
|
case RPC_FC_CSTRUCT:
|
|
|
|
case RPC_FC_BOGUS_STRUCT:
|
2006-07-24 12:45:55 +02:00
|
|
|
case RPC_FC_SMFARRAY:
|
2006-07-14 18:05:39 +02:00
|
|
|
case RPC_FC_SMVARRAY:
|
2004-11-30 22:38:57 +01:00
|
|
|
return *(const WORD*)&pFormat[2];
|
2003-02-17 02:48:24 +01:00
|
|
|
case RPC_FC_USER_MARSHAL:
|
2004-11-30 22:38:57 +01:00
|
|
|
return *(const WORD*)&pFormat[4];
|
2006-04-28 15:28:24 +02:00
|
|
|
case RPC_FC_NON_ENCAPSULATED_UNION:
|
2006-05-15 14:35:07 +02:00
|
|
|
pFormat += 2;
|
|
|
|
if (pStubMsg->fHasNewCorrDesc)
|
|
|
|
pFormat += 6;
|
|
|
|
else
|
|
|
|
pFormat += 4;
|
|
|
|
|
|
|
|
pFormat += *(const SHORT*)pFormat;
|
|
|
|
return *(const SHORT*)pFormat;
|
2006-05-18 04:40:06 +02:00
|
|
|
case RPC_FC_IP:
|
|
|
|
return sizeof(void *);
|
2003-02-17 02:48:24 +01:00
|
|
|
default:
|
|
|
|
FIXME("unhandled embedded type %02x\n", *pFormat);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-17 15:45:30 +02:00
|
|
|
static unsigned long EmbeddedComplexMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2006-05-15 14:35:07 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
NDR_MEMORYSIZE m = NdrMemorySizer[*pFormat & NDR_TABLE_MASK];
|
|
|
|
|
|
|
|
if (!m)
|
|
|
|
{
|
|
|
|
FIXME("no memorysizer for data type=%02x\n", *pFormat);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return m(pStubMsg, pFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-17 15:45:30 +02:00
|
|
|
static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
PFORMAT_STRING pPointer)
|
|
|
|
{
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_MARSHALL m;
|
2003-02-17 02:48:24 +01:00
|
|
|
unsigned long size;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
while (*pFormat != RPC_FC_END) {
|
|
|
|
switch (*pFormat) {
|
2006-06-09 18:24:49 +02:00
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
TRACE("byte=%d <= %p\n", *(WORD*)pMemory, pMemory);
|
|
|
|
memcpy(pStubMsg->Buffer, pMemory, 1);
|
|
|
|
pStubMsg->Buffer += 1;
|
|
|
|
pMemory += 1;
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
2003-02-17 02:48:24 +01:00
|
|
|
TRACE("short=%d <= %p\n", *(WORD*)pMemory, pMemory);
|
2003-02-01 01:44:51 +01:00
|
|
|
memcpy(pStubMsg->Buffer, pMemory, 2);
|
|
|
|
pStubMsg->Buffer += 2;
|
|
|
|
pMemory += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2005-10-31 22:05:00 +01:00
|
|
|
case RPC_FC_ENUM32:
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("long=%d <= %p\n", *(DWORD*)pMemory, pMemory);
|
2003-02-01 01:44:51 +01:00
|
|
|
memcpy(pStubMsg->Buffer, pMemory, 4);
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
pMemory += 4;
|
|
|
|
break;
|
2006-07-24 12:45:24 +02:00
|
|
|
case RPC_FC_HYPER:
|
|
|
|
TRACE("longlong=%s <= %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory);
|
|
|
|
memcpy(pStubMsg->Buffer, pMemory, 8);
|
|
|
|
pStubMsg->Buffer += 8;
|
|
|
|
pMemory += 8;
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_POINTER:
|
2003-02-17 02:48:24 +01:00
|
|
|
TRACE("pointer=%p <= %p\n", *(unsigned char**)pMemory, pMemory);
|
|
|
|
NdrPointerMarshall(pStubMsg, *(unsigned char**)pMemory, pPointer);
|
2003-02-01 01:44:51 +01:00
|
|
|
pPointer += 4;
|
|
|
|
pMemory += 4;
|
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM4:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 4);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM8:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 8);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD1:
|
2005-11-28 11:28:45 +01:00
|
|
|
case RPC_FC_STRUCTPAD2:
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD3:
|
|
|
|
case RPC_FC_STRUCTPAD4:
|
|
|
|
case RPC_FC_STRUCTPAD5:
|
|
|
|
case RPC_FC_STRUCTPAD6:
|
|
|
|
case RPC_FC_STRUCTPAD7:
|
|
|
|
pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
|
2005-11-28 11:28:45 +01:00
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_EMBEDDED_COMPLEX:
|
|
|
|
pMemory += pFormat[1];
|
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
desc = pFormat + *(const SHORT*)pFormat;
|
2003-02-17 02:48:24 +01:00
|
|
|
size = EmbeddedComplexSize(pStubMsg, desc);
|
|
|
|
TRACE("embedded complex (size=%ld) <= %p\n", size, pMemory);
|
2003-02-01 01:44:51 +01:00
|
|
|
m = NdrMarshaller[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, pMemory, desc);
|
|
|
|
else FIXME("no marshaller for embedded type %02x\n", *desc);
|
2003-02-17 02:48:24 +01:00
|
|
|
pMemory += size;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
continue;
|
|
|
|
case RPC_FC_PAD:
|
|
|
|
break;
|
|
|
|
default:
|
2006-07-24 12:45:24 +02:00
|
|
|
FIXME("unhandled format 0x%02x\n", *pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
pFormat++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pMemory;
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:45:30 +02:00
|
|
|
static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
2006-05-29 17:34:36 +02:00
|
|
|
PFORMAT_STRING pPointer)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_UNMARSHALL m;
|
2003-02-17 02:48:24 +01:00
|
|
|
unsigned long size;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
while (*pFormat != RPC_FC_END) {
|
|
|
|
switch (*pFormat) {
|
2006-06-09 18:24:49 +02:00
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
memcpy(pMemory, pStubMsg->Buffer, 1);
|
|
|
|
TRACE("byte=%d => %p\n", *(WORD*)pMemory, pMemory);
|
|
|
|
pStubMsg->Buffer += 1;
|
|
|
|
pMemory += 1;
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
|
|
|
memcpy(pMemory, pStubMsg->Buffer, 2);
|
2003-02-17 02:48:24 +01:00
|
|
|
TRACE("short=%d => %p\n", *(WORD*)pMemory, pMemory);
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->Buffer += 2;
|
|
|
|
pMemory += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2005-10-31 22:05:00 +01:00
|
|
|
case RPC_FC_ENUM32:
|
2003-02-01 01:44:51 +01:00
|
|
|
memcpy(pMemory, pStubMsg->Buffer, 4);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("long=%d => %p\n", *(DWORD*)pMemory, pMemory);
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
pMemory += 4;
|
|
|
|
break;
|
2006-07-24 12:45:24 +02:00
|
|
|
case RPC_FC_HYPER:
|
|
|
|
memcpy(pMemory, pStubMsg->Buffer, 8);
|
|
|
|
TRACE("longlong=%s => %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory);
|
|
|
|
pStubMsg->Buffer += 8;
|
|
|
|
pMemory += 8;
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_POINTER:
|
2003-02-17 02:48:24 +01:00
|
|
|
TRACE("pointer => %p\n", pMemory);
|
2006-05-19 17:03:13 +02:00
|
|
|
NdrPointerUnmarshall(pStubMsg, (unsigned char**)pMemory, pPointer, TRUE);
|
2003-02-01 01:44:51 +01:00
|
|
|
pPointer += 4;
|
|
|
|
pMemory += 4;
|
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM4:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 4);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM8:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 8);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD1:
|
2005-11-28 11:28:45 +01:00
|
|
|
case RPC_FC_STRUCTPAD2:
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD3:
|
|
|
|
case RPC_FC_STRUCTPAD4:
|
|
|
|
case RPC_FC_STRUCTPAD5:
|
|
|
|
case RPC_FC_STRUCTPAD6:
|
|
|
|
case RPC_FC_STRUCTPAD7:
|
|
|
|
pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
|
2005-11-28 11:28:45 +01:00
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_EMBEDDED_COMPLEX:
|
|
|
|
pMemory += pFormat[1];
|
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
desc = pFormat + *(const SHORT*)pFormat;
|
2003-02-17 02:48:24 +01:00
|
|
|
size = EmbeddedComplexSize(pStubMsg, desc);
|
|
|
|
TRACE("embedded complex (size=%ld) => %p\n", size, pMemory);
|
2003-02-01 01:44:51 +01:00
|
|
|
m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
|
2003-02-17 02:48:24 +01:00
|
|
|
memset(pMemory, 0, size); /* just in case */
|
2006-05-29 17:34:36 +02:00
|
|
|
if (m) m(pStubMsg, &pMemory, desc, FALSE);
|
2003-02-01 01:44:51 +01:00
|
|
|
else FIXME("no unmarshaller for embedded type %02x\n", *desc);
|
2003-02-17 02:48:24 +01:00
|
|
|
pMemory += size;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
continue;
|
|
|
|
case RPC_FC_PAD:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unhandled format %d\n", *pFormat);
|
|
|
|
}
|
|
|
|
pFormat++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pMemory;
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:45:30 +02:00
|
|
|
static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
PFORMAT_STRING pPointer)
|
|
|
|
{
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_BUFFERSIZE m;
|
2003-02-17 02:48:24 +01:00
|
|
|
unsigned long size;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
while (*pFormat != RPC_FC_END) {
|
|
|
|
switch (*pFormat) {
|
2006-06-09 18:24:49 +02:00
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
pStubMsg->BufferLength += 1;
|
|
|
|
pMemory += 1;
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
|
|
|
pStubMsg->BufferLength += 2;
|
|
|
|
pMemory += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2005-10-31 22:05:00 +01:00
|
|
|
case RPC_FC_ENUM32:
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->BufferLength += 4;
|
|
|
|
pMemory += 4;
|
|
|
|
break;
|
2006-07-24 12:45:24 +02:00
|
|
|
case RPC_FC_HYPER:
|
|
|
|
pStubMsg->BufferLength += 8;
|
|
|
|
pMemory += 8;
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_POINTER:
|
2003-02-17 02:48:24 +01:00
|
|
|
NdrPointerBufferSize(pStubMsg, *(unsigned char**)pMemory, pPointer);
|
2003-02-01 01:44:51 +01:00
|
|
|
pPointer += 4;
|
|
|
|
pMemory += 4;
|
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM4:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 4);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM8:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 8);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD1:
|
2005-11-28 11:28:45 +01:00
|
|
|
case RPC_FC_STRUCTPAD2:
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD3:
|
|
|
|
case RPC_FC_STRUCTPAD4:
|
|
|
|
case RPC_FC_STRUCTPAD5:
|
|
|
|
case RPC_FC_STRUCTPAD6:
|
|
|
|
case RPC_FC_STRUCTPAD7:
|
|
|
|
pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
|
2005-11-28 11:28:45 +01:00
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_EMBEDDED_COMPLEX:
|
|
|
|
pMemory += pFormat[1];
|
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
desc = pFormat + *(const SHORT*)pFormat;
|
2003-02-17 02:48:24 +01:00
|
|
|
size = EmbeddedComplexSize(pStubMsg, desc);
|
2003-02-01 01:44:51 +01:00
|
|
|
m = NdrBufferSizer[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, pMemory, desc);
|
|
|
|
else FIXME("no buffersizer for embedded type %02x\n", *desc);
|
2003-02-17 02:48:24 +01:00
|
|
|
pMemory += size;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
continue;
|
|
|
|
case RPC_FC_PAD:
|
|
|
|
break;
|
|
|
|
default:
|
2006-07-24 12:45:24 +02:00
|
|
|
FIXME("unhandled format 0x%02x\n", *pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
pFormat++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pMemory;
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:45:30 +02:00
|
|
|
static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
PFORMAT_STRING pPointer)
|
|
|
|
{
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
NDR_FREE m;
|
2003-02-17 02:48:24 +01:00
|
|
|
unsigned long size;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
while (*pFormat != RPC_FC_END) {
|
|
|
|
switch (*pFormat) {
|
2006-06-09 18:24:49 +02:00
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
pMemory += 1;
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
|
|
|
pMemory += 2;
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2005-10-31 22:05:00 +01:00
|
|
|
case RPC_FC_ENUM32:
|
2003-02-01 01:44:51 +01:00
|
|
|
pMemory += 4;
|
|
|
|
break;
|
2006-07-24 12:45:24 +02:00
|
|
|
case RPC_FC_HYPER:
|
|
|
|
pMemory += 8;
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_POINTER:
|
2003-02-17 02:48:24 +01:00
|
|
|
NdrPointerFree(pStubMsg, *(unsigned char**)pMemory, pPointer);
|
2003-02-01 01:44:51 +01:00
|
|
|
pPointer += 4;
|
|
|
|
pMemory += 4;
|
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM4:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 4);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM8:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pMemory, 8);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD1:
|
2005-11-28 11:28:45 +01:00
|
|
|
case RPC_FC_STRUCTPAD2:
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD3:
|
|
|
|
case RPC_FC_STRUCTPAD4:
|
|
|
|
case RPC_FC_STRUCTPAD5:
|
|
|
|
case RPC_FC_STRUCTPAD6:
|
|
|
|
case RPC_FC_STRUCTPAD7:
|
|
|
|
pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
|
2005-11-28 11:28:45 +01:00
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_EMBEDDED_COMPLEX:
|
|
|
|
pMemory += pFormat[1];
|
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
desc = pFormat + *(const SHORT*)pFormat;
|
2003-02-17 02:48:24 +01:00
|
|
|
size = EmbeddedComplexSize(pStubMsg, desc);
|
2003-02-01 01:44:51 +01:00
|
|
|
m = NdrFreer[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m) m(pStubMsg, pMemory, desc);
|
|
|
|
else FIXME("no freer for embedded type %02x\n", *desc);
|
2003-02-17 02:48:24 +01:00
|
|
|
pMemory += size;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
continue;
|
|
|
|
case RPC_FC_PAD:
|
|
|
|
break;
|
|
|
|
default:
|
2006-07-24 12:45:24 +02:00
|
|
|
FIXME("unhandled format 0x%02x\n", *pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
pFormat++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pMemory;
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:45:30 +02:00
|
|
|
static unsigned long ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
PFORMAT_STRING desc;
|
|
|
|
unsigned long size = 0;
|
|
|
|
|
|
|
|
while (*pFormat != RPC_FC_END) {
|
|
|
|
switch (*pFormat) {
|
2006-06-09 18:24:49 +02:00
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
size += 1;
|
|
|
|
pStubMsg->Buffer += 1;
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
|
|
|
size += 2;
|
2006-05-13 18:00:09 +02:00
|
|
|
pStubMsg->Buffer += 2;
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2006-05-31 13:44:13 +02:00
|
|
|
case RPC_FC_ENUM32:
|
2003-02-01 01:44:51 +01:00
|
|
|
size += 4;
|
2006-05-13 18:00:09 +02:00
|
|
|
pStubMsg->Buffer += 4;
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2006-07-24 12:45:24 +02:00
|
|
|
case RPC_FC_HYPER:
|
|
|
|
size += 8;
|
|
|
|
pStubMsg->Buffer += 8;
|
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_POINTER:
|
|
|
|
size += 4;
|
2006-05-13 18:00:09 +02:00
|
|
|
pStubMsg->Buffer += 4;
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM4:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(size, 4);
|
2006-05-13 18:00:09 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_ALIGNM8:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(size, 8);
|
2006-05-13 18:00:09 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 8);
|
2003-02-01 01:44:51 +01:00
|
|
|
break;
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD1:
|
2005-11-28 11:28:45 +01:00
|
|
|
case RPC_FC_STRUCTPAD2:
|
2006-07-17 21:19:14 +02:00
|
|
|
case RPC_FC_STRUCTPAD3:
|
|
|
|
case RPC_FC_STRUCTPAD4:
|
|
|
|
case RPC_FC_STRUCTPAD5:
|
|
|
|
case RPC_FC_STRUCTPAD6:
|
|
|
|
case RPC_FC_STRUCTPAD7:
|
|
|
|
size += *pFormat - RPC_FC_STRUCTPAD1 + 1;
|
2005-11-28 11:28:45 +01:00
|
|
|
break;
|
2003-02-01 01:44:51 +01:00
|
|
|
case RPC_FC_EMBEDDED_COMPLEX:
|
|
|
|
size += pFormat[1];
|
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
desc = pFormat + *(const SHORT*)pFormat;
|
2006-05-15 14:35:07 +02:00
|
|
|
size += EmbeddedComplexMemorySize(pStubMsg, desc);
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
continue;
|
|
|
|
case RPC_FC_PAD:
|
|
|
|
break;
|
|
|
|
default:
|
2006-07-24 12:45:24 +02:00
|
|
|
FIXME("unhandled format 0x%02x\n", *pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
pFormat++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexStructMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
PFORMAT_STRING conf_array = NULL;
|
|
|
|
PFORMAT_STRING pointer_desc = NULL;
|
|
|
|
unsigned char *OldMemory = pStubMsg->Memory;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 4;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
pStubMsg->Memory = pMemory;
|
|
|
|
|
|
|
|
ComplexMarshall(pStubMsg, pMemory, pFormat, pointer_desc);
|
|
|
|
|
|
|
|
if (conf_array)
|
|
|
|
NdrConformantArrayMarshall(pStubMsg, pMemory, conf_array);
|
|
|
|
|
|
|
|
pStubMsg->Memory = OldMemory;
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexStructUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned size = *(const WORD*)(pFormat+2);
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING conf_array = NULL;
|
|
|
|
PFORMAT_STRING pointer_desc = NULL;
|
|
|
|
unsigned char *pMemory;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (fMustAlloc || !*ppMemory)
|
2006-01-18 11:29:50 +01:00
|
|
|
{
|
2003-02-01 01:44:51 +01:00
|
|
|
*ppMemory = NdrAllocate(pStubMsg, size);
|
2006-01-18 11:29:50 +01:00
|
|
|
memset(*ppMemory, 0, size);
|
|
|
|
}
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
pFormat += 4;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
|
2006-05-29 17:34:36 +02:00
|
|
|
pMemory = ComplexUnmarshall(pStubMsg, *ppMemory, pFormat, pointer_desc);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
if (conf_array)
|
|
|
|
NdrConformantArrayUnmarshall(pStubMsg, &pMemory, conf_array, fMustAlloc);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexStructBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
PFORMAT_STRING conf_array = NULL;
|
|
|
|
PFORMAT_STRING pointer_desc = NULL;
|
|
|
|
unsigned char *OldMemory = pStubMsg->Memory;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 4;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
pStubMsg->Memory = pMemory;
|
|
|
|
|
|
|
|
pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, pointer_desc);
|
|
|
|
|
|
|
|
if (conf_array)
|
|
|
|
NdrConformantArrayBufferSize(pStubMsg, pMemory, conf_array);
|
|
|
|
|
|
|
|
pStubMsg->Memory = OldMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexStructMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
2006-05-13 17:59:50 +02:00
|
|
|
unsigned size = *(const WORD*)(pFormat+2);
|
2003-02-01 01:44:51 +01:00
|
|
|
PFORMAT_STRING conf_array = NULL;
|
|
|
|
PFORMAT_STRING pointer_desc = NULL;
|
|
|
|
|
2006-05-13 17:59:50 +02:00
|
|
|
TRACE("(%p,%p)\n", pStubMsg, pFormat);
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
pFormat += 4;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
|
2006-05-15 14:35:07 +02:00
|
|
|
ComplexStructMemorySize(pStubMsg, pFormat);
|
2006-05-13 17:59:50 +02:00
|
|
|
|
|
|
|
if (conf_array)
|
|
|
|
NdrConformantArrayMemorySize(pStubMsg, conf_array);
|
|
|
|
|
|
|
|
return size;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexStructFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrComplexStructFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
PFORMAT_STRING conf_array = NULL;
|
|
|
|
PFORMAT_STRING pointer_desc = NULL;
|
|
|
|
unsigned char *OldMemory = pStubMsg->Memory;
|
|
|
|
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
pFormat += 4;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
2004-11-30 22:38:57 +01:00
|
|
|
if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
pStubMsg->Memory = pMemory;
|
|
|
|
|
|
|
|
pMemory = ComplexFree(pStubMsg, pMemory, pFormat, pointer_desc);
|
|
|
|
|
|
|
|
if (conf_array)
|
|
|
|
NdrConformantArrayFree(pStubMsg, pMemory, conf_array);
|
|
|
|
|
|
|
|
pStubMsg->Memory = OldMemory;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantArrayMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrConformantArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2004-11-30 22:38:57 +01:00
|
|
|
DWORD size = 0, esize = *(const WORD*)(pFormat+2);
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment = pFormat[1] + 1;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
|
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
|
|
|
|
|
2006-05-10 14:13:15 +02:00
|
|
|
WriteConformance(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-06-10 13:33:01 +02:00
|
|
|
size = safe_multiply(esize, pStubMsg->MaxCount);
|
|
|
|
memcpy(pStubMsg->Buffer, pMemory, size);
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-06-10 13:33:01 +02:00
|
|
|
pStubMsg->Buffer += size;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantArrayUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-06-10 13:33:01 +02:00
|
|
|
DWORD size, esize = *(const WORD*)(pFormat+2);
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment = pFormat[1] + 1;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
|
|
|
|
|
|
|
|
pFormat = ReadConformance(pStubMsg, pFormat+4);
|
2006-06-10 13:33:01 +02:00
|
|
|
|
|
|
|
size = safe_multiply(esize, pStubMsg->MaxCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2005-09-02 13:19:26 +02:00
|
|
|
if (fMustAlloc || !*ppMemory)
|
2006-06-10 13:33:01 +02:00
|
|
|
*ppMemory = NdrAllocate(pStubMsg, size);
|
2005-09-02 13:19:26 +02:00
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-06-10 13:33:01 +02:00
|
|
|
memcpy(*ppMemory, pStubMsg->Buffer, size);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-06-10 13:33:01 +02:00
|
|
|
pStubMsg->Buffer += size;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantArrayBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-06-10 13:33:01 +02:00
|
|
|
DWORD size, esize = *(const WORD*)(pFormat+2);
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment = pFormat[1] + 1;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
|
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
|
2006-05-10 14:13:15 +02:00
|
|
|
|
2006-05-15 14:35:41 +02:00
|
|
|
SizeConformance(pStubMsg);
|
2006-05-10 14:12:52 +02:00
|
|
|
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, alignment);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-06-10 13:33:01 +02:00
|
|
|
size = safe_multiply(esize, pStubMsg->MaxCount);
|
2005-11-28 10:58:40 +01:00
|
|
|
/* conformance value plus array */
|
2006-06-10 13:33:01 +02:00
|
|
|
pStubMsg->BufferLength += size;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantArrayMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrConformantArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
2005-11-28 10:58:40 +01:00
|
|
|
DWORD size = 0, esize = *(const WORD*)(pFormat+2);
|
2006-05-18 04:39:58 +02:00
|
|
|
unsigned char alignment = pFormat[1] + 1;
|
2005-11-28 10:58:40 +01:00
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", pStubMsg, pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
|
|
|
|
|
|
|
|
pFormat = ReadConformance(pStubMsg, pFormat+4);
|
2006-06-10 13:33:01 +02:00
|
|
|
size = safe_multiply(esize, pStubMsg->MaxCount);
|
|
|
|
pStubMsg->MemorySize += size;
|
2006-05-18 04:39:58 +02:00
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-06-10 13:33:01 +02:00
|
|
|
pStubMsg->Buffer += size;
|
2006-05-18 04:39:58 +02:00
|
|
|
|
|
|
|
EmbeddedPointerMemorySize(pStubMsg, pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-18 04:39:58 +02:00
|
|
|
return pStubMsg->MemorySize;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantArrayFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
|
|
|
|
|
2006-08-17 16:31:32 +02:00
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
|
|
|
|
}
|
|
|
|
|
2003-04-26 04:12:14 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingArrayMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char* WINAPI NdrConformantVaryingArrayMarshall( PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char* pMemory,
|
|
|
|
PFORMAT_STRING pFormat )
|
|
|
|
{
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG bufsize;
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment = pFormat[1] + 1;
|
2005-11-28 11:30:32 +01:00
|
|
|
DWORD esize = *(const WORD*)(pFormat+2);
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
if (pFormat[0] != RPC_FC_CVARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
|
2006-05-10 14:13:15 +02:00
|
|
|
WriteConformance(pStubMsg);
|
|
|
|
WriteVariance(pStubMsg);
|
2005-11-28 11:30:32 +01:00
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
|
|
|
|
|
|
|
memcpy(pStubMsg->Buffer, pMemory + pStubMsg->Offset, bufsize);
|
2005-11-28 11:30:32 +01:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->Buffer += bufsize;
|
2005-11-28 11:30:32 +01:00
|
|
|
|
|
|
|
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-04-26 04:12:14 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingArrayUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char** ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc )
|
|
|
|
{
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG bufsize, memsize;
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment = pFormat[1] + 1;
|
2005-11-28 11:30:32 +01:00
|
|
|
DWORD esize = *(const WORD*)(pFormat+2);
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
|
|
|
if (pFormat[0] != RPC_FC_CVARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-05-10 14:12:52 +02:00
|
|
|
|
2006-06-02 21:42:44 +02:00
|
|
|
pFormat = ReadConformance(pStubMsg, pFormat+4);
|
2006-06-10 13:32:47 +02:00
|
|
|
pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
|
2005-11-28 11:30:32 +01:00
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
|
|
|
memsize = safe_multiply(esize, pStubMsg->MaxCount);
|
|
|
|
|
2005-11-28 11:30:32 +01:00
|
|
|
if (!*ppMemory || fMustAlloc)
|
2006-06-10 13:32:24 +02:00
|
|
|
*ppMemory = NdrAllocate(pStubMsg, memsize);
|
|
|
|
memcpy(*ppMemory + pStubMsg->Offset, pStubMsg->Buffer, bufsize);
|
|
|
|
pStubMsg->Buffer += bufsize;
|
2005-11-28 11:30:32 +01:00
|
|
|
|
|
|
|
EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2003-04-26 04:12:14 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingArrayFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantVaryingArrayFree( PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char* pMemory,
|
|
|
|
PFORMAT_STRING pFormat )
|
|
|
|
{
|
2006-05-01 11:38:02 +02:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
if (pFormat[0] != RPC_FC_CVARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
|
|
|
|
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
|
2003-04-26 04:12:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingArrayBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantVaryingArrayBufferSize( PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char* pMemory, PFORMAT_STRING pFormat )
|
|
|
|
{
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment = pFormat[1] + 1;
|
2005-11-28 11:30:32 +01:00
|
|
|
DWORD esize = *(const WORD*)(pFormat+2);
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
if (pFormat[0] != RPC_FC_CVARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compute size */
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
|
|
|
|
/* compute length */
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
|
2006-05-10 14:13:15 +02:00
|
|
|
SizeConformance(pStubMsg);
|
|
|
|
SizeVariance(pStubMsg);
|
2006-05-10 14:12:52 +02:00
|
|
|
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, alignment);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->BufferLength += safe_multiply(esize, pStubMsg->ActualCount);
|
2005-11-28 11:30:32 +01:00
|
|
|
|
|
|
|
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
|
2003-04-26 04:12:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingArrayMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrConformantVaryingArrayMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat )
|
2003-04-26 04:12:14 +02:00
|
|
|
{
|
|
|
|
FIXME( "stub\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexArrayMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-15 14:35:51 +02:00
|
|
|
ULONG i, count, def;
|
2006-01-06 21:07:27 +01:00
|
|
|
BOOL variance_present;
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment;
|
2006-01-06 21:07:27 +01:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-01-09 17:20:19 +01:00
|
|
|
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
2004-11-30 22:38:57 +01:00
|
|
|
def = *(const WORD*)&pFormat[2];
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 4;
|
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
|
2006-01-06 21:07:27 +01:00
|
|
|
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-01-06 21:07:27 +01:00
|
|
|
variance_present = IsConformanceOrVariancePresent(pFormat);
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("variance = %d\n", pStubMsg->ActualCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-10 14:13:15 +02:00
|
|
|
WriteConformance(pStubMsg);
|
2006-01-06 21:07:27 +01:00
|
|
|
if (variance_present)
|
2006-05-10 14:13:15 +02:00
|
|
|
WriteVariance(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-05-15 14:35:51 +02:00
|
|
|
count = pStubMsg->ActualCount;
|
|
|
|
for (i = 0; i < count; i++)
|
2003-02-01 01:44:51 +01:00
|
|
|
pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL);
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexArrayUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG i, count, esize, memsize;
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment;
|
2003-02-01 01:44:51 +01:00
|
|
|
unsigned char *pMemory;
|
2006-05-13 17:58:43 +02:00
|
|
|
unsigned char *Buffer;
|
2006-01-06 21:07:27 +01:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2006-01-09 17:20:19 +01:00
|
|
|
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 4;
|
|
|
|
|
|
|
|
pFormat = ReadConformance(pStubMsg, pFormat);
|
2006-06-10 13:32:47 +02:00
|
|
|
pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-13 17:58:43 +02:00
|
|
|
Buffer = pStubMsg->Buffer;
|
2006-06-10 13:33:26 +02:00
|
|
|
pStubMsg->MemorySize = 0;
|
2006-05-15 14:35:07 +02:00
|
|
|
esize = ComplexStructMemorySize(pStubMsg, pFormat);
|
2006-05-13 17:58:43 +02:00
|
|
|
pStubMsg->Buffer = Buffer;
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
/* do multiply here instead of inside if block to verify MaxCount */
|
|
|
|
memsize = safe_multiply(esize, pStubMsg->MaxCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
if (fMustAlloc || !*ppMemory)
|
2006-01-18 11:29:50 +01:00
|
|
|
{
|
2006-06-10 13:32:24 +02:00
|
|
|
*ppMemory = NdrAllocate(pStubMsg, memsize);
|
|
|
|
memset(*ppMemory, 0, memsize);
|
2006-01-18 11:29:50 +01:00
|
|
|
}
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
pMemory = *ppMemory;
|
2006-05-15 14:35:51 +02:00
|
|
|
count = pStubMsg->ActualCount;
|
|
|
|
for (i = 0; i < count; i++)
|
2006-05-29 17:34:36 +02:00
|
|
|
pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexArrayBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-15 14:35:51 +02:00
|
|
|
ULONG i, count, def;
|
2006-05-10 14:12:52 +02:00
|
|
|
unsigned char alignment;
|
2006-01-06 21:07:27 +01:00
|
|
|
BOOL variance_present;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-01-09 17:20:19 +01:00
|
|
|
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
2004-11-30 22:38:57 +01:00
|
|
|
def = *(const WORD*)&pFormat[2];
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 4;
|
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
|
2006-01-06 21:07:27 +01:00
|
|
|
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
|
2006-05-10 14:13:15 +02:00
|
|
|
SizeConformance(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-01-06 21:07:27 +01:00
|
|
|
variance_present = IsConformanceOrVariancePresent(pFormat);
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("variance = %d\n", pStubMsg->ActualCount);
|
2006-01-06 21:07:27 +01:00
|
|
|
|
|
|
|
if (variance_present)
|
2006-05-10 14:13:15 +02:00
|
|
|
SizeVariance(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-10 14:12:52 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, alignment);
|
|
|
|
|
2006-05-15 14:35:51 +02:00
|
|
|
count = pStubMsg->ActualCount;
|
|
|
|
for (i = 0; i < count; i++)
|
2003-02-01 01:44:51 +01:00
|
|
|
pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexArrayMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG i, count, esize, SavedMemorySize, MemorySize;
|
2006-05-13 17:59:20 +02:00
|
|
|
unsigned char alignment;
|
|
|
|
unsigned char *Buffer;
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", pStubMsg, pFormat);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-01-09 17:20:19 +01:00
|
|
|
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-05-13 17:59:20 +02:00
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 4;
|
|
|
|
|
|
|
|
pFormat = ReadConformance(pStubMsg, pFormat);
|
2006-06-10 13:32:47 +02:00
|
|
|
pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-13 17:59:20 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-13 17:59:20 +02:00
|
|
|
SavedMemorySize = pStubMsg->MemorySize;
|
|
|
|
|
|
|
|
Buffer = pStubMsg->Buffer;
|
2006-06-09 18:25:16 +02:00
|
|
|
pStubMsg->MemorySize = 0;
|
2006-05-15 14:35:07 +02:00
|
|
|
esize = ComplexStructMemorySize(pStubMsg, pFormat);
|
2006-05-13 17:59:20 +02:00
|
|
|
pStubMsg->Buffer = Buffer;
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
MemorySize = safe_multiply(pStubMsg->MaxCount, esize);
|
2006-05-13 17:59:20 +02:00
|
|
|
|
2006-05-15 14:35:51 +02:00
|
|
|
count = pStubMsg->ActualCount;
|
|
|
|
for (i = 0; i < count; i++)
|
2006-05-15 14:35:07 +02:00
|
|
|
ComplexStructMemorySize(pStubMsg, pFormat);
|
2006-05-13 17:59:20 +02:00
|
|
|
|
|
|
|
pStubMsg->MemorySize = SavedMemorySize;
|
|
|
|
|
|
|
|
pStubMsg->MemorySize += MemorySize;
|
|
|
|
return MemorySize;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrComplexArrayFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-15 14:35:51 +02:00
|
|
|
ULONG i, count, def;
|
2006-01-06 21:07:27 +01:00
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-01-09 17:20:19 +01:00
|
|
|
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-11-30 22:38:57 +01:00
|
|
|
def = *(const WORD*)&pFormat[2];
|
2003-02-01 01:44:51 +01:00
|
|
|
pFormat += 4;
|
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
|
2006-01-06 21:07:27 +01:00
|
|
|
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-01-06 21:07:27 +01:00
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("variance = %d\n", pStubMsg->ActualCount);
|
2003-02-01 01:44:51 +01:00
|
|
|
|
2006-05-15 14:35:51 +02:00
|
|
|
count = pStubMsg->ActualCount;
|
|
|
|
for (i = 0; i < count; i++)
|
2003-02-01 01:44:51 +01:00
|
|
|
pMemory = ComplexFree(pStubMsg, pMemory, pFormat, NULL);
|
|
|
|
}
|
|
|
|
|
2006-11-09 23:02:49 +01:00
|
|
|
static ULONG UserMarshalFlags(PMIDL_STUB_MESSAGE pStubMsg)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
|
|
|
return MAKELONG(pStubMsg->dwDestContext,
|
|
|
|
pStubMsg->RpcMsg->DataRepresentation);
|
|
|
|
}
|
|
|
|
|
2006-05-18 04:39:27 +02:00
|
|
|
#define USER_MARSHAL_PTR_PREFIX \
|
|
|
|
( (DWORD)'U' | ( (DWORD)'s' << 8 ) | \
|
|
|
|
( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrUserMarshalMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-18 04:39:27 +02:00
|
|
|
unsigned flags = pFormat[1];
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned index = *(const WORD*)&pFormat[2];
|
2006-11-09 23:02:49 +01:00
|
|
|
ULONG uflag = UserMarshalFlags(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
TRACE("index=%d\n", index);
|
|
|
|
|
2006-05-18 04:39:27 +02:00
|
|
|
if (flags & USER_MARSHAL_POINTER)
|
|
|
|
{
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, USER_MARSHAL_PTR_PREFIX);
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, (flags & 0xf) + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->Buffer =
|
|
|
|
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnMarshall(
|
|
|
|
&uflag, pStubMsg->Buffer, pMemory);
|
|
|
|
|
2003-02-17 02:48:24 +01:00
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrUserMarshalUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-05-18 04:39:27 +02:00
|
|
|
unsigned flags = pFormat[1];
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned index = *(const WORD*)&pFormat[2];
|
|
|
|
DWORD memsize = *(const WORD*)&pFormat[4];
|
2006-11-09 23:02:49 +01:00
|
|
|
ULONG uflag = UserMarshalFlags(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
TRACE("index=%d\n", index);
|
|
|
|
|
2006-05-18 04:39:27 +02:00
|
|
|
if (flags & USER_MARSHAL_POINTER)
|
|
|
|
{
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
/* skip pointer prefix */
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, (flags & 0xf) + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (fMustAlloc || !*ppMemory)
|
|
|
|
*ppMemory = NdrAllocate(pStubMsg, memsize);
|
|
|
|
|
|
|
|
pStubMsg->Buffer =
|
|
|
|
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnUnmarshall(
|
|
|
|
&uflag, pStubMsg->Buffer, *ppMemory);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrUserMarshalBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-18 04:39:27 +02:00
|
|
|
unsigned flags = pFormat[1];
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned index = *(const WORD*)&pFormat[2];
|
|
|
|
DWORD bufsize = *(const WORD*)&pFormat[6];
|
2006-11-09 23:02:49 +01:00
|
|
|
ULONG uflag = UserMarshalFlags(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
TRACE("index=%d\n", index);
|
|
|
|
|
2006-05-18 04:39:27 +02:00
|
|
|
if (flags & USER_MARSHAL_POINTER)
|
|
|
|
{
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, 4);
|
|
|
|
/* skip pointer prefix */
|
|
|
|
pStubMsg->BufferLength += 4;
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, (flags & 0xf) + 1);
|
|
|
|
|
2003-02-01 01:44:51 +01:00
|
|
|
if (bufsize) {
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("size=%d\n", bufsize);
|
2003-02-01 01:44:51 +01:00
|
|
|
pStubMsg->BufferLength += bufsize;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pStubMsg->BufferLength =
|
|
|
|
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnBufferSize(
|
|
|
|
&uflag, pStubMsg->BufferLength, pMemory);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrUserMarshalMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrUserMarshalMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
2003-02-01 01:44:51 +01:00
|
|
|
{
|
2006-05-18 04:39:27 +02:00
|
|
|
unsigned flags = pFormat[1];
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned index = *(const WORD*)&pFormat[2];
|
2006-05-18 04:39:19 +02:00
|
|
|
DWORD memsize = *(const WORD*)&pFormat[4];
|
|
|
|
DWORD bufsize = *(const WORD*)&pFormat[6];
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", pStubMsg, pFormat);
|
2003-02-17 02:48:24 +01:00
|
|
|
TRACE("index=%d\n", index);
|
|
|
|
|
2006-05-18 04:39:19 +02:00
|
|
|
pStubMsg->MemorySize += memsize;
|
2006-05-18 04:39:27 +02:00
|
|
|
|
|
|
|
if (flags & USER_MARSHAL_POINTER)
|
|
|
|
{
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
/* skip pointer prefix */
|
|
|
|
pStubMsg->Buffer += 4;
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, (flags & 0xf) + 1);
|
|
|
|
|
2006-05-18 04:39:19 +02:00
|
|
|
pStubMsg->Buffer += bufsize;
|
|
|
|
|
|
|
|
return pStubMsg->MemorySize;
|
2003-02-01 01:44:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrUserMarshalFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrUserMarshalFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
/* unsigned flags = pFormat[1]; */
|
2004-11-30 22:38:57 +01:00
|
|
|
unsigned index = *(const WORD*)&pFormat[2];
|
2006-11-09 23:02:49 +01:00
|
|
|
ULONG uflag = UserMarshalFlags(pStubMsg);
|
2003-02-01 01:44:51 +01:00
|
|
|
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
TRACE("index=%d\n", index);
|
|
|
|
|
|
|
|
pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnFree(
|
|
|
|
&uflag, pMemory);
|
2002-10-22 02:41:17 +02:00
|
|
|
}
|
2002-10-25 21:03:43 +02:00
|
|
|
|
2003-05-20 04:17:49 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrClearOutParameters [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrClearOutParameters(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
void *ArgAddr)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p): stub\n", pStubMsg, pFormat, ArgAddr);
|
|
|
|
}
|
|
|
|
|
2002-10-28 21:07:01 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrConvert [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
|
|
|
|
{
|
|
|
|
FIXME("(pStubMsg == ^%p, pFormat == ^%p): stub.\n", pStubMsg, pFormat);
|
2002-10-28 22:14:16 +01:00
|
|
|
/* FIXME: since this stub doesn't do any converting, the proper behavior
|
|
|
|
is to raise an exception */
|
2002-10-28 21:07:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConvert2 [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
void WINAPI NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, LONG NumberParams )
|
2002-10-28 21:07:01 +01:00
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %d): stub.\n",
|
2002-11-01 00:35:46 +01:00
|
|
|
pStubMsg, pFormat, NumberParams);
|
2002-10-28 22:14:16 +01:00
|
|
|
/* FIXME: since this stub doesn't do any converting, the proper behavior
|
|
|
|
is to raise an exception */
|
2002-10-28 21:07:01 +01:00
|
|
|
}
|
2005-07-18 15:14:05 +02:00
|
|
|
|
2007-02-12 14:29:04 +01:00
|
|
|
#include "pshpack1.h"
|
2005-11-28 11:30:12 +01:00
|
|
|
typedef struct _NDR_CSTRUCT_FORMAT
|
|
|
|
{
|
|
|
|
unsigned char type;
|
|
|
|
unsigned char alignment;
|
|
|
|
unsigned short memory_size;
|
|
|
|
short offset_to_array_description;
|
2006-05-15 17:56:37 +02:00
|
|
|
} NDR_CSTRUCT_FORMAT, NDR_CVSTRUCT_FORMAT;
|
2007-02-12 14:29:04 +01:00
|
|
|
#include "poppack.h"
|
2005-11-28 11:30:12 +01:00
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantStructMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CSTRUCT_FORMAT *pCStructFormat = (const NDR_CSTRUCT_FORMAT *)pFormat;
|
2006-05-15 14:35:31 +02:00
|
|
|
PFORMAT_STRING pCArrayFormat;
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG esize, bufsize;
|
2005-11-28 11:30:12 +01:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-05-15 14:35:31 +02:00
|
|
|
pFormat += sizeof(NDR_CSTRUCT_FORMAT);
|
2005-11-28 11:30:12 +01:00
|
|
|
if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-09-25 23:20:20 +02:00
|
|
|
pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description +
|
2006-05-15 14:35:31 +02:00
|
|
|
pCStructFormat->offset_to_array_description;
|
|
|
|
if (*pCArrayFormat != RPC_FC_CARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid array format type %x\n", pCStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
esize = *(const WORD*)(pCArrayFormat+2);
|
|
|
|
|
|
|
|
ComputeConformance(pStubMsg, pMemory + pCStructFormat->memory_size,
|
|
|
|
pCArrayFormat + 4, 0);
|
|
|
|
|
|
|
|
WriteConformance(pStubMsg);
|
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pCStructFormat->alignment + 1);
|
|
|
|
|
2005-11-28 11:30:12 +01:00
|
|
|
TRACE("memory_size = %d\n", pCStructFormat->memory_size);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->MaxCount);
|
2005-11-28 11:30:12 +01:00
|
|
|
/* copy constant sized part of struct */
|
2006-05-15 14:35:31 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-06-10 13:32:24 +02:00
|
|
|
memcpy(pStubMsg->Buffer, pMemory, pCStructFormat->memory_size + bufsize);
|
|
|
|
pStubMsg->Buffer += pCStructFormat->memory_size + bufsize;
|
2005-11-28 11:30:12 +01:00
|
|
|
|
|
|
|
if (pCStructFormat->type == RPC_FC_CPSTRUCT)
|
|
|
|
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
|
2006-05-15 14:35:31 +02:00
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantStructUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CSTRUCT_FORMAT *pCStructFormat = (const NDR_CSTRUCT_FORMAT *)pFormat;
|
2006-05-15 14:35:31 +02:00
|
|
|
PFORMAT_STRING pCArrayFormat;
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG esize, bufsize;
|
2005-11-28 11:30:12 +01:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2006-05-15 14:35:31 +02:00
|
|
|
pFormat += sizeof(NDR_CSTRUCT_FORMAT);
|
2005-11-28 11:30:12 +01:00
|
|
|
if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-09-25 23:20:20 +02:00
|
|
|
pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description +
|
2006-05-15 14:35:31 +02:00
|
|
|
pCStructFormat->offset_to_array_description;
|
|
|
|
if (*pCArrayFormat != RPC_FC_CARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid array format type %x\n", pCStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
esize = *(const WORD*)(pCArrayFormat+2);
|
|
|
|
|
|
|
|
pCArrayFormat = ReadConformance(pStubMsg, pCArrayFormat + 4);
|
2005-11-28 11:30:12 +01:00
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pCStructFormat->alignment + 1);
|
|
|
|
|
2005-11-28 11:30:12 +01:00
|
|
|
TRACE("memory_size = %d\n", pCStructFormat->memory_size);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->MaxCount);
|
2005-11-28 11:30:12 +01:00
|
|
|
/* work out how much memory to allocate if we need to do so */
|
|
|
|
if (!*ppMemory || fMustAlloc)
|
|
|
|
{
|
2006-06-10 13:32:24 +02:00
|
|
|
SIZE_T size = pCStructFormat->memory_size + bufsize;
|
2005-11-28 11:30:12 +01:00
|
|
|
*ppMemory = NdrAllocate(pStubMsg, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now copy the data */
|
2006-05-15 14:35:31 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-06-10 13:32:24 +02:00
|
|
|
memcpy(*ppMemory, pStubMsg->Buffer, pCStructFormat->memory_size + bufsize);
|
|
|
|
pStubMsg->Buffer += pCStructFormat->memory_size + bufsize;
|
2006-05-15 14:35:31 +02:00
|
|
|
|
2005-11-28 11:30:12 +01:00
|
|
|
if (pCStructFormat->type == RPC_FC_CPSTRUCT)
|
|
|
|
EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
|
2006-05-15 14:35:31 +02:00
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantStructBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CSTRUCT_FORMAT * pCStructFormat = (const NDR_CSTRUCT_FORMAT *)pFormat;
|
2006-05-15 14:35:31 +02:00
|
|
|
PFORMAT_STRING pCArrayFormat;
|
|
|
|
ULONG esize;
|
|
|
|
|
2005-11-28 11:30:12 +01:00
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
2006-05-15 14:35:31 +02:00
|
|
|
pFormat += sizeof(NDR_CSTRUCT_FORMAT);
|
2005-11-28 11:30:12 +01:00
|
|
|
if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
2006-09-25 23:20:20 +02:00
|
|
|
pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description +
|
2006-05-15 14:35:31 +02:00
|
|
|
pCStructFormat->offset_to_array_description;
|
|
|
|
if (*pCArrayFormat != RPC_FC_CARRAY)
|
|
|
|
{
|
|
|
|
ERR("invalid array format type %x\n", pCStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
esize = *(const WORD*)(pCArrayFormat+2);
|
|
|
|
|
|
|
|
pCArrayFormat = ComputeConformance(pStubMsg, pMemory + pCStructFormat->memory_size, pCArrayFormat+4, 0);
|
|
|
|
SizeConformance(pStubMsg);
|
2005-11-28 11:30:12 +01:00
|
|
|
|
2006-05-10 14:12:30 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, pCStructFormat->alignment + 1);
|
|
|
|
|
2005-11-28 11:30:12 +01:00
|
|
|
TRACE("memory_size = %d\n", pCStructFormat->memory_size);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->BufferLength += pCStructFormat->memory_size +
|
|
|
|
safe_multiply(pStubMsg->MaxCount, esize);
|
2005-11-28 11:30:12 +01:00
|
|
|
|
|
|
|
if (pCStructFormat->type == RPC_FC_CPSTRUCT)
|
|
|
|
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantStructMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrConformantStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantStructFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingStructMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
|
2006-05-15 17:56:37 +02:00
|
|
|
PFORMAT_STRING pCVArrayFormat;
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG esize, bufsize;
|
2006-05-15 17:56:37 +02:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
|
|
|
|
if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCVStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-09-25 23:20:20 +02:00
|
|
|
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
|
2006-05-15 17:56:37 +02:00
|
|
|
pCVStructFormat->offset_to_array_description;
|
|
|
|
switch (*pCVArrayFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_CVARRAY:
|
|
|
|
esize = *(const WORD*)(pCVArrayFormat+2);
|
|
|
|
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 4, 0);
|
|
|
|
pCVArrayFormat = ComputeVariance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat, 0);
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_CSTRING:
|
|
|
|
TRACE("string=%s\n", debugstr_a((char*)pMemory + pCVStructFormat->memory_size));
|
|
|
|
pStubMsg->ActualCount = strlen((char*)pMemory + pCVStructFormat->memory_size)+1;
|
|
|
|
esize = sizeof(char);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_WSTRING:
|
|
|
|
TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory + pCVStructFormat->memory_size));
|
|
|
|
pStubMsg->ActualCount = strlenW((LPWSTR)pMemory + pCVStructFormat->memory_size)+1;
|
|
|
|
esize = sizeof(WCHAR);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("invalid array format type %x\n", *pCVArrayFormat);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
WriteConformance(pStubMsg);
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1);
|
|
|
|
|
|
|
|
TRACE("memory_size = %d\n", pCVStructFormat->memory_size);
|
|
|
|
|
2006-05-15 17:56:55 +02:00
|
|
|
/* write constant sized part */
|
2006-05-15 17:56:37 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-05-15 17:56:55 +02:00
|
|
|
memcpy(pStubMsg->Buffer, pMemory, pCVStructFormat->memory_size);
|
|
|
|
pStubMsg->Buffer += pCVStructFormat->memory_size;
|
|
|
|
|
|
|
|
WriteVariance(pStubMsg);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
|
|
|
|
2006-05-15 17:56:55 +02:00
|
|
|
/* write array part */
|
2006-06-10 13:32:24 +02:00
|
|
|
memcpy(pStubMsg->Buffer, pMemory + pCVStructFormat->memory_size, bufsize);
|
|
|
|
pStubMsg->Buffer += bufsize;
|
2006-05-15 17:56:37 +02:00
|
|
|
|
|
|
|
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingStructUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
|
2006-05-15 17:56:37 +02:00
|
|
|
PFORMAT_STRING pCVArrayFormat;
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG esize, bufsize;
|
2006-05-15 17:56:37 +02:00
|
|
|
unsigned char cvarray_type;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
|
|
|
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
|
|
|
|
if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCVStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-09-25 23:20:20 +02:00
|
|
|
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
|
2006-05-15 17:56:37 +02:00
|
|
|
pCVStructFormat->offset_to_array_description;
|
|
|
|
cvarray_type = *pCVArrayFormat;
|
|
|
|
switch (cvarray_type)
|
|
|
|
{
|
|
|
|
case RPC_FC_CVARRAY:
|
|
|
|
esize = *(const WORD*)(pCVArrayFormat+2);
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 4);
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_CSTRING:
|
|
|
|
esize = sizeof(char);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
|
|
|
|
else
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_WSTRING:
|
|
|
|
esize = sizeof(WCHAR);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
|
|
|
|
else
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("invalid array format type %x\n", *pCVArrayFormat);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1);
|
|
|
|
|
|
|
|
TRACE("memory_size = %d\n", pCVStructFormat->memory_size);
|
|
|
|
|
|
|
|
/* work out how much memory to allocate if we need to do so */
|
|
|
|
if (!*ppMemory || fMustAlloc)
|
|
|
|
{
|
2006-06-10 13:32:24 +02:00
|
|
|
SIZE_T size = pCVStructFormat->memory_size + safe_multiply(esize, pStubMsg->MaxCount);
|
2006-05-15 17:56:37 +02:00
|
|
|
*ppMemory = NdrAllocate(pStubMsg, size);
|
|
|
|
}
|
|
|
|
|
2006-05-15 17:56:55 +02:00
|
|
|
/* copy the constant data */
|
2006-05-15 17:56:37 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-05-15 17:56:55 +02:00
|
|
|
memcpy(*ppMemory, pStubMsg->Buffer, pCVStructFormat->memory_size);
|
|
|
|
pStubMsg->Buffer += pCVStructFormat->memory_size;
|
|
|
|
|
2006-06-10 13:32:47 +02:00
|
|
|
pCVArrayFormat = ReadVariance(pStubMsg, pCVArrayFormat, pStubMsg->MaxCount);
|
2006-05-15 17:56:55 +02:00
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
2006-06-10 13:32:35 +02:00
|
|
|
|
|
|
|
if ((cvarray_type == RPC_FC_C_CSTRING) ||
|
|
|
|
(cvarray_type == RPC_FC_C_WSTRING))
|
|
|
|
{
|
|
|
|
ULONG i;
|
|
|
|
/* strings must always have null terminating bytes */
|
|
|
|
if (bufsize < esize)
|
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
ERR("invalid string length of %d\n", pStubMsg->ActualCount);
|
2006-06-10 13:32:35 +02:00
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (i = bufsize - esize; i < bufsize; i++)
|
|
|
|
if (pStubMsg->Buffer[i] != 0)
|
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
ERR("string not null-terminated at byte position %d, data is 0x%x\n",
|
2006-06-10 13:32:35 +02:00
|
|
|
i, pStubMsg->Buffer[i]);
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-15 17:56:55 +02:00
|
|
|
/* copy the array data */
|
|
|
|
memcpy(*ppMemory + pCVStructFormat->memory_size, pStubMsg->Buffer,
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize);
|
|
|
|
pStubMsg->Buffer += bufsize;
|
2006-05-15 17:56:37 +02:00
|
|
|
|
|
|
|
if (cvarray_type == RPC_FC_C_CSTRING)
|
|
|
|
TRACE("string=%s\n", debugstr_a((char *)(*ppMemory + pCVStructFormat->memory_size)));
|
|
|
|
else if (cvarray_type == RPC_FC_C_WSTRING)
|
|
|
|
TRACE("string=%s\n", debugstr_w((WCHAR *)(*ppMemory + pCVStructFormat->memory_size)));
|
|
|
|
|
|
|
|
EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingStructBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
|
2006-05-15 17:56:37 +02:00
|
|
|
PFORMAT_STRING pCVArrayFormat;
|
|
|
|
ULONG esize;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
|
|
|
|
if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCVStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-09-25 23:20:20 +02:00
|
|
|
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
|
2006-05-15 17:56:37 +02:00
|
|
|
pCVStructFormat->offset_to_array_description;
|
|
|
|
switch (*pCVArrayFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_CVARRAY:
|
|
|
|
esize = *(const WORD*)(pCVArrayFormat+2);
|
|
|
|
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 4, 0);
|
|
|
|
pCVArrayFormat = ComputeVariance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
2006-06-02 21:45:40 +02:00
|
|
|
pCVArrayFormat, 0);
|
2006-05-15 17:56:37 +02:00
|
|
|
break;
|
|
|
|
case RPC_FC_C_CSTRING:
|
|
|
|
TRACE("string=%s\n", debugstr_a((char*)pMemory + pCVStructFormat->memory_size));
|
|
|
|
pStubMsg->ActualCount = strlen((char*)pMemory + pCVStructFormat->memory_size)+1;
|
|
|
|
esize = sizeof(char);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_WSTRING:
|
|
|
|
TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory + pCVStructFormat->memory_size));
|
|
|
|
pStubMsg->ActualCount = strlenW((LPWSTR)pMemory + pCVStructFormat->memory_size)+1;
|
|
|
|
esize = sizeof(WCHAR);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("invalid array format type %x\n", *pCVArrayFormat);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SizeConformance(pStubMsg);
|
|
|
|
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, pCVStructFormat->alignment + 1);
|
|
|
|
|
|
|
|
TRACE("memory_size = %d\n", pCVStructFormat->memory_size);
|
|
|
|
|
2006-05-15 17:56:55 +02:00
|
|
|
pStubMsg->BufferLength += pCVStructFormat->memory_size;
|
|
|
|
SizeVariance(pStubMsg);
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->BufferLength += safe_multiply(pStubMsg->MaxCount, esize);
|
2006-05-15 17:56:37 +02:00
|
|
|
|
|
|
|
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingStructMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
|
2006-05-15 17:56:37 +02:00
|
|
|
PFORMAT_STRING pCVArrayFormat;
|
|
|
|
ULONG esize;
|
|
|
|
unsigned char cvarray_type;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pStubMsg, pFormat);
|
|
|
|
|
|
|
|
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
|
|
|
|
if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCVStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-09-25 23:20:20 +02:00
|
|
|
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
|
2006-05-15 17:56:37 +02:00
|
|
|
pCVStructFormat->offset_to_array_description;
|
|
|
|
cvarray_type = *pCVArrayFormat;
|
|
|
|
switch (cvarray_type)
|
|
|
|
{
|
|
|
|
case RPC_FC_CVARRAY:
|
|
|
|
esize = *(const WORD*)(pCVArrayFormat+2);
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 4);
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_CSTRING:
|
|
|
|
esize = sizeof(char);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
|
|
|
|
else
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_WSTRING:
|
|
|
|
esize = sizeof(WCHAR);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, pCVArrayFormat + 2);
|
|
|
|
else
|
|
|
|
pCVArrayFormat = ReadConformance(pStubMsg, NULL);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("invalid array format type %x\n", *pCVArrayFormat);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1);
|
|
|
|
|
|
|
|
TRACE("memory_size = %d\n", pCVStructFormat->memory_size);
|
|
|
|
|
2006-05-15 17:56:55 +02:00
|
|
|
pStubMsg->Buffer += pCVStructFormat->memory_size;
|
2006-06-10 13:32:47 +02:00
|
|
|
pCVArrayFormat = ReadVariance(pStubMsg, pCVArrayFormat, pStubMsg->MaxCount);
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->Buffer += pCVStructFormat->memory_size + safe_multiply(esize, pStubMsg->ActualCount);
|
2006-05-15 17:56:55 +02:00
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->MemorySize += pCVStructFormat->memory_size + safe_multiply(esize, pStubMsg->MaxCount);
|
2006-05-15 17:56:37 +02:00
|
|
|
|
|
|
|
EmbeddedPointerMemorySize(pStubMsg, pFormat);
|
|
|
|
|
2006-05-15 17:56:55 +02:00
|
|
|
return pCVStructFormat->memory_size + pStubMsg->MaxCount * esize;
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrConformantVaryingStructFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrConformantVaryingStructFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-09-25 23:20:20 +02:00
|
|
|
const NDR_CVSTRUCT_FORMAT *pCVStructFormat = (const NDR_CVSTRUCT_FORMAT *)pFormat;
|
2006-05-15 17:56:37 +02:00
|
|
|
PFORMAT_STRING pCVArrayFormat;
|
|
|
|
ULONG esize;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
|
|
|
|
if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pCVStructFormat->type);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-09-25 23:20:20 +02:00
|
|
|
pCVArrayFormat = (const unsigned char *)&pCVStructFormat->offset_to_array_description +
|
2006-05-15 17:56:37 +02:00
|
|
|
pCVStructFormat->offset_to_array_description;
|
|
|
|
switch (*pCVArrayFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_CVARRAY:
|
|
|
|
esize = *(const WORD*)(pCVArrayFormat+2);
|
|
|
|
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 4, 0);
|
|
|
|
pCVArrayFormat = ComputeVariance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat, 0);
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_CSTRING:
|
|
|
|
TRACE("string=%s\n", debugstr_a((char*)pMemory + pCVStructFormat->memory_size));
|
|
|
|
pStubMsg->ActualCount = strlen((char*)pMemory + pCVStructFormat->memory_size)+1;
|
|
|
|
esize = sizeof(char);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
|
|
|
break;
|
|
|
|
case RPC_FC_C_WSTRING:
|
|
|
|
TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory + pCVStructFormat->memory_size));
|
|
|
|
pStubMsg->ActualCount = strlenW((LPWSTR)pMemory + pCVStructFormat->memory_size)+1;
|
|
|
|
esize = sizeof(WCHAR);
|
|
|
|
if (pCVArrayFormat[1] == RPC_FC_STRING_SIZED)
|
|
|
|
pCVArrayFormat = ComputeConformance(pStubMsg, pMemory + pCVStructFormat->memory_size,
|
|
|
|
pCVArrayFormat + 2, 0);
|
|
|
|
else
|
|
|
|
pStubMsg->MaxCount = pStubMsg->ActualCount;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERR("invalid array format type %x\n", *pCVArrayFormat);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("memory_size = %d\n", pCVStructFormat->memory_size);
|
|
|
|
|
|
|
|
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
2007-02-12 14:29:04 +01:00
|
|
|
#include "pshpack1.h"
|
2006-05-15 17:57:21 +02:00
|
|
|
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;
|
2007-02-12 14:29:04 +01:00
|
|
|
#include "poppack.h"
|
2006-05-15 17:57:21 +02:00
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrFixedArrayMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-15 17:57:21 +02:00
|
|
|
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;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
|
|
|
|
total_size = pLgFArrayFormat->total_size;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pLgFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
2006-07-24 12:46:03 +02:00
|
|
|
|
2006-05-15 17:57:21 +02:00
|
|
|
memcpy(pStubMsg->Buffer, pMemory, total_size);
|
2006-07-24 12:46:03 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-05-15 17:57:21 +02:00
|
|
|
pStubMsg->Buffer += total_size;
|
|
|
|
|
|
|
|
pFormat = EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrFixedArrayUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-05-15 17:57:21 +02:00
|
|
|
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;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
|
|
|
|
total_size = pLgFArrayFormat->total_size;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pLgFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fMustAlloc || !*ppMemory)
|
|
|
|
*ppMemory = NdrAllocate(pStubMsg, total_size);
|
|
|
|
memcpy(*ppMemory, pStubMsg->Buffer, total_size);
|
2006-07-24 12:46:03 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-05-15 17:57:21 +02:00
|
|
|
pStubMsg->Buffer += total_size;
|
|
|
|
|
|
|
|
pFormat = EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrFixedArrayBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-15 17:57:21 +02:00
|
|
|
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;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
|
|
|
|
total_size = pLgFArrayFormat->total_size;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pLgFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
|
|
|
pStubMsg->BufferLength += total_size;
|
|
|
|
|
|
|
|
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrFixedArrayMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-15 17:57:21 +02:00
|
|
|
const NDR_SMFARRAY_FORMAT *pSmFArrayFormat = (const NDR_SMFARRAY_FORMAT *)pFormat;
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG total_size;
|
2006-05-15 17:57:21 +02:00
|
|
|
|
|
|
|
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;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
|
|
|
|
total_size = pLgFArrayFormat->total_size;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pLgFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
2006-07-24 12:46:03 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-05-15 17:57:21 +02:00
|
|
|
pStubMsg->Buffer += total_size;
|
|
|
|
pStubMsg->MemorySize += total_size;
|
|
|
|
|
|
|
|
EmbeddedPointerMemorySize(pStubMsg, pFormat);
|
|
|
|
|
|
|
|
return total_size;
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrFixedArrayFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrFixedArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-05-15 17:57:21 +02:00
|
|
|
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)
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
const NDR_LGFARRAY_FORMAT *pLgFArrayFormat = (const NDR_LGFARRAY_FORMAT *)pFormat;
|
2006-09-25 23:20:20 +02:00
|
|
|
pFormat = (const unsigned char *)(pLgFArrayFormat + 1);
|
2006-05-15 17:57:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrVaryingArrayMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-06-05 02:41:30 +02:00
|
|
|
unsigned char alignment;
|
|
|
|
DWORD elements, esize;
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG bufsize;
|
2006-06-05 02:41:30 +02:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
if ((pFormat[0] != RPC_FC_SMVARRAY) &&
|
|
|
|
(pFormat[0] != RPC_FC_LGVARRAY))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
|
|
|
if (pFormat[0] == RPC_FC_SMVARRAY)
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
elements = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
elements = *(const DWORD*)pFormat;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
}
|
|
|
|
|
|
|
|
esize = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
if ((pStubMsg->ActualCount > elements) ||
|
|
|
|
(pStubMsg->ActualCount + pStubMsg->Offset > elements))
|
|
|
|
{
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
WriteVariance(pStubMsg);
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
|
|
|
memcpy(pStubMsg->Buffer, pMemory + pStubMsg->Offset, bufsize);
|
2006-06-05 02:41:30 +02:00
|
|
|
pStubMsg->BufferMark = pStubMsg->Buffer;
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->Buffer += bufsize;
|
2006-06-05 02:41:30 +02:00
|
|
|
|
|
|
|
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrVaryingArrayUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-06-05 02:41:30 +02:00
|
|
|
unsigned char alignment;
|
|
|
|
DWORD size, elements, esize;
|
2006-06-10 13:32:24 +02:00
|
|
|
ULONG bufsize;
|
2006-06-05 02:41:30 +02:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
|
|
|
if ((pFormat[0] != RPC_FC_SMVARRAY) &&
|
|
|
|
(pFormat[0] != RPC_FC_LGVARRAY))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
|
|
|
if (pFormat[0] == RPC_FC_SMVARRAY)
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
size = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
elements = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
size = *(const DWORD*)pFormat;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
elements = *(const DWORD*)pFormat;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
}
|
|
|
|
|
|
|
|
esize = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
|
2006-06-10 13:32:47 +02:00
|
|
|
pFormat = ReadVariance(pStubMsg, pFormat, elements);
|
2006-06-05 02:41:30 +02:00
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
bufsize = safe_multiply(esize, pStubMsg->ActualCount);
|
|
|
|
|
2006-06-05 02:41:30 +02:00
|
|
|
if (!*ppMemory || fMustAlloc)
|
|
|
|
*ppMemory = NdrAllocate(pStubMsg, size);
|
2006-06-10 13:32:24 +02:00
|
|
|
memcpy(*ppMemory + pStubMsg->Offset, pStubMsg->Buffer, bufsize);
|
|
|
|
pStubMsg->Buffer += bufsize;
|
2006-06-05 02:41:30 +02:00
|
|
|
|
|
|
|
EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrVaryingArrayBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-06-05 02:41:30 +02:00
|
|
|
unsigned char alignment;
|
|
|
|
DWORD elements, esize;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
if ((pFormat[0] != RPC_FC_SMVARRAY) &&
|
|
|
|
(pFormat[0] != RPC_FC_LGVARRAY))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
|
|
|
if (pFormat[0] == RPC_FC_SMVARRAY)
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
elements = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
elements = *(const DWORD*)pFormat;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
}
|
|
|
|
|
|
|
|
esize = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
if ((pStubMsg->ActualCount > elements) ||
|
|
|
|
(pStubMsg->ActualCount + pStubMsg->Offset > elements))
|
|
|
|
{
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SizeVariance(pStubMsg);
|
|
|
|
|
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, alignment);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->BufferLength += safe_multiply(esize, pStubMsg->ActualCount);
|
2006-06-05 02:41:30 +02:00
|
|
|
|
|
|
|
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrVaryingArrayMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-06-05 02:41:30 +02:00
|
|
|
unsigned char alignment;
|
|
|
|
DWORD size, elements, esize;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pStubMsg, pFormat);
|
|
|
|
|
|
|
|
if ((pFormat[0] != RPC_FC_SMVARRAY) &&
|
|
|
|
(pFormat[0] != RPC_FC_LGVARRAY))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
|
|
|
if (pFormat[0] == RPC_FC_SMVARRAY)
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
size = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
elements = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
size = *(const DWORD*)pFormat;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
elements = *(const DWORD*)pFormat;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
}
|
|
|
|
|
|
|
|
esize = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
|
2006-06-10 13:32:47 +02:00
|
|
|
pFormat = ReadVariance(pStubMsg, pFormat, elements);
|
2006-06-05 02:41:30 +02:00
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, alignment);
|
|
|
|
|
2006-06-10 13:32:24 +02:00
|
|
|
pStubMsg->Buffer += safe_multiply(esize, pStubMsg->ActualCount);
|
2006-06-05 02:41:30 +02:00
|
|
|
pStubMsg->MemorySize += size;
|
|
|
|
|
|
|
|
EmbeddedPointerMemorySize(pStubMsg, pFormat);
|
|
|
|
|
|
|
|
return pStubMsg->MemorySize;
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrVaryingArrayFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrVaryingArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-06-05 02:41:30 +02:00
|
|
|
unsigned char alignment;
|
|
|
|
DWORD elements;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
|
|
|
|
if ((pFormat[0] != RPC_FC_SMVARRAY) &&
|
|
|
|
(pFormat[0] != RPC_FC_LGVARRAY))
|
|
|
|
{
|
|
|
|
ERR("invalid format type %x\n", pFormat[0]);
|
|
|
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
alignment = pFormat[1] + 1;
|
|
|
|
|
|
|
|
if (pFormat[0] == RPC_FC_SMVARRAY)
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
elements = *(const WORD*)pFormat;
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pFormat += 2;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
elements = *(const DWORD*)pFormat;
|
|
|
|
pFormat += sizeof(DWORD);
|
|
|
|
}
|
|
|
|
|
|
|
|
pFormat += sizeof(WORD);
|
|
|
|
|
|
|
|
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
if ((pStubMsg->ActualCount > elements) ||
|
|
|
|
(pStubMsg->ActualCount + pStubMsg->Offset > elements))
|
|
|
|
{
|
|
|
|
RpcRaiseException(RPC_S_INVALID_BOUND);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrEncapsulatedUnionMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrEncapsulatedUnionUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrEncapsulatedUnionBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrEncapsulatedUnionMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrEncapsulatedUnionFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
2006-04-28 15:28:24 +02:00
|
|
|
static PFORMAT_STRING get_arm_offset_from_union_arm_selector(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned long discriminant,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
unsigned short num_arms, arm, type;
|
|
|
|
|
|
|
|
num_arms = *(const SHORT*)pFormat & 0x0fff;
|
|
|
|
pFormat += 2;
|
|
|
|
for(arm = 0; arm < num_arms; arm++)
|
|
|
|
{
|
|
|
|
if(discriminant == *(const ULONG*)pFormat)
|
|
|
|
{
|
|
|
|
pFormat += 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pFormat += 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
type = *(const unsigned short*)pFormat;
|
|
|
|
TRACE("type %04x\n", type);
|
|
|
|
if(arm == num_arms) /* default arm extras */
|
|
|
|
{
|
|
|
|
if(type == 0xffff)
|
|
|
|
{
|
2006-05-17 15:45:55 +02:00
|
|
|
ERR("no arm for 0x%lx and no default case\n", discriminant);
|
|
|
|
RpcRaiseException(RPC_S_INVALID_TAG);
|
2006-04-28 15:28:24 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if(type == 0)
|
|
|
|
{
|
2006-05-17 15:45:55 +02:00
|
|
|
TRACE("falling back to empty default case for 0x%lx\n", discriminant);
|
2006-04-28 15:28:24 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pFormat;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PFORMAT_STRING get_non_encapsulated_union_arm(PMIDL_STUB_MESSAGE pStubMsg,
|
2006-05-15 17:56:27 +02:00
|
|
|
ULONG value,
|
2006-04-28 15:28:24 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
pFormat += *(const SHORT*)pFormat;
|
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
return get_arm_offset_from_union_arm_selector(pStubMsg, value, pFormat);
|
|
|
|
}
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonEncapsulatedUnionMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrNonEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-04-28 15:28:24 +02:00
|
|
|
unsigned short type;
|
2006-05-15 17:56:27 +02:00
|
|
|
unsigned char switch_type;
|
2006-04-28 15:28:24 +02:00
|
|
|
|
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
|
|
|
pFormat++;
|
|
|
|
|
2006-05-15 17:56:27 +02:00
|
|
|
switch_type = *pFormat;
|
2006-04-28 15:28:24 +02:00
|
|
|
pFormat++;
|
|
|
|
|
2006-05-15 17:56:27 +02:00
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
|
|
|
|
/* Marshall discriminant */
|
|
|
|
NdrBaseTypeMarshall(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type);
|
|
|
|
|
|
|
|
pFormat = get_non_encapsulated_union_arm(pStubMsg, pStubMsg->MaxCount, pFormat);
|
2006-04-28 15:28:24 +02:00
|
|
|
if(!pFormat)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
type = *(const unsigned short*)pFormat;
|
2006-05-13 18:00:27 +02:00
|
|
|
if((type & 0xff00) == 0x8000)
|
2006-04-28 15:28:24 +02:00
|
|
|
{
|
2006-05-13 18:00:27 +02:00
|
|
|
unsigned char basetype = LOBYTE(type);
|
|
|
|
return NdrBaseTypeMarshall(pStubMsg, pMemory, &basetype);
|
2006-04-28 15:28:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PFORMAT_STRING desc = pFormat + *(const SHORT*)pFormat;
|
|
|
|
NDR_MARSHALL m = NdrMarshaller[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m)
|
|
|
|
{
|
2006-05-15 14:35:17 +02:00
|
|
|
unsigned char *saved_buffer = NULL;
|
2006-04-28 15:28:24 +02:00
|
|
|
switch(*desc)
|
|
|
|
{
|
|
|
|
case RPC_FC_RP:
|
|
|
|
case RPC_FC_UP:
|
|
|
|
case RPC_FC_OP:
|
|
|
|
case RPC_FC_FP:
|
2006-05-15 14:35:17 +02:00
|
|
|
saved_buffer = pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += 4; /* for pointer ID */
|
|
|
|
PointerMarshall(pStubMsg, saved_buffer, *(unsigned char **)pMemory, desc);
|
2006-04-28 15:28:24 +02:00
|
|
|
break;
|
2006-05-15 14:35:17 +02:00
|
|
|
default:
|
|
|
|
m(pStubMsg, pMemory, desc);
|
2006-04-28 15:28:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else FIXME("no marshaller for embedded type %02x\n", *desc);
|
|
|
|
}
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-04-28 15:28:24 +02:00
|
|
|
static long unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING *ppFormat)
|
|
|
|
{
|
|
|
|
long discriminant = 0;
|
|
|
|
|
|
|
|
switch(**ppFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
discriminant = *(UCHAR *)pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += sizeof(UCHAR);
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
|
2006-04-28 15:28:24 +02:00
|
|
|
discriminant = *(USHORT *)pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += sizeof(USHORT);
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG));
|
2006-04-28 15:28:24 +02:00
|
|
|
discriminant = *(ULONG *)pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += sizeof(ULONG);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("Unhandled base type: 0x%02x\n", **ppFormat);
|
|
|
|
}
|
|
|
|
(*ppFormat)++;
|
|
|
|
|
|
|
|
if (pStubMsg->fHasNewCorrDesc)
|
|
|
|
*ppFormat += 6;
|
|
|
|
else
|
|
|
|
*ppFormat += 4;
|
|
|
|
return discriminant;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* NdrNonEncapsulatedUnionUnmarshall [RPCRT4.@]
|
2005-07-18 15:14:05 +02:00
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
2006-04-28 15:28:24 +02:00
|
|
|
long discriminant;
|
|
|
|
unsigned short type, size;
|
|
|
|
|
|
|
|
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
|
|
|
|
pFormat++;
|
|
|
|
|
|
|
|
/* Unmarshall discriminant */
|
|
|
|
discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
|
|
|
|
TRACE("unmarshalled discriminant %lx\n", discriminant);
|
|
|
|
|
|
|
|
pFormat += *(const SHORT*)pFormat;
|
|
|
|
|
|
|
|
size = *(const unsigned short*)pFormat;
|
|
|
|
pFormat += 2;
|
|
|
|
|
|
|
|
pFormat = get_arm_offset_from_union_arm_selector(pStubMsg, discriminant, pFormat);
|
|
|
|
if(!pFormat)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if(!*ppMemory || fMustAlloc)
|
|
|
|
*ppMemory = NdrAllocate(pStubMsg, size);
|
|
|
|
|
|
|
|
type = *(const unsigned short*)pFormat;
|
2006-05-13 18:00:27 +02:00
|
|
|
if((type & 0xff00) == 0x8000)
|
2006-04-28 15:28:24 +02:00
|
|
|
{
|
2006-05-13 18:00:27 +02:00
|
|
|
unsigned char basetype = LOBYTE(type);
|
|
|
|
return NdrBaseTypeUnmarshall(pStubMsg, ppMemory, &basetype, fMustAlloc);
|
2006-04-28 15:28:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PFORMAT_STRING desc = pFormat + *(const SHORT*)pFormat;
|
|
|
|
NDR_UNMARSHALL m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m)
|
|
|
|
{
|
2006-05-15 14:35:17 +02:00
|
|
|
unsigned char *saved_buffer = NULL;
|
2006-04-28 15:28:24 +02:00
|
|
|
switch(*desc)
|
|
|
|
{
|
|
|
|
case RPC_FC_RP:
|
|
|
|
case RPC_FC_UP:
|
|
|
|
case RPC_FC_OP:
|
|
|
|
case RPC_FC_FP:
|
2006-05-15 14:35:17 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
saved_buffer = pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += 4; /* for pointer ID */
|
2006-05-19 17:03:13 +02:00
|
|
|
PointerUnmarshall(pStubMsg, saved_buffer, *(unsigned char ***)ppMemory, desc, TRUE);
|
2006-04-28 15:28:24 +02:00
|
|
|
break;
|
2006-05-15 14:35:17 +02:00
|
|
|
default:
|
|
|
|
m(pStubMsg, ppMemory, desc, fMustAlloc);
|
2006-04-28 15:28:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else FIXME("no marshaller for embedded type %02x\n", *desc);
|
|
|
|
}
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonEncapsulatedUnionBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-04-28 15:28:24 +02:00
|
|
|
unsigned short type;
|
2006-05-15 17:56:27 +02:00
|
|
|
unsigned char switch_type;
|
|
|
|
|
2006-04-28 15:28:24 +02:00
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
|
2006-05-15 17:56:27 +02:00
|
|
|
pFormat++;
|
2006-04-28 15:28:24 +02:00
|
|
|
|
2006-05-15 17:56:27 +02:00
|
|
|
switch_type = *pFormat;
|
2006-04-28 15:28:24 +02:00
|
|
|
pFormat++;
|
2006-05-15 17:56:27 +02:00
|
|
|
|
|
|
|
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
|
|
|
|
TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
|
2006-04-28 15:28:24 +02:00
|
|
|
/* Add discriminant size */
|
2006-05-15 17:56:27 +02:00
|
|
|
NdrBaseTypeBufferSize(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type);
|
2006-04-28 15:28:24 +02:00
|
|
|
|
2006-05-15 17:56:27 +02:00
|
|
|
pFormat = get_non_encapsulated_union_arm(pStubMsg, pStubMsg->MaxCount, pFormat);
|
2006-04-28 15:28:24 +02:00
|
|
|
if(!pFormat)
|
|
|
|
return;
|
|
|
|
|
|
|
|
type = *(const unsigned short*)pFormat;
|
2006-05-13 18:00:27 +02:00
|
|
|
if((type & 0xff00) == 0x8000)
|
2006-04-28 15:28:24 +02:00
|
|
|
{
|
2006-05-13 18:00:27 +02:00
|
|
|
unsigned char basetype = LOBYTE(type);
|
|
|
|
NdrBaseTypeBufferSize(pStubMsg, pMemory, &basetype);
|
2006-04-28 15:28:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PFORMAT_STRING desc = pFormat + *(const SHORT*)pFormat;
|
|
|
|
NDR_BUFFERSIZE m = NdrBufferSizer[*desc & NDR_TABLE_MASK];
|
|
|
|
if (m)
|
|
|
|
{
|
|
|
|
switch(*desc)
|
|
|
|
{
|
|
|
|
case RPC_FC_RP:
|
|
|
|
case RPC_FC_UP:
|
|
|
|
case RPC_FC_OP:
|
|
|
|
case RPC_FC_FP:
|
2006-05-15 14:35:17 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, 4);
|
|
|
|
pStubMsg->BufferLength += 4; /* for pointer ID */
|
|
|
|
PointerBufferSize(pStubMsg, *(unsigned char **)pMemory, desc);
|
2006-04-28 15:28:24 +02:00
|
|
|
break;
|
2006-05-15 14:35:17 +02:00
|
|
|
default:
|
|
|
|
m(pStubMsg, pMemory, desc);
|
2006-04-28 15:28:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else FIXME("no buffersizer for embedded type %02x\n", *desc);
|
|
|
|
}
|
|
|
|
return;
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonEncapsulatedUnionMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG discriminant;
|
2006-05-18 04:39:34 +02:00
|
|
|
unsigned short type, size;
|
|
|
|
|
|
|
|
pFormat++;
|
|
|
|
/* Unmarshall discriminant */
|
|
|
|
discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("unmarshalled discriminant 0x%x\n", discriminant);
|
2006-05-18 04:39:34 +02:00
|
|
|
|
|
|
|
pFormat += *(const SHORT*)pFormat;
|
|
|
|
|
|
|
|
size = *(const unsigned short*)pFormat;
|
2006-05-10 14:12:20 +02:00
|
|
|
pFormat += 2;
|
2006-05-18 04:39:34 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2006-05-10 14:12:20 +02:00
|
|
|
else
|
2006-05-18 04:39:34 +02:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2006-05-10 14:12:20 +02:00
|
|
|
|
2006-05-18 04:39:34 +02:00
|
|
|
TRACE("size %d\n", size);
|
|
|
|
return size;
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrNonEncapsulatedUnionFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrNonEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrByteCountPointerMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrByteCountPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrByteCountPointerUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrByteCountPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrByteCountPointerBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrByteCountPointerMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrByteCountPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrByteCountPointerFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrByteCountPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrXmitOrRepAsMarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrXmitOrRepAsMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrXmitOrRepAsUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
unsigned char * WINAPI NdrXmitOrRepAsUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrXmitOrRepAsBufferSize [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrXmitOrRepAsBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrXmitOrRepAsMemorySize [RPCRT4.@]
|
|
|
|
*/
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG WINAPI NdrXmitOrRepAsMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
2005-07-18 15:14:05 +02:00
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrXmitOrRepAsFree [RPCRT4.@]
|
|
|
|
*/
|
|
|
|
void WINAPI NdrXmitOrRepAsFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
|
|
|
|
2005-11-28 11:24:21 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NdrBaseTypeMarshall [internal]
|
|
|
|
*/
|
|
|
|
static unsigned char *WINAPI NdrBaseTypeMarshall(
|
|
|
|
PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
|
|
|
|
|
|
|
|
switch(*pFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
*(UCHAR *)pStubMsg->Buffer = *(UCHAR *)pMemory;
|
|
|
|
pStubMsg->Buffer += sizeof(UCHAR);
|
|
|
|
TRACE("value: 0x%02x\n", *(UCHAR *)pMemory);
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
|
2005-11-28 11:24:21 +01:00
|
|
|
*(USHORT *)pStubMsg->Buffer = *(USHORT *)pMemory;
|
|
|
|
pStubMsg->Buffer += sizeof(USHORT);
|
|
|
|
TRACE("value: 0x%04x\n", *(USHORT *)pMemory);
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
|
|
|
case RPC_FC_ERROR_STATUS_T:
|
2006-03-01 13:21:56 +01:00
|
|
|
case RPC_FC_ENUM32:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG));
|
2005-11-28 11:24:21 +01:00
|
|
|
*(ULONG *)pStubMsg->Buffer = *(ULONG *)pMemory;
|
|
|
|
pStubMsg->Buffer += sizeof(ULONG);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("value: 0x%08x\n", *(ULONG *)pMemory);
|
2005-11-28 11:24:21 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_FLOAT:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(float));
|
2005-11-28 11:24:21 +01:00
|
|
|
*(float *)pStubMsg->Buffer = *(float *)pMemory;
|
|
|
|
pStubMsg->Buffer += sizeof(float);
|
|
|
|
break;
|
|
|
|
case RPC_FC_DOUBLE:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(double));
|
2005-11-28 11:24:21 +01:00
|
|
|
*(double *)pStubMsg->Buffer = *(double *)pMemory;
|
|
|
|
pStubMsg->Buffer += sizeof(double);
|
|
|
|
break;
|
|
|
|
case RPC_FC_HYPER:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG));
|
2005-11-28 11:24:21 +01:00
|
|
|
*(ULONGLONG *)pStubMsg->Buffer = *(ULONGLONG *)pMemory;
|
|
|
|
pStubMsg->Buffer += sizeof(ULONGLONG);
|
|
|
|
TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory));
|
|
|
|
break;
|
|
|
|
case RPC_FC_ENUM16:
|
2006-03-01 13:21:56 +01:00
|
|
|
/* only 16-bits on the wire, so do a sanity check */
|
|
|
|
if (*(UINT *)pMemory > USHRT_MAX)
|
|
|
|
RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE);
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
|
2006-03-01 13:21:56 +01:00
|
|
|
*(USHORT *)pStubMsg->Buffer = *(UINT *)pMemory;
|
|
|
|
pStubMsg->Buffer += sizeof(USHORT);
|
|
|
|
TRACE("value: 0x%04x\n", *(UINT *)pMemory);
|
|
|
|
break;
|
2005-11-28 11:24:21 +01:00
|
|
|
default:
|
|
|
|
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
STD_OVERFLOW_CHECK(pStubMsg);
|
|
|
|
|
|
|
|
/* FIXME: what is the correct return value? */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrBaseTypeUnmarshall [internal]
|
|
|
|
*/
|
|
|
|
static unsigned char *WINAPI NdrBaseTypeUnmarshall(
|
|
|
|
PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char **ppMemory,
|
|
|
|
PFORMAT_STRING pFormat,
|
|
|
|
unsigned char fMustAlloc)
|
|
|
|
{
|
|
|
|
TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false");
|
|
|
|
|
2006-05-19 17:02:59 +02:00
|
|
|
#define BASE_TYPE_UNMARSHALL(type) \
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \
|
2006-06-05 02:41:18 +02:00
|
|
|
if (fMustAlloc || !*ppMemory) \
|
|
|
|
*ppMemory = NdrAllocate(pStubMsg, sizeof(type)); \
|
|
|
|
TRACE("*ppMemory: %p\n", *ppMemory); \
|
2006-05-19 17:02:59 +02:00
|
|
|
**(type **)ppMemory = *(type *)pStubMsg->Buffer; \
|
|
|
|
pStubMsg->Buffer += sizeof(type);
|
|
|
|
|
2005-11-28 11:24:21 +01:00
|
|
|
switch(*pFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
2006-05-19 17:02:59 +02:00
|
|
|
BASE_TYPE_UNMARSHALL(UCHAR);
|
2005-11-28 11:24:21 +01:00
|
|
|
TRACE("value: 0x%02x\n", **(UCHAR **)ppMemory);
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
2006-05-19 17:02:59 +02:00
|
|
|
BASE_TYPE_UNMARSHALL(USHORT);
|
2005-11-28 11:24:21 +01:00
|
|
|
TRACE("value: 0x%04x\n", **(USHORT **)ppMemory);
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
|
|
|
case RPC_FC_ERROR_STATUS_T:
|
2006-03-01 13:21:56 +01:00
|
|
|
case RPC_FC_ENUM32:
|
2006-05-19 17:02:59 +02:00
|
|
|
BASE_TYPE_UNMARSHALL(ULONG);
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
|
2005-11-28 11:24:21 +01:00
|
|
|
break;
|
|
|
|
case RPC_FC_FLOAT:
|
2006-05-19 17:02:59 +02:00
|
|
|
BASE_TYPE_UNMARSHALL(float);
|
2005-11-28 11:24:21 +01:00
|
|
|
TRACE("value: %f\n", **(float **)ppMemory);
|
|
|
|
break;
|
|
|
|
case RPC_FC_DOUBLE:
|
2006-05-19 17:02:59 +02:00
|
|
|
BASE_TYPE_UNMARSHALL(double);
|
2005-11-28 11:24:21 +01:00
|
|
|
TRACE("value: %f\n", **(double **)ppMemory);
|
|
|
|
break;
|
|
|
|
case RPC_FC_HYPER:
|
2006-05-19 17:02:59 +02:00
|
|
|
BASE_TYPE_UNMARSHALL(ULONGLONG);
|
2005-11-28 11:24:21 +01:00
|
|
|
TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory));
|
|
|
|
break;
|
|
|
|
case RPC_FC_ENUM16:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
|
2006-06-05 02:41:18 +02:00
|
|
|
if (fMustAlloc || !*ppMemory)
|
|
|
|
*ppMemory = NdrAllocate(pStubMsg, sizeof(UINT));
|
|
|
|
TRACE("*ppMemory: %p\n", *ppMemory);
|
2006-03-01 13:21:56 +01:00
|
|
|
/* 16-bits on the wire, but int in memory */
|
|
|
|
**(UINT **)ppMemory = *(USHORT *)pStubMsg->Buffer;
|
|
|
|
pStubMsg->Buffer += sizeof(USHORT);
|
|
|
|
TRACE("value: 0x%08x\n", **(UINT **)ppMemory);
|
|
|
|
break;
|
2005-11-28 11:24:21 +01:00
|
|
|
default:
|
|
|
|
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
|
|
|
|
}
|
2006-05-19 17:02:59 +02:00
|
|
|
#undef BASE_TYPE_UNMARSHALL
|
2005-11-28 11:24:21 +01:00
|
|
|
|
|
|
|
/* FIXME: what is the correct return value? */
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrBaseTypeBufferSize [internal]
|
|
|
|
*/
|
|
|
|
static void WINAPI NdrBaseTypeBufferSize(
|
|
|
|
PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
|
|
|
|
|
|
|
|
switch(*pFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
|
|
|
pStubMsg->BufferLength += sizeof(UCHAR);
|
|
|
|
break;
|
|
|
|
case RPC_FC_WCHAR:
|
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
2006-03-01 13:21:56 +01:00
|
|
|
case RPC_FC_ENUM16:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(USHORT));
|
2005-11-28 11:24:21 +01:00
|
|
|
pStubMsg->BufferLength += sizeof(USHORT);
|
|
|
|
break;
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2006-03-01 13:21:56 +01:00
|
|
|
case RPC_FC_ENUM32:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONG));
|
2005-11-28 11:24:21 +01:00
|
|
|
pStubMsg->BufferLength += sizeof(ULONG);
|
|
|
|
break;
|
|
|
|
case RPC_FC_FLOAT:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(float));
|
2005-11-28 11:24:21 +01:00
|
|
|
pStubMsg->BufferLength += sizeof(float);
|
|
|
|
break;
|
|
|
|
case RPC_FC_DOUBLE:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(double));
|
2005-11-28 11:24:21 +01:00
|
|
|
pStubMsg->BufferLength += sizeof(double);
|
|
|
|
break;
|
|
|
|
case RPC_FC_HYPER:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONGLONG));
|
2005-11-28 11:24:21 +01:00
|
|
|
pStubMsg->BufferLength += sizeof(ULONGLONG);
|
|
|
|
break;
|
|
|
|
case RPC_FC_ERROR_STATUS_T:
|
2006-05-10 14:12:07 +02:00
|
|
|
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(error_status_t));
|
2005-11-28 11:24:21 +01:00
|
|
|
pStubMsg->BufferLength += sizeof(error_status_t);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrBaseTypeMemorySize [internal]
|
|
|
|
*/
|
2006-11-09 23:02:49 +01:00
|
|
|
static ULONG WINAPI NdrBaseTypeMemorySize(
|
2005-11-28 11:24:21 +01:00
|
|
|
PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
switch(*pFormat)
|
|
|
|
{
|
|
|
|
case RPC_FC_BYTE:
|
|
|
|
case RPC_FC_CHAR:
|
|
|
|
case RPC_FC_SMALL:
|
|
|
|
case RPC_FC_USMALL:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(UCHAR);
|
|
|
|
pStubMsg->MemorySize += sizeof(UCHAR);
|
2005-11-28 11:24:21 +01:00
|
|
|
return sizeof(UCHAR);
|
|
|
|
case RPC_FC_WCHAR:
|
|
|
|
case RPC_FC_SHORT:
|
|
|
|
case RPC_FC_USHORT:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(USHORT);
|
|
|
|
pStubMsg->MemorySize += sizeof(USHORT);
|
2005-11-28 11:24:21 +01:00
|
|
|
return sizeof(USHORT);
|
|
|
|
case RPC_FC_LONG:
|
|
|
|
case RPC_FC_ULONG:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(ULONG);
|
|
|
|
pStubMsg->MemorySize += sizeof(ULONG);
|
2005-11-28 11:24:21 +01:00
|
|
|
return sizeof(ULONG);
|
|
|
|
case RPC_FC_FLOAT:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(float);
|
|
|
|
pStubMsg->MemorySize += sizeof(float);
|
2005-11-28 11:24:21 +01:00
|
|
|
return sizeof(float);
|
|
|
|
case RPC_FC_DOUBLE:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(double);
|
|
|
|
pStubMsg->MemorySize += sizeof(double);
|
2005-11-28 11:24:21 +01:00
|
|
|
return sizeof(double);
|
|
|
|
case RPC_FC_HYPER:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(ULONGLONG);
|
|
|
|
pStubMsg->MemorySize += sizeof(ULONGLONG);
|
2005-11-28 11:24:21 +01:00
|
|
|
return sizeof(ULONGLONG);
|
|
|
|
case RPC_FC_ERROR_STATUS_T:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(error_status_t);
|
|
|
|
pStubMsg->MemorySize += sizeof(error_status_t);
|
2005-11-28 11:24:21 +01:00
|
|
|
return sizeof(error_status_t);
|
|
|
|
case RPC_FC_ENUM16:
|
|
|
|
case RPC_FC_ENUM32:
|
2006-05-13 17:59:06 +02:00
|
|
|
pStubMsg->Buffer += sizeof(INT);
|
|
|
|
pStubMsg->MemorySize += sizeof(INT);
|
2006-03-01 13:21:56 +01:00
|
|
|
return sizeof(INT);
|
2005-11-28 11:24:21 +01:00
|
|
|
default:
|
|
|
|
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* NdrBaseTypeFree [internal]
|
|
|
|
*/
|
|
|
|
static void WINAPI NdrBaseTypeFree(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char *pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
TRACE("pStubMsg %p pMemory %p type 0x%02x\n", pStubMsg, pMemory, *pFormat);
|
|
|
|
|
|
|
|
/* nothing to do */
|
|
|
|
}
|
|
|
|
|
2005-07-18 15:14:05 +02:00
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* NdrClientContextMarshall [RPCRT4.@]
|
2005-07-18 15:14:05 +02:00
|
|
|
*/
|
2005-08-03 16:55:57 +02:00
|
|
|
void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
NDR_CCONTEXT ContextHandle,
|
|
|
|
int fCheck)
|
2005-07-18 15:14:05 +02:00
|
|
|
{
|
2006-06-02 21:44:18 +02:00
|
|
|
TRACE("(%p, %p, %d)\n", pStubMsg, ContextHandle, fCheck);
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
|
2006-05-26 10:56:49 +02:00
|
|
|
/* FIXME: what does fCheck do? */
|
2006-06-02 21:43:22 +02:00
|
|
|
NDRCContextMarshall(ContextHandle,
|
|
|
|
pStubMsg->Buffer);
|
|
|
|
|
|
|
|
pStubMsg->Buffer += cbNDRContext;
|
2005-07-18 15:14:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2006-11-12 20:23:02 +01:00
|
|
|
* NdrClientContextUnmarshall [RPCRT4.@]
|
2005-07-18 15:14:05 +02:00
|
|
|
*/
|
2005-08-03 16:55:57 +02:00
|
|
|
void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
NDR_CCONTEXT * pContextHandle,
|
|
|
|
RPC_BINDING_HANDLE BindHandle)
|
2005-07-18 15:14:05 +02:00
|
|
|
{
|
2006-06-02 21:44:18 +02:00
|
|
|
TRACE("(%p, %p, %p)\n", pStubMsg, pContextHandle, BindHandle);
|
|
|
|
|
|
|
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
|
|
|
|
2006-06-02 21:43:22 +02:00
|
|
|
NDRCContextUnmarshall(pContextHandle,
|
|
|
|
BindHandle,
|
|
|
|
pStubMsg->Buffer,
|
|
|
|
pStubMsg->RpcMsg->DataRepresentation);
|
|
|
|
|
|
|
|
pStubMsg->Buffer += cbNDRContext;
|
2005-08-03 16:55:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
NDR_SCONTEXT ContextHandle,
|
2005-09-08 13:02:38 +02:00
|
|
|
NDR_RUNDOWN RundownRoutine )
|
2005-08-03 16:55:57 +02:00
|
|
|
{
|
2005-09-08 13:02:38 +02:00
|
|
|
FIXME("(%p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine);
|
2005-08-03 16:55:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", pStubMsg);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
unsigned char* pMemory,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p): stub\n", pStubMsg, pMemory, pFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
NDR_SCONTEXT ContextHandle,
|
|
|
|
NDR_RUNDOWN RundownRoutine,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine, pFormat);
|
|
|
|
}
|
|
|
|
|
|
|
|
NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
|
|
|
|
PFORMAT_STRING pFormat)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-06-01 06:09:49 +02:00
|
|
|
#define NDR_CONTEXT_HANDLE_MAGIC 0x4352444e
|
|
|
|
|
|
|
|
typedef struct ndr_context_handle
|
|
|
|
{
|
|
|
|
DWORD attributes;
|
|
|
|
GUID uuid;
|
|
|
|
} ndr_context_handle;
|
|
|
|
|
|
|
|
struct context_handle_entry
|
|
|
|
{
|
|
|
|
struct list entry;
|
|
|
|
DWORD magic;
|
|
|
|
RPC_BINDING_HANDLE handle;
|
|
|
|
ndr_context_handle wire_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct list context_handle_list = LIST_INIT(context_handle_list);
|
|
|
|
|
|
|
|
static CRITICAL_SECTION ndr_context_cs;
|
|
|
|
static CRITICAL_SECTION_DEBUG ndr_context_debug =
|
2005-08-03 16:55:57 +02:00
|
|
|
{
|
2006-06-01 06:09:49 +02:00
|
|
|
0, 0, &ndr_context_cs,
|
|
|
|
{ &ndr_context_debug.ProcessLocksList, &ndr_context_debug.ProcessLocksList },
|
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": ndr_context") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION ndr_context_cs = { &ndr_context_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
static struct context_handle_entry *get_context_entry(NDR_CCONTEXT CContext)
|
|
|
|
{
|
|
|
|
struct context_handle_entry *che = (struct context_handle_entry*) CContext;
|
|
|
|
|
|
|
|
if (che->magic != NDR_CONTEXT_HANDLE_MAGIC)
|
|
|
|
return NULL;
|
|
|
|
return che;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct context_handle_entry *context_entry_from_guid(LPGUID uuid)
|
|
|
|
{
|
|
|
|
struct context_handle_entry *che;
|
|
|
|
LIST_FOR_EACH_ENTRY(che, &context_handle_list, struct context_handle_entry, entry)
|
|
|
|
if (IsEqualGUID(&che->wire_data.uuid, uuid))
|
|
|
|
return che;
|
2005-07-18 15:14:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2006-05-24 12:28:46 +02:00
|
|
|
|
2006-06-01 06:09:49 +02:00
|
|
|
RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)
|
|
|
|
{
|
|
|
|
struct context_handle_entry *che;
|
|
|
|
RPC_BINDING_HANDLE handle = NULL;
|
|
|
|
|
|
|
|
TRACE("%p\n", CContext);
|
|
|
|
|
|
|
|
EnterCriticalSection(&ndr_context_cs);
|
|
|
|
che = get_context_entry(CContext);
|
|
|
|
if (che)
|
|
|
|
handle = che->handle;
|
|
|
|
LeaveCriticalSection(&ndr_context_cs);
|
|
|
|
|
|
|
|
if (!handle)
|
|
|
|
RpcRaiseException(ERROR_INVALID_HANDLE);
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
2006-05-24 12:28:46 +02:00
|
|
|
void WINAPI NDRCContextMarshall(NDR_CCONTEXT CContext, void *pBuff)
|
|
|
|
{
|
2006-06-01 06:09:49 +02:00
|
|
|
struct context_handle_entry *che;
|
|
|
|
|
|
|
|
TRACE("%p %p\n", CContext, pBuff);
|
|
|
|
|
2006-06-02 21:42:54 +02:00
|
|
|
if (CContext)
|
|
|
|
{
|
|
|
|
EnterCriticalSection(&ndr_context_cs);
|
|
|
|
che = get_context_entry(CContext);
|
|
|
|
memcpy(pBuff, &che->wire_data, sizeof (ndr_context_handle));
|
|
|
|
LeaveCriticalSection(&ndr_context_cs);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ndr_context_handle *wire_data = (ndr_context_handle *)pBuff;
|
|
|
|
wire_data->attributes = 0;
|
|
|
|
wire_data->uuid = GUID_NULL;
|
|
|
|
}
|
2006-06-01 06:09:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ndr_update_context_handle(NDR_CCONTEXT *CContext,
|
|
|
|
RPC_BINDING_HANDLE hBinding,
|
|
|
|
ndr_context_handle *chi)
|
|
|
|
{
|
|
|
|
struct context_handle_entry *che = NULL;
|
|
|
|
|
|
|
|
/* a null UUID means we should free the context handle */
|
2006-06-02 21:42:54 +02:00
|
|
|
if (IsEqualGUID(&chi->uuid, &GUID_NULL))
|
2006-06-01 06:09:49 +02:00
|
|
|
{
|
2006-06-02 21:43:44 +02:00
|
|
|
if (*CContext)
|
|
|
|
{
|
|
|
|
che = get_context_entry(*CContext);
|
|
|
|
if (!che)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
list_remove(&che->entry);
|
2006-06-02 21:45:59 +02:00
|
|
|
RpcBindingFree(&che->handle);
|
2006-06-02 21:43:44 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, che);
|
|
|
|
che = NULL;
|
|
|
|
}
|
2006-06-01 06:09:49 +02:00
|
|
|
}
|
|
|
|
/* if there's no existing entry matching the GUID, allocate one */
|
|
|
|
else if (!(che = context_entry_from_guid(&chi->uuid)))
|
|
|
|
{
|
|
|
|
che = HeapAlloc(GetProcessHeap(), 0, sizeof *che);
|
|
|
|
if (!che)
|
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
che->magic = NDR_CONTEXT_HANDLE_MAGIC;
|
2006-06-02 21:45:59 +02:00
|
|
|
RpcBindingCopy(hBinding, &che->handle);
|
2006-06-01 06:09:49 +02:00
|
|
|
list_add_tail(&context_handle_list, &che->entry);
|
|
|
|
memcpy(&che->wire_data, chi, sizeof *chi);
|
|
|
|
}
|
|
|
|
|
|
|
|
*CContext = che;
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
2006-05-24 12:28:46 +02:00
|
|
|
}
|
|
|
|
|
2006-11-12 20:23:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NDRCContextUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
2006-05-24 12:28:46 +02:00
|
|
|
void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *CContext,
|
|
|
|
RPC_BINDING_HANDLE hBinding,
|
2006-11-09 23:01:58 +01:00
|
|
|
void *pBuff, ULONG DataRepresentation)
|
2006-05-24 12:28:46 +02:00
|
|
|
{
|
2006-06-01 06:09:49 +02:00
|
|
|
UINT r;
|
|
|
|
|
2006-11-09 23:04:48 +01:00
|
|
|
TRACE("*%p=(%p) %p %p %08x\n",
|
2006-06-01 06:09:49 +02:00
|
|
|
CContext, *CContext, hBinding, pBuff, DataRepresentation);
|
|
|
|
|
|
|
|
EnterCriticalSection(&ndr_context_cs);
|
|
|
|
r = ndr_update_context_handle(CContext, hBinding, pBuff);
|
|
|
|
LeaveCriticalSection(&ndr_context_cs);
|
|
|
|
if (r)
|
|
|
|
RpcRaiseException(r);
|
2006-05-24 12:28:46 +02:00
|
|
|
}
|
2006-05-25 06:46:45 +02:00
|
|
|
|
2006-11-12 20:23:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NDRSContextMarshall [RPCRT4.@]
|
|
|
|
*/
|
2006-05-25 06:46:45 +02:00
|
|
|
void WINAPI NDRSContextMarshall(NDR_SCONTEXT CContext,
|
|
|
|
void *pBuff,
|
|
|
|
NDR_RUNDOWN userRunDownIn)
|
|
|
|
{
|
|
|
|
FIXME("(%p %p %p): stub\n", CContext, pBuff, userRunDownIn);
|
|
|
|
}
|
|
|
|
|
2006-11-12 20:23:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NDRSContextMarshallEx [RPCRT4.@]
|
|
|
|
*/
|
2006-05-25 06:46:45 +02:00
|
|
|
void WINAPI NDRSContextMarshallEx(RPC_BINDING_HANDLE hBinding,
|
|
|
|
NDR_SCONTEXT CContext,
|
|
|
|
void *pBuff,
|
|
|
|
NDR_RUNDOWN userRunDownIn)
|
|
|
|
{
|
|
|
|
FIXME("(%p %p %p %p): stub\n", hBinding, CContext, pBuff, userRunDownIn);
|
|
|
|
}
|
|
|
|
|
2006-11-12 20:23:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NDRSContextMarshall2 [RPCRT4.@]
|
|
|
|
*/
|
2006-05-25 06:46:45 +02:00
|
|
|
void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
|
|
|
|
NDR_SCONTEXT CContext,
|
|
|
|
void *pBuff,
|
|
|
|
NDR_RUNDOWN userRunDownIn,
|
2006-11-09 23:01:58 +01:00
|
|
|
void *CtxGuard, ULONG Flags)
|
2006-05-25 06:46:45 +02:00
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
FIXME("(%p %p %p %p %p %u): stub\n",
|
2006-05-25 06:46:45 +02:00
|
|
|
hBinding, CContext, pBuff, userRunDownIn, CtxGuard, Flags);
|
|
|
|
}
|
|
|
|
|
2006-11-12 20:23:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NDRSContextUnmarshall [RPCRT4.@]
|
|
|
|
*/
|
2006-05-25 06:46:45 +02:00
|
|
|
NDR_SCONTEXT WINAPI NDRSContextUnmarshall(void *pBuff,
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG DataRepresentation)
|
2006-05-25 06:46:45 +02:00
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
FIXME("(%p %08x): stub\n", pBuff, DataRepresentation);
|
2006-05-25 06:46:45 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-11-12 20:23:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NDRSContextUnmarshallEx [RPCRT4.@]
|
|
|
|
*/
|
2006-05-25 06:46:45 +02:00
|
|
|
NDR_SCONTEXT WINAPI NDRSContextUnmarshallEx(RPC_BINDING_HANDLE hBinding,
|
|
|
|
void *pBuff,
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG DataRepresentation)
|
2006-05-25 06:46:45 +02:00
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
FIXME("(%p %p %08x): stub\n", hBinding, pBuff, DataRepresentation);
|
2006-05-25 06:46:45 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-11-12 20:23:02 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* NDRSContextUnmarshall2 [RPCRT4.@]
|
|
|
|
*/
|
2006-05-25 06:46:45 +02:00
|
|
|
NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
|
|
|
|
void *pBuff,
|
2006-11-09 23:01:58 +01:00
|
|
|
ULONG DataRepresentation,
|
|
|
|
void *CtxGuard, ULONG Flags)
|
2006-05-25 06:46:45 +02:00
|
|
|
{
|
2006-11-09 23:04:48 +01:00
|
|
|
FIXME("(%p %p %08x %p %u): stub\n",
|
2006-05-25 06:46:45 +02:00
|
|
|
hBinding, pBuff, DataRepresentation, CtxGuard, Flags);
|
|
|
|
return NULL;
|
|
|
|
}
|