ReactOS  0.4.14-dev-98-gb0d4763
ndr_marshall.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "ndr_misc.h"
#include "rpcndr.h"
#include "ndrtypes.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for ndr_marshall.c:

Go to the source code of this file.

Classes

struct  _NDR_MEMORY_LIST
 
struct  NDR_RANGE
 
struct  _NDR_CSTRUCT_FORMAT
 
struct  NDR_SMFARRAY_FORMAT
 
struct  NDR_LGFARRAY_FORMAT
 

Macros

#define NONAMELESSUNION
 
#define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32)
 
#define LITTLE_ENDIAN_UINT32_READ(pchar)
 
#define BIG_ENDIAN_UINT32_WRITE(pchar, uint32)
 
#define BIG_ENDIAN_UINT32_READ(pchar)
 
#define NDR_LOCAL_UINT32_WRITE(pchar, uint32)   LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32)
 
#define NDR_LOCAL_UINT32_READ(pchar)   LITTLE_ENDIAN_UINT32_READ(pchar)
 
#define STD_OVERFLOW_CHECK(_Msg)
 
#define NDR_POINTER_ID_BASE   0x20000
 
#define NDR_POINTER_ID(pStubMsg)   (NDR_POINTER_ID_BASE + ((pStubMsg)->UniquePtrCount++) * 4)
 
#define NDR_TABLE_SIZE   128
 
#define NDR_TABLE_MASK   127
 
#define NDRSContextFromValue(user_context)   (NDR_SCONTEXT)((char *)(user_context) - (char *)NDRSContextValue((NDR_SCONTEXT)NULL))
 
#define MEML_MAGIC   ('M' << 24 | 'E' << 16 | 'M' << 8 | 'L')
 
#define BASE_TYPE_UNMARSHALL(type)
 
#define USER_MARSHAL_PTR_PREFIX
 
#define RANGE_UNMARSHALL(mem_type, wire_type, format_spec)
 
#define BASE_TYPE_UNMARSHALL(type)
 

Typedefs

typedef struct _NDR_MEMORY_LIST NDR_MEMORY_LIST
 
typedef struct _NDR_CSTRUCT_FORMAT NDR_CSTRUCT_FORMAT
 
typedef struct _NDR_CSTRUCT_FORMAT NDR_CVSTRUCT_FORMAT
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static void align_length (ULONG *len, unsigned int align)
 
static void align_pointer (unsigned char **ptr, unsigned int align)
 
static void align_pointer_clear (unsigned char **ptr, unsigned int align)
 
static void align_pointer_offset (unsigned char **ptr, unsigned char *base, unsigned int align)
 
static void align_pointer_offset_clear (unsigned char **ptr, unsigned char *base, unsigned int align)
 
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)
 
static ULONG WINAPI NdrBaseTypeMemorySize (PMIDL_STUB_MESSAGE, PFORMAT_STRING)
 
static unsigned char *WINAPI NdrContextHandleMarshall (PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
 
static void WINAPI NdrContextHandleBufferSize (PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
 
static unsigned char *WINAPI NdrContextHandleUnmarshall (PMIDL_STUB_MESSAGE, unsigned char **, PFORMAT_STRING, unsigned char)
 
static unsigned char *WINAPI NdrRangeMarshall (PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
 
static void WINAPI NdrRangeBufferSize (PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
 
static ULONG WINAPI NdrRangeMemorySize (PMIDL_STUB_MESSAGE, PFORMAT_STRING)
 
static void WINAPI NdrRangeFree (PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
 
static ULONG WINAPI NdrByteCountPointerMemorySize (PMIDL_STUB_MESSAGE, PFORMAT_STRING)
 
static unsigned charComplexBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
 
static unsigned charComplexMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
 
static unsigned charComplexUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer, unsigned char fMustAlloc)
 
static ULONG ComplexStructMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
 
static unsigned charComplexFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
 
void *WINAPI NdrAllocate (MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
 
static voidNdrAllocateZero (MIDL_STUB_MESSAGE *stubmsg, SIZE_T len)
 
static void NdrFree (MIDL_STUB_MESSAGE *pStubMsg, unsigned char *Pointer)
 
static BOOL IsConformanceOrVariancePresent (PFORMAT_STRING pFormat)
 
static PFORMAT_STRING SkipConformance (const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
 
static PFORMAT_STRING ReadConformance (MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
 
static PFORMAT_STRING ReadVariance (MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, ULONG MaxValue)
 
static void WriteConformance (MIDL_STUB_MESSAGE *pStubMsg)
 
static void WriteVariance (MIDL_STUB_MESSAGE *pStubMsg)
 
static void SizeConformance (MIDL_STUB_MESSAGE *pStubMsg)
 
static void SizeVariance (MIDL_STUB_MESSAGE *pStubMsg)
 
PFORMAT_STRING ComputeConformanceOrVariance (MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount)
 
static PFORMAT_STRING SkipVariance (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
static ULONG safe_multiply (ULONG a, ULONG b)
 
static void safe_buffer_increment (MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
 
static void safe_buffer_length_increment (MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
 
static void safe_copy_from_buffer (MIDL_STUB_MESSAGE *pStubMsg, void *p, ULONG size)
 
static void safe_copy_to_buffer (MIDL_STUB_MESSAGE *pStubMsg, const void *p, ULONG size)
 
static void validate_string_data (MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULONG esize)
 
static void dump_pointer_attr (unsigned char attr)
 
static void PointerMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, unsigned char *Pointer, PFORMAT_STRING pFormat)
 
static void PointerUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, unsigned char **pPointer, unsigned char *pSrcPointer, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
static void PointerBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Pointer, PFORMAT_STRING pFormat)
 
static ULONG PointerMemorySize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, PFORMAT_STRING pFormat)
 
static void PointerFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Pointer, PFORMAT_STRING pFormat)
 
static unsigned charEmbeddedPointerMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static unsigned charEmbeddedPointerUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pDstBuffer, unsigned char *pSrcMemoryPtrs, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
static void EmbeddedPointerBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static ULONG EmbeddedPointerMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
static void EmbeddedPointerFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrPointerMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrPointerUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrPointerBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrPointerMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrPointerFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
void WINAPI NdrSimpleTypeMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, unsigned char FormatChar)
 
void WINAPI NdrSimpleTypeUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, unsigned char FormatChar)
 
unsigned char *WINAPI NdrSimpleStructMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrSimpleStructUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrSimpleStructBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrSimpleStructMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrSimpleStructFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static void array_compute_and_size_conformance (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static void array_buffer_size (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char fHasPointers)
 
static void array_compute_and_write_conformance (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static void array_write_variance_and_marshall (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char fHasPointers)
 
static ULONG array_read_conformance (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
static ULONG array_read_variance_and_unmarshall (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc, unsigned char fUseBufferMemoryServer, unsigned char fUnmarshall)
 
static void array_memory_size (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned char fHasPointers)
 
static void array_free (unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char fHasPointers)
 
unsigned char *WINAPI NdrConformantStringMarshall (MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pszMessage, PFORMAT_STRING pFormat)
 
void WINAPI NdrConformantStringBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrConformantStringMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantStringUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
unsigned char *WINAPI NdrNonConformantStringMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrNonConformantStringUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrNonConformantStringBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrNonConformantStringMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
static ULONG EmbeddedComplexSize (MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
 
static ULONG EmbeddedComplexMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
ULONG ComplexStructSize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrComplexStructMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrComplexStructUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrComplexStructBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrComplexStructMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrComplexStructFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantArrayMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantArrayUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrConformantArrayBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrConformantArrayMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrConformantArrayFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantVaryingArrayMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantVaryingArrayUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrConformantVaryingArrayFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
void WINAPI NdrConformantVaryingArrayBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrConformantVaryingArrayMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrComplexArrayMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrComplexArrayUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrComplexArrayBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrComplexArrayMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrComplexArrayFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static void UserMarshalCB (PMIDL_STUB_MESSAGE pStubMsg, USER_MARSHAL_CB_TYPE cbtype, PFORMAT_STRING pFormat, USER_MARSHAL_CB *umcb)
 
unsigned char *WINAPI NdrUserMarshalMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrUserMarshalUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrUserMarshalBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrUserMarshalMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrUserMarshalFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
RPC_STATUS RPC_ENTRY NdrGetUserMarshalInfo (ULONG *flags, ULONG level, NDR_USER_MARSHAL_INFO *umi)
 
void WINAPI NdrClearOutParameters (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr)
 
void WINAPI NdrConvert (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrConvert2 (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, LONG NumberParams)
 
unsigned char *WINAPI NdrConformantStructMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantStructUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrConformantStructBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrConformantStructMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrConformantStructFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantVaryingStructMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrConformantVaryingStructUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrConformantVaryingStructBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrConformantVaryingStructMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrConformantVaryingStructFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrFixedArrayMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrFixedArrayUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrFixedArrayBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrFixedArrayMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrFixedArrayFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrVaryingArrayMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrVaryingArrayUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrVaryingArrayBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrVaryingArrayMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrVaryingArrayFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static ULONG get_discriminant (unsigned char fc, const unsigned char *pMemory)
 
static PFORMAT_STRING get_arm_offset_from_union_arm_selector (PMIDL_STUB_MESSAGE pStubMsg, ULONG discriminant, PFORMAT_STRING pFormat)
 
static unsigned charunion_arm_marshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, ULONG discriminant, PFORMAT_STRING pFormat)
 
static unsigned charunion_arm_unmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, ULONG discriminant, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
static void union_arm_buffer_size (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, ULONG discriminant, PFORMAT_STRING pFormat)
 
static ULONG union_arm_memory_size (PMIDL_STUB_MESSAGE pStubMsg, ULONG discriminant, PFORMAT_STRING pFormat)
 
static void union_arm_free (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, ULONG discriminant, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrEncapsulatedUnionMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrEncapsulatedUnionUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrEncapsulatedUnionBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrEncapsulatedUnionMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrEncapsulatedUnionFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrNonEncapsulatedUnionMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
static LONG unmarshall_discriminant (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING *ppFormat)
 
unsigned char *WINAPI NdrNonEncapsulatedUnionUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrNonEncapsulatedUnionBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrNonEncapsulatedUnionMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrNonEncapsulatedUnionFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrByteCountPointerMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrByteCountPointerUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrByteCountPointerBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
void WINAPI NdrByteCountPointerFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrXmitOrRepAsMarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrXmitOrRepAsUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrXmitOrRepAsBufferSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
ULONG WINAPI NdrXmitOrRepAsMemorySize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrXmitOrRepAsFree (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
unsigned char *WINAPI NdrRangeUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
 
void WINAPI NdrClientContextMarshall (PMIDL_STUB_MESSAGE pStubMsg, NDR_CCONTEXT ContextHandle, int fCheck)
 
void WINAPI NdrClientContextUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, NDR_CCONTEXT *pContextHandle, RPC_BINDING_HANDLE BindHandle)
 
void WINAPI NdrServerContextMarshall (PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT ContextHandle, NDR_RUNDOWN RundownRoutine)
 
NDR_SCONTEXT WINAPI NdrServerContextUnmarshall (PMIDL_STUB_MESSAGE pStubMsg)
 
void WINAPI NdrContextHandleSize (PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
 
NDR_SCONTEXT WINAPI NdrContextHandleInitialize (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrServerContextNewMarshall (PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT ContextHandle, NDR_RUNDOWN RundownRoutine, PFORMAT_STRING pFormat)
 
NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall (PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
 
void WINAPI NdrCorrelationInitialize (PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
 
void WINAPI NdrCorrelationPass (PMIDL_STUB_MESSAGE pStubMsg)
 
void WINAPI NdrCorrelationFree (PMIDL_STUB_MESSAGE pStubMsg)
 

Variables

const NDR_MARSHALL NdrMarshaller [NDR_TABLE_SIZE]
 
const NDR_UNMARSHALL NdrUnmarshaller [NDR_TABLE_SIZE]
 
const NDR_BUFFERSIZE NdrBufferSizer [NDR_TABLE_SIZE]
 
const NDR_MEMORYSIZE NdrMemorySizer [NDR_TABLE_SIZE]
 
const NDR_FREE NdrFreer [NDR_TABLE_SIZE]
 

Macro Definition Documentation

◆ BASE_TYPE_UNMARSHALL [1/2]

#define BASE_TYPE_UNMARSHALL (   type)
Value:
align_pointer(&pStubMsg->Buffer, sizeof(type)); \
TRACE("pMemory: %p\n", pMemory); \
*(type *)pMemory = *(type *)pStubMsg->Buffer; \
pStubMsg->Buffer += sizeof(type);
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void align_pointer(unsigned char **ptr, unsigned int align)
Definition: ndr_marshall.c:98

◆ BASE_TYPE_UNMARSHALL [2/2]

#define BASE_TYPE_UNMARSHALL (   type)
Value:
do { \
align_pointer(&pStubMsg->Buffer, sizeof(type)); \
if (!fMustAlloc && !pStubMsg->IsClient && !*ppMemory) \
{ \
*ppMemory = pStubMsg->Buffer; \
TRACE("*ppMemory: %p\n", *ppMemory); \
safe_buffer_increment(pStubMsg, sizeof(type)); \
} \
else \
{ \
if (fMustAlloc) \
*ppMemory = NdrAllocate(pStubMsg, sizeof(type)); \
TRACE("*ppMemory: %p\n", *ppMemory); \
safe_copy_from_buffer(pStubMsg, *ppMemory, sizeof(type)); \
} \
} while (0)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void *WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
Definition: ndr_marshall.c:422

◆ BIG_ENDIAN_UINT32_READ

#define BIG_ENDIAN_UINT32_READ (   pchar)
Value:
MAKEWORD(*((pchar)+3), *((pchar)+2)), \
MAKEWORD(*((pchar)+1), *(pchar))))
#define MAKEWORD(a, b)
Definition: typedefs.h:247
#define MAKELONG(a, b)
Definition: typedefs.h:248

Definition at line 76 of file ndr_marshall.c.

◆ BIG_ENDIAN_UINT32_WRITE

#define BIG_ENDIAN_UINT32_WRITE (   pchar,
  uint32 
)
Value:
(*((pchar)+3) = LOBYTE(LOWORD(uint32)), \
*((pchar)+2) = HIBYTE(LOWORD(uint32)), \
*((pchar)+1) = LOBYTE(HIWORD(uint32)), \
*(pchar) = HIBYTE(HIWORD(uint32)))
#define LOBYTE(W)
Definition: jmemdos.c:487
unsigned int uint32
Definition: types.h:32
#define HIBYTE(W)
Definition: jmemdos.c:486
#define HIWORD(l)
Definition: typedefs.h:246
#define LOWORD(l)
Definition: pedump.c:82

Definition at line 70 of file ndr_marshall.c.

◆ LITTLE_ENDIAN_UINT32_READ

#define LITTLE_ENDIAN_UINT32_READ (   pchar)
Value:
MAKEWORD(*(pchar), *((pchar)+1)), \
MAKEWORD(*((pchar)+2), *((pchar)+3))))
#define MAKEWORD(a, b)
Definition: typedefs.h:247
#define MAKELONG(a, b)
Definition: typedefs.h:248

Definition at line 64 of file ndr_marshall.c.

◆ LITTLE_ENDIAN_UINT32_WRITE

#define LITTLE_ENDIAN_UINT32_WRITE (   pchar,
  uint32 
)
Value:
(*(pchar) = LOBYTE(LOWORD(uint32)), \
*((pchar)+1) = HIBYTE(LOWORD(uint32)), \
*((pchar)+2) = LOBYTE(HIWORD(uint32)), \
*((pchar)+3) = HIBYTE(HIWORD(uint32)))
#define LOBYTE(W)
Definition: jmemdos.c:487
unsigned int uint32
Definition: types.h:32
#define HIBYTE(W)
Definition: jmemdos.c:486
#define HIWORD(l)
Definition: typedefs.h:246
#define LOWORD(l)
Definition: pedump.c:82

Definition at line 58 of file ndr_marshall.c.

◆ MEML_MAGIC

#define MEML_MAGIC   ('M' << 24 | 'E' << 16 | 'M' << 8 | 'L')

Definition at line 403 of file ndr_marshall.c.

◆ NDR_LOCAL_UINT32_READ

#define NDR_LOCAL_UINT32_READ (   pchar)    LITTLE_ENDIAN_UINT32_READ(pchar)

Definition at line 89 of file ndr_marshall.c.

◆ NDR_LOCAL_UINT32_WRITE

#define NDR_LOCAL_UINT32_WRITE (   pchar,
  uint32 
)    LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32)

Definition at line 87 of file ndr_marshall.c.

◆ NDR_POINTER_ID

#define NDR_POINTER_ID (   pStubMsg)    (NDR_POINTER_ID_BASE + ((pStubMsg)->UniquePtrCount++) * 4)

Definition at line 131 of file ndr_marshall.c.

◆ NDR_POINTER_ID_BASE

#define NDR_POINTER_ID_BASE   0x20000

Definition at line 130 of file ndr_marshall.c.

◆ NDR_TABLE_MASK

#define NDR_TABLE_MASK   127

Definition at line 133 of file ndr_marshall.c.

◆ NDR_TABLE_SIZE

#define NDR_TABLE_SIZE   128

Definition at line 132 of file ndr_marshall.c.

◆ NDRSContextFromValue

#define NDRSContextFromValue (   user_context)    (NDR_SCONTEXT)((char *)(user_context) - (char *)NDRSContextValue((NDR_SCONTEXT)NULL))

Definition at line 135 of file ndr_marshall.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 36 of file ndr_marshall.c.

◆ RANGE_UNMARSHALL

#define RANGE_UNMARSHALL (   mem_type,
  wire_type,
  format_spec 
)
Value:
do \
{ \
align_pointer(&pStubMsg->Buffer, sizeof(wire_type)); \
if (!fMustAlloc && !*ppMemory) \
fMustAlloc = TRUE; \
if (fMustAlloc) \
*ppMemory = NdrAllocate(pStubMsg, sizeof(mem_type)); \
if (pStubMsg->Buffer + sizeof(wire_type) > pStubMsg->BufferEnd) \
{ \
ERR("buffer overflow - Buffer = %p, BufferEnd = %p\n", \
pStubMsg->Buffer, (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength); \
RpcRaiseException(RPC_X_BAD_STUB_DATA); \
} \
if ((*(wire_type *)pStubMsg->Buffer < (mem_type)pRange->low_value) || \
(*(wire_type *)pStubMsg->Buffer > (mem_type)pRange->high_value)) \
{ \
ERR("value exceeded bounds: " format_spec ", low: " format_spec ", high: " format_spec "\n", \
*(wire_type *)pStubMsg->Buffer, (mem_type)pRange->low_value, \
(mem_type)pRange->high_value); \
RpcRaiseException(RPC_S_INVALID_BOUND); \
return NULL; \
} \
TRACE("*ppMemory: %p\n", *ppMemory); \
**(mem_type **)ppMemory = *(wire_type *)pStubMsg->Buffer; \
pStubMsg->Buffer += sizeof(wire_type); \
} while (0)
#define TRUE
Definition: types.h:120
#define RPC_S_INVALID_BOUND
Definition: winerror.h:1043
void *WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
Definition: ndr_marshall.c:422
smooth NULL
Definition: ftsmooth.c:416
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

◆ STD_OVERFLOW_CHECK

#define STD_OVERFLOW_CHECK (   _Msg)
Value:
do { \
TRACE("buffer=%d/%d\n", (ULONG)(_Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer), _Msg->BufferLength); \
if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \
ERR("buffer overflow %d bytes\n", (ULONG)(_Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength))); \
} while (0)
unsigned int ULONG
Definition: retypes.h:1

Definition at line 124 of file ndr_marshall.c.

◆ USER_MARSHAL_PTR_PREFIX

#define USER_MARSHAL_PTR_PREFIX
Value:
( (DWORD)'U' | ( (DWORD)'s' << 8 ) | \
( (DWORD)'e' << 16 ) | ( (DWORD)'r' << 24 ) )
#define DWORD
Definition: nt_native.h:44
unsigned long DWORD
Definition: ntddk_ex.h:95

Definition at line 4392 of file ndr_marshall.c.

Typedef Documentation

◆ NDR_CSTRUCT_FORMAT

◆ NDR_CVSTRUCT_FORMAT

◆ NDR_MEMORY_LIST

Function Documentation

◆ align_length()

◆ align_pointer()

◆ align_pointer_clear()

static void align_pointer_clear ( unsigned char **  ptr,
unsigned int  align 
)
inlinestatic

◆ align_pointer_offset()

static void align_pointer_offset ( unsigned char **  ptr,
unsigned char base,
unsigned int  align 
)
inlinestatic

Definition at line 111 of file ndr_marshall.c.

112 {
113  ULONG_PTR mask = align - 1;
114  *ptr = base + (((ULONG_PTR)(*ptr - base) + mask) & ~mask);
115 }
int align(int length, int align)
Definition: dsound8.c:36
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLenum GLint GLuint mask
Definition: glext.h:6028
static PVOID ptr
Definition: dispmode.c:27
#define ULONG_PTR
Definition: config.h:101

Referenced by ComplexBufferSize(), ComplexFree(), and ComplexMarshall().

◆ align_pointer_offset_clear()

static void align_pointer_offset_clear ( unsigned char **  ptr,
unsigned char base,
unsigned int  align 
)
inlinestatic

Definition at line 117 of file ndr_marshall.c.

118 {
119  ULONG_PTR mask = align - 1;
120  memset( *ptr, 0, (align - (ULONG_PTR)(*ptr - base)) & mask );
121  *ptr = base + (((ULONG_PTR)(*ptr - base) + mask) & ~mask);
122 }
int align(int length, int align)
Definition: dsound8.c:36
uint32_t ULONG_PTR
Definition: typedefs.h:63
GLenum GLint GLuint mask
Definition: glext.h:6028
static PVOID ptr
Definition: dispmode.c:27
#define ULONG_PTR
Definition: config.h:101
#define memset(x, y, z)
Definition: compat.h:39

Referenced by ComplexUnmarshall().

◆ array_buffer_size()

static void array_buffer_size ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
unsigned char  fHasPointers 
)
inlinestatic

Definition at line 1899 of file ndr_marshall.c.

1902 {
1903  DWORD i, size;
1904  DWORD esize;
1905  unsigned char alignment;
1906 
1907  switch (fc)
1908  {
1909  case FC_CARRAY:
1910  esize = *(const WORD*)(pFormat+2);
1911  alignment = pFormat[1] + 1;
1912 
1913  pFormat = SkipConformance(pStubMsg, pFormat + 4);
1914 
1915  align_length(&pStubMsg->BufferLength, alignment);
1916 
1917  size = safe_multiply(esize, pStubMsg->MaxCount);
1918  /* conformance value plus array */
1920 
1921  if (fHasPointers)
1922  EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
1923  break;
1924  case FC_CVARRAY:
1925  esize = *(const WORD*)(pFormat+2);
1926  alignment = pFormat[1] + 1;
1927 
1928  pFormat = SkipConformance(pStubMsg, pFormat + 4);
1929  pFormat = SkipVariance(pStubMsg, pFormat);
1930 
1931  SizeVariance(pStubMsg);
1932 
1933  align_length(&pStubMsg->BufferLength, alignment);
1934 
1935  size = safe_multiply(esize, pStubMsg->ActualCount);
1937 
1938  if (fHasPointers)
1939  EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
1940  break;
1941  case FC_C_CSTRING:
1942  case FC_C_WSTRING:
1943  if (fc == FC_C_CSTRING)
1944  esize = 1;
1945  else
1946  esize = 2;
1947 
1948  SizeVariance(pStubMsg);
1949 
1950  size = safe_multiply(esize, pStubMsg->ActualCount);
1952  break;
1953  case FC_BOGUS_ARRAY:
1954  alignment = pFormat[1] + 1;
1955  pFormat = SkipConformance(pStubMsg, pFormat + 4);
1956  if (IsConformanceOrVariancePresent(pFormat)) SizeVariance(pStubMsg);
1957  pFormat = SkipVariance(pStubMsg, pFormat);
1958 
1959  align_length(&pStubMsg->BufferLength, alignment);
1960 
1961  size = pStubMsg->ActualCount;
1962  for (i = 0; i < size; i++)
1963  pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL);
1964  break;
1965  default:
1966  ERR("unknown array format 0x%x\n", fc);
1968  }
1969 }
static void SizeVariance(MIDL_STUB_MESSAGE *pStubMsg)
Definition: ndr_marshall.c:551
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
static ULONG safe_multiply(ULONG a, ULONG b)
Definition: ndr_marshall.c:705
static PFORMAT_STRING SkipVariance(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:698
static void align_length(ULONG *len, unsigned int align)
Definition: ndr_marshall.c:93
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
ULONG ActualCount
Definition: rpcndr.h:223
ULONG_PTR MaxCount
Definition: rpcndr.h:221
GLsizeiptr size
Definition: glext.h:5919
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFOR_CONTEXT fc
Definition: for.c:53
static BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:466
static void safe_buffer_length_increment(MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
Definition: ndr_marshall.c:724
static PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:471
ULONG BufferLength
Definition: rpcndr.h:207
static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
#define ERR(fmt,...)
Definition: debug.h:109
static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by NdrComplexArrayBufferSize(), NdrComplexStructBufferSize(), NdrConformantArrayBufferSize(), NdrConformantStringBufferSize(), NdrConformantVaryingArrayBufferSize(), and NdrConformantVaryingStructBufferSize().

◆ array_compute_and_size_conformance()

static void array_compute_and_size_conformance ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat 
)
inlinestatic

Definition at line 1849 of file ndr_marshall.c.

1852 {
1853  DWORD count;
1854 
1855  switch (fc)
1856  {
1857  case FC_CARRAY:
1858  ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
1859  SizeConformance(pStubMsg);
1860  break;
1861  case FC_CVARRAY:
1862  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, 0);
1863  pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
1864  SizeConformance(pStubMsg);
1865  break;
1866  case FC_C_CSTRING:
1867  case FC_C_WSTRING:
1868  if (fc == FC_C_CSTRING)
1869  {
1870  TRACE("string=%s\n", debugstr_a((const char *)pMemory));
1871  pStubMsg->ActualCount = strlen((const char *)pMemory)+1;
1872  }
1873  else
1874  {
1875  TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory));
1876  pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
1877  }
1878 
1879  if (pFormat[1] == FC_STRING_SIZED)
1880  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0);
1881  else
1882  pStubMsg->MaxCount = pStubMsg->ActualCount;
1883 
1884  SizeConformance(pStubMsg);
1885  break;
1886  case FC_BOGUS_ARRAY:
1887  count = *(const WORD *)(pFormat + 2);
1888  pFormat += 4;
1889  if (IsConformanceOrVariancePresent(pFormat)) SizeConformance(pStubMsg);
1890  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, count);
1891  pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
1892  break;
1893  default:
1894  ERR("unknown array format 0x%x\n", fc);
1896  }
1897 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:37
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLuint GLuint GLsizei count
Definition: gl.h:1545
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
#define debugstr_w
Definition: kernel32.h:32
ULONG ActualCount
Definition: rpcndr.h:223
static PFORMAT_STRING ComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:42
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR MaxCount
Definition: rpcndr.h:221
#define debugstr_a
Definition: kernel32.h:31
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFOR_CONTEXT fc
Definition: for.c:53
static BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:466
static void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg)
Definition: ndr_marshall.c:542
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by NdrComplexArrayBufferSize(), NdrComplexStructBufferSize(), NdrConformantArrayBufferSize(), NdrConformantStringBufferSize(), NdrConformantVaryingArrayBufferSize(), and NdrConformantVaryingStructBufferSize().

◆ array_compute_and_write_conformance()

static void array_compute_and_write_conformance ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat 
)
inlinestatic

Definition at line 1971 of file ndr_marshall.c.

1974 {
1975  ULONG def;
1976  BOOL conformance_present;
1977 
1978  switch (fc)
1979  {
1980  case FC_CARRAY:
1981  ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
1982  WriteConformance(pStubMsg);
1983  break;
1984  case FC_CVARRAY:
1985  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, 0);
1986  pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
1987  WriteConformance(pStubMsg);
1988  break;
1989  case FC_C_CSTRING:
1990  case FC_C_WSTRING:
1991  if (fc == FC_C_CSTRING)
1992  {
1993  TRACE("string=%s\n", debugstr_a((const char *)pMemory));
1994  pStubMsg->ActualCount = strlen((const char *)pMemory)+1;
1995  }
1996  else
1997  {
1998  TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory));
1999  pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
2000  }
2001  if (pFormat[1] == FC_STRING_SIZED)
2002  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0);
2003  else
2004  pStubMsg->MaxCount = pStubMsg->ActualCount;
2005  pStubMsg->Offset = 0;
2006  WriteConformance(pStubMsg);
2007  break;
2008  case FC_BOGUS_ARRAY:
2009  def = *(const WORD *)(pFormat + 2);
2010  pFormat += 4;
2011  conformance_present = IsConformanceOrVariancePresent(pFormat);
2012  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
2013  pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
2014  if (conformance_present) WriteConformance(pStubMsg);
2015  break;
2016  default:
2017  ERR("unknown array format 0x%x\n", fc);
2019  }
2020 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:37
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
static void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg)
Definition: ndr_marshall.c:520
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
ULONG ActualCount
Definition: rpcndr.h:223
static PFORMAT_STRING ComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:42
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR MaxCount
Definition: rpcndr.h:221
#define debugstr_a
Definition: kernel32.h:31
unsigned short WORD
Definition: ntddk_ex.h:93
LPFOR_CONTEXT fc
Definition: for.c:53
static BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:466
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
unsigned int ULONG
Definition: retypes.h:1

Referenced by NdrComplexArrayMarshall(), NdrComplexStructMarshall(), NdrConformantArrayMarshall(), NdrConformantStringMarshall(), NdrConformantVaryingArrayMarshall(), and NdrConformantVaryingStructMarshall().

◆ array_free()

static void array_free ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
unsigned char  fHasPointers 
)
inlinestatic

Definition at line 2404 of file ndr_marshall.c.

2407 {
2408  DWORD i, count;
2409 
2410  switch (fc)
2411  {
2412  case FC_CARRAY:
2413  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
2414  if (fHasPointers)
2415  EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
2416  break;
2417  case FC_CVARRAY:
2418  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
2419  pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
2420  if (fHasPointers)
2421  EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
2422  break;
2423  case FC_C_CSTRING:
2424  case FC_C_WSTRING:
2425  /* No embedded pointers so nothing to do */
2426  break;
2427  case FC_BOGUS_ARRAY:
2428  count = *(const WORD *)(pFormat + 2);
2429  pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, count);
2430  pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
2431 
2432  count = pStubMsg->ActualCount;
2433  for (i = 0; i < count; i++)
2434  pMemory = ComplexFree(pStubMsg, pMemory, pFormat, NULL);
2435  break;
2436  default:
2437  ERR("unknown array format 0x%x\n", fc);
2439  }
2440 }
static PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:37
GLuint GLuint GLsizei count
Definition: gl.h:1545
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void EmbeddedPointerFree(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
smooth NULL
Definition: ftsmooth.c:416
ULONG ActualCount
Definition: rpcndr.h:223
static PFORMAT_STRING ComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def)
Definition: ndr_misc.h:42
ULONG_PTR MaxCount
Definition: rpcndr.h:221
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFOR_CONTEXT fc
Definition: for.c:53
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by NdrComplexStructFree(), NdrConformantArrayFree(), NdrConformantVaryingArrayFree(), and NdrConformantVaryingStructFree().

◆ array_memory_size()

static void array_memory_size ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat,
unsigned char  fHasPointers 
)
inlinestatic

Definition at line 2303 of file ndr_marshall.c.

2306 {
2307  ULONG i, count, SavedMemorySize;
2308  ULONG bufsize, memsize;
2309  DWORD esize;
2310  unsigned char alignment;
2311 
2312  switch (fc)
2313  {
2314  case FC_CARRAY:
2315  esize = *(const WORD*)(pFormat+2);
2316  alignment = pFormat[1] + 1;
2317 
2318  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2319 
2320  bufsize = memsize = safe_multiply(esize, pStubMsg->MaxCount);
2321  pStubMsg->MemorySize += memsize;
2322 
2323  align_pointer(&pStubMsg->Buffer, alignment);
2324  if (fHasPointers)
2325  pStubMsg->BufferMark = pStubMsg->Buffer;
2326  safe_buffer_increment(pStubMsg, bufsize);
2327 
2328  if (fHasPointers)
2329  EmbeddedPointerMemorySize(pStubMsg, pFormat);
2330  break;
2331  case FC_CVARRAY:
2332  esize = *(const WORD*)(pFormat+2);
2333  alignment = pFormat[1] + 1;
2334 
2335  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2336 
2337  pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
2338 
2339  bufsize = safe_multiply(esize, pStubMsg->ActualCount);
2340  memsize = safe_multiply(esize, pStubMsg->MaxCount);
2341  pStubMsg->MemorySize += memsize;
2342 
2343  align_pointer(&pStubMsg->Buffer, alignment);
2344  if (fHasPointers)
2345  pStubMsg->BufferMark = pStubMsg->Buffer;
2346  safe_buffer_increment(pStubMsg, bufsize);
2347 
2348  if (fHasPointers)
2349  EmbeddedPointerMemorySize(pStubMsg, pFormat);
2350  break;
2351  case FC_C_CSTRING:
2352  case FC_C_WSTRING:
2353  if (fc == FC_C_CSTRING)
2354  esize = 1;
2355  else
2356  esize = 2;
2357 
2358  ReadVariance(pStubMsg, NULL, pStubMsg->MaxCount);
2359 
2360  if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
2361  {
2362  ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
2363  pStubMsg->ActualCount, pStubMsg->MaxCount);
2365  }
2366  if (pStubMsg->Offset)
2367  {
2368  ERR("conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
2370  }
2371 
2372  memsize = safe_multiply(esize, pStubMsg->MaxCount);
2373  bufsize = safe_multiply(esize, pStubMsg->ActualCount);
2374 
2375  validate_string_data(pStubMsg, bufsize, esize);
2376 
2377  safe_buffer_increment(pStubMsg, bufsize);
2378  pStubMsg->MemorySize += memsize;
2379  break;
2380  case FC_BOGUS_ARRAY:
2381  alignment = pFormat[1] + 1;
2382  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2383  pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
2384 
2385  align_pointer(&pStubMsg->Buffer, alignment);
2386 
2387  SavedMemorySize = pStubMsg->MemorySize;
2388 
2389  esize = ComplexStructSize(pStubMsg, pFormat);
2390  memsize = safe_multiply(pStubMsg->MaxCount, esize);
2391 
2392  count = pStubMsg->ActualCount;
2393  for (i = 0; i < count; i++)
2394  ComplexStructMemorySize(pStubMsg, pFormat, NULL);
2395 
2396  pStubMsg->MemorySize = SavedMemorySize + memsize;
2397  break;
2398  default:
2399  ERR("unknown array format 0x%x\n", fc);
2401  }
2402 }
unsigned char * BufferMark
Definition: rpcndr.h:206
#define RPC_S_INVALID_BOUND
Definition: winerror.h:1043
static PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, ULONG MaxValue)
Definition: ndr_marshall.c:487
ULONG MemorySize
Definition: rpcndr.h:208
GLuint GLuint GLsizei count
Definition: gl.h:1545
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
static ULONG safe_multiply(ULONG a, ULONG b)
Definition: ndr_marshall.c:705
unsigned char * Buffer
Definition: rpcndr.h:203
static ULONG EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
static void align_pointer(unsigned char **ptr, unsigned int align)
Definition: ndr_marshall.c:98
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
ULONG ActualCount
Definition: rpcndr.h:223
ULONG_PTR MaxCount
Definition: rpcndr.h:221
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFOR_CONTEXT fc
Definition: for.c:53
static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULONG esize)
Definition: ndr_marshall.c:769
static PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:471
#define ERR(fmt,...)
Definition: debug.h:109
static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
static void safe_buffer_increment(MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
Definition: ndr_marshall.c:716
ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
unsigned int ULONG
Definition: retypes.h:1

Referenced by NdrComplexArrayMemorySize(), NdrComplexStructMemorySize(), NdrConformantArrayMemorySize(), NdrConformantStringMemorySize(), NdrConformantVaryingArrayMemorySize(), and NdrConformantVaryingStructMemorySize().

◆ array_read_conformance()

static ULONG array_read_conformance ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat 
)
inlinestatic

Definition at line 2098 of file ndr_marshall.c.

2100 {
2101  DWORD def, esize;
2102 
2103  switch (fc)
2104  {
2105  case FC_CARRAY:
2106  esize = *(const WORD*)(pFormat+2);
2107  pFormat = ReadConformance(pStubMsg, pFormat+4);
2108  return safe_multiply(esize, pStubMsg->MaxCount);
2109  case FC_CVARRAY:
2110  esize = *(const WORD*)(pFormat+2);
2111  pFormat = ReadConformance(pStubMsg, pFormat+4);
2112  return safe_multiply(esize, pStubMsg->MaxCount);
2113  case FC_C_CSTRING:
2114  case FC_C_WSTRING:
2115  if (fc == FC_C_CSTRING)
2116  esize = 1;
2117  else
2118  esize = 2;
2119 
2120  if (pFormat[1] == FC_STRING_SIZED)
2121  ReadConformance(pStubMsg, pFormat + 2);
2122  else
2123  ReadConformance(pStubMsg, NULL);
2124  return safe_multiply(esize, pStubMsg->MaxCount);
2125  case FC_BOGUS_ARRAY:
2126  def = *(const WORD *)(pFormat + 2);
2127  pFormat += 4;
2128  if (IsConformanceOrVariancePresent(pFormat)) pFormat = ReadConformance(pStubMsg, pFormat);
2129  else
2130  {
2131  pStubMsg->MaxCount = def;
2132  pFormat = SkipConformance( pStubMsg, pFormat );
2133  }
2134  pFormat = SkipVariance( pStubMsg, pFormat );
2135 
2136  esize = ComplexStructSize(pStubMsg, pFormat);
2137  return safe_multiply(pStubMsg->MaxCount, esize);
2138  default:
2139  ERR("unknown array format 0x%x\n", fc);
2141  }
2142 }
static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:476
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
static ULONG safe_multiply(ULONG a, ULONG b)
Definition: ndr_marshall.c:705
static PFORMAT_STRING SkipVariance(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:698
smooth NULL
Definition: ftsmooth.c:416
ULONG_PTR MaxCount
Definition: rpcndr.h:221
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFOR_CONTEXT fc
Definition: for.c:53
static BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:466
static PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:471
#define ERR(fmt,...)
Definition: debug.h:109
ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Referenced by NdrComplexArrayMemorySize(), NdrComplexArrayUnmarshall(), NdrComplexStructMemorySize(), NdrComplexStructUnmarshall(), NdrConformantArrayMemorySize(), NdrConformantArrayUnmarshall(), NdrConformantStringMemorySize(), NdrConformantStringUnmarshall(), NdrConformantVaryingArrayMemorySize(), NdrConformantVaryingArrayUnmarshall(), NdrConformantVaryingStructMemorySize(), and NdrConformantVaryingStructUnmarshall().

◆ array_read_variance_and_unmarshall()

static ULONG array_read_variance_and_unmarshall ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char **  ppMemory,
PFORMAT_STRING  pFormat,
unsigned char  fMustAlloc,
unsigned char  fUseBufferMemoryServer,
unsigned char  fUnmarshall 
)
inlinestatic

Definition at line 2144 of file ndr_marshall.c.

2148 {
2149  ULONG bufsize, memsize;
2150  WORD esize;
2151  unsigned char alignment;
2152  unsigned char *saved_buffer, *pMemory;
2153  ULONG i, offset, count;
2154 
2155  switch (fc)
2156  {
2157  case FC_CARRAY:
2158  esize = *(const WORD*)(pFormat+2);
2159  alignment = pFormat[1] + 1;
2160 
2161  bufsize = memsize = safe_multiply(esize, pStubMsg->MaxCount);
2162 
2163  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2164 
2165  align_pointer(&pStubMsg->Buffer, alignment);
2166 
2167  if (fUnmarshall)
2168  {
2169  if (fMustAlloc)
2170  *ppMemory = NdrAllocateZero(pStubMsg, memsize);
2171  else
2172  {
2173  if (fUseBufferMemoryServer && !pStubMsg->IsClient && !*ppMemory)
2174  /* for servers, we just point straight into the RPC buffer */
2175  *ppMemory = pStubMsg->Buffer;
2176  }
2177 
2178  saved_buffer = pStubMsg->Buffer;
2179  safe_buffer_increment(pStubMsg, bufsize);
2180 
2181  pStubMsg->BufferMark = saved_buffer;
2182  EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat, fMustAlloc);
2183 
2184  TRACE("copying %p to %p\n", saved_buffer, *ppMemory);
2185  if (*ppMemory != saved_buffer)
2186  memcpy(*ppMemory, saved_buffer, bufsize);
2187  }
2188  return bufsize;
2189  case FC_CVARRAY:
2190  esize = *(const WORD*)(pFormat+2);
2191  alignment = pFormat[1] + 1;
2192 
2193  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2194 
2195  pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
2196 
2197  align_pointer(&pStubMsg->Buffer, alignment);
2198 
2199  bufsize = safe_multiply(esize, pStubMsg->ActualCount);
2200  memsize = safe_multiply(esize, pStubMsg->MaxCount);
2201 
2202  if (fUnmarshall)
2203  {
2204  offset = pStubMsg->Offset;
2205 
2206  if (!fMustAlloc && !*ppMemory)
2207  fMustAlloc = TRUE;
2208  if (fMustAlloc)
2209  *ppMemory = NdrAllocateZero(pStubMsg, memsize);
2210  saved_buffer = pStubMsg->Buffer;
2211  safe_buffer_increment(pStubMsg, bufsize);
2212 
2213  pStubMsg->BufferMark = saved_buffer;
2214  EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat,
2215  fMustAlloc);
2216 
2217  memcpy(*ppMemory + offset, saved_buffer, bufsize);
2218  }
2219  return bufsize;
2220  case FC_C_CSTRING:
2221  case FC_C_WSTRING:
2222  if (fc == FC_C_CSTRING)
2223  esize = 1;
2224  else
2225  esize = 2;
2226 
2227  ReadVariance(pStubMsg, NULL, pStubMsg->MaxCount);
2228 
2229  if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
2230  {
2231  ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
2232  pStubMsg->ActualCount, pStubMsg->MaxCount);
2234  }
2235  if (pStubMsg->Offset)
2236  {
2237  ERR("conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
2239  }
2240 
2241  memsize = safe_multiply(esize, pStubMsg->MaxCount);
2242  bufsize = safe_multiply(esize, pStubMsg->ActualCount);
2243 
2244  validate_string_data(pStubMsg, bufsize, esize);
2245 
2246  if (fUnmarshall)
2247  {
2248  if (fMustAlloc)
2249  *ppMemory = NdrAllocate(pStubMsg, memsize);
2250  else
2251  {
2252  if (fUseBufferMemoryServer && !pStubMsg->IsClient &&
2253  !*ppMemory && (pStubMsg->MaxCount == pStubMsg->ActualCount))
2254  /* if the data in the RPC buffer is big enough, we just point
2255  * straight into it */
2256  *ppMemory = pStubMsg->Buffer;
2257  else if (!*ppMemory)
2258  *ppMemory = NdrAllocate(pStubMsg, memsize);
2259  }
2260 
2261  if (*ppMemory == pStubMsg->Buffer)
2262  safe_buffer_increment(pStubMsg, bufsize);
2263  else
2264  safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize);
2265 
2266  if (*pFormat == FC_C_CSTRING)
2267  TRACE("string=%s\n", debugstr_a((char*)*ppMemory));
2268  else
2269  TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory));
2270  }
2271  return bufsize;
2272 
2273  case FC_BOGUS_ARRAY:
2274  alignment = pFormat[1] + 1;
2275  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2276  pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
2277 
2278  esize = ComplexStructSize(pStubMsg, pFormat);
2279  memsize = safe_multiply(esize, pStubMsg->MaxCount);
2280 
2281  assert( fUnmarshall );
2282 
2283  if (!fMustAlloc && !*ppMemory)
2284  fMustAlloc = TRUE;
2285  if (fMustAlloc)
2286  *ppMemory = NdrAllocateZero(pStubMsg, memsize);
2287 
2288  align_pointer(&pStubMsg->Buffer, alignment);
2289  saved_buffer = pStubMsg->Buffer;
2290 
2291  pMemory = *ppMemory;
2292  count = pStubMsg->ActualCount;
2293  for (i = 0; i < count; i++)
2294  pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL, fMustAlloc);
2295  return pStubMsg->Buffer - saved_buffer;
2296 
2297  default:
2298  ERR("unknown array format 0x%x\n", fc);
2300  }
2301 }
unsigned char * BufferMark
Definition: rpcndr.h:206
#define TRUE
Definition: types.h:120
#define RPC_S_INVALID_BOUND
Definition: winerror.h:1043
static unsigned char * EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pDstBuffer, unsigned char *pSrcMemoryPtrs, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
static PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat, ULONG MaxValue)
Definition: ndr_marshall.c:487
GLuint GLuint GLsizei count
Definition: gl.h:1545
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
static ULONG safe_multiply(ULONG a, ULONG b)
Definition: ndr_marshall.c:705
unsigned char * Buffer
Definition: rpcndr.h:203
GLintptr offset
Definition: glext.h:5920
#define assert(x)
Definition: debug.h:53
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
static void align_pointer(unsigned char **ptr, unsigned int align)
Definition: ndr_marshall.c:98
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void *WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
Definition: ndr_marshall.c:422
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
ULONG ActualCount
Definition: rpcndr.h:223
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR MaxCount
Definition: rpcndr.h:221
#define debugstr_a
Definition: kernel32.h:31
unsigned short WORD
Definition: ntddk_ex.h:93
LPFOR_CONTEXT fc
Definition: for.c:53
static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULONG esize)
Definition: ndr_marshall.c:769
static PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:471
static void safe_copy_from_buffer(MIDL_STUB_MESSAGE *pStubMsg, void *p, ULONG size)
Definition: ndr_marshall.c:737
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer, unsigned char fMustAlloc)
#define ERR(fmt,...)
Definition: debug.h:109
unsigned char IsClient
Definition: rpcndr.h:210
static void safe_buffer_increment(MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
Definition: ndr_marshall.c:716
ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void * NdrAllocateZero(MIDL_STUB_MESSAGE *stubmsg, SIZE_T len)
Definition: ndr_marshall.c:452

Referenced by NdrComplexArrayUnmarshall(), NdrComplexStructUnmarshall(), NdrConformantArrayUnmarshall(), NdrConformantStringUnmarshall(), NdrConformantVaryingArrayUnmarshall(), and NdrConformantVaryingStructUnmarshall().

◆ array_write_variance_and_marshall()

static void array_write_variance_and_marshall ( unsigned char  fc,
PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
unsigned char  fHasPointers 
)
inlinestatic

Definition at line 2022 of file ndr_marshall.c.

2025 {
2026  DWORD i, size;
2027  DWORD esize;
2028  unsigned char alignment;
2029 
2030  switch (fc)
2031  {
2032  case FC_CARRAY:
2033  esize = *(const WORD*)(pFormat+2);
2034  alignment = pFormat[1] + 1;
2035 
2036  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2037 
2038  align_pointer_clear(&pStubMsg->Buffer, alignment);
2039 
2040  size = safe_multiply(esize, pStubMsg->MaxCount);
2041  if (fHasPointers)
2042  pStubMsg->BufferMark = pStubMsg->Buffer;
2043  safe_copy_to_buffer(pStubMsg, pMemory, size);
2044 
2045  if (fHasPointers)
2046  EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
2047  break;
2048  case FC_CVARRAY:
2049  esize = *(const WORD*)(pFormat+2);
2050  alignment = pFormat[1] + 1;
2051 
2052  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2053  pFormat = SkipVariance(pStubMsg, pFormat);
2054 
2055  WriteVariance(pStubMsg);
2056 
2057  align_pointer_clear(&pStubMsg->Buffer, alignment);
2058 
2059  size = safe_multiply(esize, pStubMsg->ActualCount);
2060 
2061  if (fHasPointers)
2062  pStubMsg->BufferMark = pStubMsg->Buffer;
2063  safe_copy_to_buffer(pStubMsg, pMemory + pStubMsg->Offset, size);
2064 
2065  if (fHasPointers)
2066  EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
2067  break;
2068  case FC_C_CSTRING:
2069  case FC_C_WSTRING:
2070  if (fc == FC_C_CSTRING)
2071  esize = 1;
2072  else
2073  esize = 2;
2074 
2075  WriteVariance(pStubMsg);
2076 
2077  size = safe_multiply(esize, pStubMsg->ActualCount);
2078  safe_copy_to_buffer(pStubMsg, pMemory, size); /* the string itself */
2079  break;
2080  case FC_BOGUS_ARRAY:
2081  alignment = pFormat[1] + 1;
2082  pFormat = SkipConformance(pStubMsg, pFormat + 4);
2083  if (IsConformanceOrVariancePresent(pFormat)) WriteVariance(pStubMsg);
2084  pFormat = SkipVariance(pStubMsg, pFormat);
2085 
2086  align_pointer_clear(&pStubMsg->Buffer, alignment);
2087 
2088  size = pStubMsg->ActualCount;
2089  for (i = 0; i < size; i++)
2090  pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL);
2091  break;
2092  default:
2093  ERR("unknown array format 0x%x\n", fc);
2095  }
2096 }
unsigned char * BufferMark
Definition: rpcndr.h:206
static void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg)
Definition: ndr_marshall.c:530
static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, PFORMAT_STRING pPointer)
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
static ULONG safe_multiply(ULONG a, ULONG b)
Definition: ndr_marshall.c:705
unsigned char * Buffer
Definition: rpcndr.h:203
static PFORMAT_STRING SkipVariance(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:698
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
ULONG ActualCount
Definition: rpcndr.h:223
ULONG_PTR MaxCount
Definition: rpcndr.h:221
GLsizeiptr size
Definition: glext.h:5919
static void align_pointer_clear(unsigned char **ptr, unsigned int align)
Definition: ndr_marshall.c:104
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LPFOR_CONTEXT fc
Definition: for.c:53
static BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:466
static PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:471
#define ERR(fmt,...)
Definition: debug.h:109
static unsigned char * EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
static void safe_copy_to_buffer(MIDL_STUB_MESSAGE *pStubMsg, const void *p, ULONG size)
Definition: ndr_marshall.c:753

Referenced by NdrComplexArrayMarshall(), NdrComplexStructMarshall(), NdrConformantArrayMarshall(), NdrConformantStringMarshall(), NdrConformantVaryingArrayMarshall(), and NdrConformantVaryingStructMarshall().

◆ ComplexBufferSize()

static unsigned char * ComplexBufferSize ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
PFORMAT_STRING  pPointer 
)
static

Definition at line 3181 of file ndr_marshall.c.

3185 {
3186  unsigned char *mem_base = pMemory;
3188  NDR_BUFFERSIZE m;
3189  ULONG size;
3190 
3191  while (*pFormat != FC_END) {
3192  switch (*pFormat) {
3193  case FC_BYTE:
3194  case FC_CHAR:
3195  case FC_SMALL:
3196  case FC_USMALL:
3197  safe_buffer_length_increment(pStubMsg, 1);
3198  pMemory += 1;
3199  break;
3200  case FC_WCHAR:
3201  case FC_SHORT:
3202  case FC_USHORT:
3203  safe_buffer_length_increment(pStubMsg, 2);
3204  pMemory += 2;
3205  break;
3206  case FC_ENUM16:
3207  safe_buffer_length_increment(pStubMsg, 2);
3208  pMemory += 4;
3209  break;
3210  case FC_LONG:
3211  case FC_ULONG:
3212  case FC_ENUM32:
3213  case FC_FLOAT:
3214  safe_buffer_length_increment(pStubMsg, 4);
3215  pMemory += 4;
3216  break;
3217  case FC_INT3264:
3218  case FC_UINT3264:
3219  safe_buffer_length_increment(pStubMsg, 4);
3220  pMemory += sizeof(INT_PTR);
3221  break;
3222  case FC_HYPER:
3223  case FC_DOUBLE:
3224  safe_buffer_length_increment(pStubMsg, 8);
3225  pMemory += 8;
3226  break;
3227  case FC_RP:
3228  case FC_UP:
3229  case FC_OP:
3230  case FC_FP:
3231  case FC_POINTER:
3232  if (*pFormat != FC_POINTER)
3233  pPointer = pFormat;
3234  if (!pStubMsg->IgnoreEmbeddedPointers)
3235  {
3236  int saved_buffer_length = pStubMsg->BufferLength;
3237  pStubMsg->BufferLength = pStubMsg->PointerLength;
3238  pStubMsg->PointerLength = 0;
3239  if(!pStubMsg->BufferLength)
3240  ERR("BufferLength == 0??\n");
3241  PointerBufferSize(pStubMsg, *(unsigned char**)pMemory, pPointer);
3242  pStubMsg->PointerLength = pStubMsg->BufferLength;
3243  pStubMsg->BufferLength = saved_buffer_length;
3244  }
3245  if (*pPointer != FC_RP)
3246  {
3247  align_length(&pStubMsg->BufferLength, 4);
3248  safe_buffer_length_increment(pStubMsg, 4);
3249  }
3250  if (*pFormat == FC_POINTER)
3251  pPointer += 4;
3252  else
3253  pFormat += 4;
3254  pMemory += sizeof(void*);
3255  break;
3256  case FC_ALIGNM2:
3257  align_pointer_offset(&pMemory, mem_base, 2);
3258  break;
3259  case FC_ALIGNM4:
3260  align_pointer_offset(&pMemory, mem_base, 4);
3261  break;
3262  case FC_ALIGNM8:
3263  align_pointer_offset(&pMemory, mem_base, 8);
3264  break;
3265  case FC_STRUCTPAD1:
3266  case FC_STRUCTPAD2:
3267  case FC_STRUCTPAD3:
3268  case FC_STRUCTPAD4:
3269  case FC_STRUCTPAD5:
3270  case FC_STRUCTPAD6:
3271  case FC_STRUCTPAD7:
3272  pMemory += *pFormat - FC_STRUCTPAD1 + 1;
3273  break;
3274  case FC_EMBEDDED_COMPLEX:
3275  pMemory += pFormat[1];
3276  pFormat += 2;
3277  desc = pFormat + *(const SHORT*)pFormat;
3278  size = EmbeddedComplexSize(pStubMsg, desc);
3280  if (m)
3281  {
3282  /* for some reason interface pointers aren't generated as
3283  * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
3284  * they still need the dereferencing treatment that pointers are
3285  * given */
3286  if (*desc == FC_IP)
3287  m(pStubMsg, *(unsigned char **)pMemory, desc);
3288  else
3289  m(pStubMsg, pMemory, desc);
3290  }
3291  else FIXME("no buffersizer for embedded type %02x\n", *desc);
3292  pMemory += size;
3293  pFormat += 2;
3294  continue;
3295  case FC_PAD:
3296  break;
3297  default:
3298  FIXME("unhandled format 0x%02x\n", *pFormat);
3299  }
3300  pFormat++;
3301  }
3302 
3303  return pMemory;
3304 }
static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Pointer, PFORMAT_STRING pFormat)
int32_t INT_PTR
Definition: typedefs.h:62
static void align_length(ULONG *len, unsigned int align)
Definition: ndr_marshall.c:93
const GLfloat * m
Definition: glext.h:10848
int IgnoreEmbeddedPointers
Definition: rpcndr.h:216
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
static void align_pointer_offset(unsigned char **ptr, unsigned char *base, unsigned int align)
Definition: ndr_marshall.c:111
void(WINAPI * NDR_BUFFERSIZE)(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
Definition: ndr_misc.h:55
GLsizeiptr size
Definition: glext.h:5919
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
const NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:263
static void safe_buffer_length_increment(MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
Definition: ndr_marshall.c:724
ULONG BufferLength
Definition: rpcndr.h:207
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int ULONG
Definition: retypes.h:1
#define NDR_TABLE_MASK
Definition: ndr_marshall.c:133
ULONG PointerLength
Definition: rpcndr.h:233

Referenced by array_buffer_size(), and NdrComplexStructBufferSize().

◆ ComplexFree()

static unsigned char * ComplexFree ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
PFORMAT_STRING  pPointer 
)
static

Definition at line 3306 of file ndr_marshall.c.

3310 {
3311  unsigned char *mem_base = pMemory;
3313  NDR_FREE m;
3314  ULONG size;
3315 
3316  while (*pFormat != FC_END) {
3317  switch (*pFormat) {
3318  case FC_BYTE:
3319  case FC_CHAR:
3320  case FC_SMALL:
3321  case FC_USMALL:
3322  pMemory += 1;
3323  break;
3324  case FC_WCHAR:
3325  case FC_SHORT:
3326  case FC_USHORT:
3327  pMemory += 2;
3328  break;
3329  case FC_LONG:
3330  case FC_ULONG:
3331  case FC_ENUM16:
3332  case FC_ENUM32:
3333  case FC_FLOAT:
3334  pMemory += 4;
3335  break;
3336  case FC_INT3264:
3337  case FC_UINT3264:
3338  pMemory += sizeof(INT_PTR);
3339  break;
3340  case FC_HYPER:
3341  case FC_DOUBLE:
3342  pMemory += 8;
3343  break;
3344  case FC_RP:
3345  case FC_UP:
3346  case FC_OP:
3347  case FC_FP:
3348  case FC_POINTER:
3349  if (*pFormat != FC_POINTER)
3350  pPointer = pFormat;
3351  NdrPointerFree(pStubMsg, *(unsigned char**)pMemory, pPointer);
3352  if (*pFormat == FC_POINTER)
3353  pPointer += 4;
3354  else
3355  pFormat += 4;
3356  pMemory += sizeof(void *);
3357  break;
3358  case FC_ALIGNM2:
3359  align_pointer_offset(&pMemory, mem_base, 2);
3360  break;
3361  case FC_ALIGNM4:
3362  align_pointer_offset(&pMemory, mem_base, 4);
3363  break;
3364  case FC_ALIGNM8:
3365  align_pointer_offset(&pMemory, mem_base, 8);
3366  break;
3367  case FC_STRUCTPAD1:
3368  case FC_STRUCTPAD2:
3369  case FC_STRUCTPAD3:
3370  case FC_STRUCTPAD4:
3371  case FC_STRUCTPAD5:
3372  case FC_STRUCTPAD6:
3373  case FC_STRUCTPAD7:
3374  pMemory += *pFormat - FC_STRUCTPAD1 + 1;
3375  break;
3376  case FC_EMBEDDED_COMPLEX:
3377  pMemory += pFormat[1];
3378  pFormat += 2;
3379  desc = pFormat + *(const SHORT*)pFormat;
3380  size = EmbeddedComplexSize(pStubMsg, desc);
3381  m = NdrFreer[*desc & NDR_TABLE_MASK];
3382  if (m)
3383  {
3384  /* for some reason interface pointers aren't generated as
3385  * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
3386  * they still need the dereferencing treatment that pointers are
3387  * given */
3388  if (*desc == FC_IP)
3389  m(pStubMsg, *(unsigned char **)pMemory, desc);
3390  else
3391  m(pStubMsg, pMemory, desc);
3392  }
3393  pMemory += size;
3394  pFormat += 2;
3395  continue;
3396  case FC_PAD:
3397  break;
3398  default:
3399  FIXME("unhandled format 0x%02x\n", *pFormat);
3400  }
3401  pFormat++;
3402  }
3403 
3404  return pMemory;
3405 }
void WINAPI NdrPointerFree(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
const NDR_FREE NdrFreer[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:351
int32_t INT_PTR
Definition: typedefs.h:62
const GLfloat * m
Definition: glext.h:10848
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
static void align_pointer_offset(unsigned char **ptr, unsigned char *base, unsigned int align)
Definition: ndr_marshall.c:111
GLsizeiptr size
Definition: glext.h:5919
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
void(WINAPI * NDR_FREE)(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
Definition: ndr_misc.h:57
unsigned int ULONG
Definition: retypes.h:1
#define NDR_TABLE_MASK
Definition: ndr_marshall.c:133

Referenced by array_free(), NdrComplexArrayFree(), and NdrComplexStructFree().

◆ ComplexMarshall()

static unsigned char * ComplexMarshall ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
PFORMAT_STRING  pPointer 
)
static

Definition at line 2845 of file ndr_marshall.c.

2849 {
2850  unsigned char *mem_base = pMemory;
2852  NDR_MARSHALL m;
2853  ULONG size;
2854 
2855  while (*pFormat != FC_END) {
2856  switch (*pFormat) {
2857  case FC_BYTE:
2858  case FC_CHAR:
2859  case FC_SMALL:
2860  case FC_USMALL:
2861  TRACE("byte=%d <= %p\n", *(WORD*)pMemory, pMemory);
2862  safe_copy_to_buffer(pStubMsg, pMemory, 1);
2863  pMemory += 1;
2864  break;
2865  case FC_WCHAR:
2866  case FC_SHORT:
2867  case FC_USHORT:
2868  TRACE("short=%d <= %p\n", *(WORD*)pMemory, pMemory);
2869  safe_copy_to_buffer(pStubMsg, pMemory, 2);
2870  pMemory += 2;
2871  break;
2872  case FC_ENUM16:
2873  {
2874  USHORT val = *(DWORD *)pMemory;
2875  TRACE("enum16=%d <= %p\n", *(DWORD*)pMemory, pMemory);
2876  if (32767 < *(DWORD*)pMemory)
2878  safe_copy_to_buffer(pStubMsg, &val, 2);
2879  pMemory += 4;
2880  break;
2881  }
2882  case FC_LONG:
2883  case FC_ULONG:
2884  case FC_ENUM32:
2885  TRACE("long=%d <= %p\n", *(DWORD*)pMemory, pMemory);
2886  safe_copy_to_buffer(pStubMsg, pMemory, 4);
2887  pMemory += 4;
2888  break;
2889  case FC_INT3264:
2890  case FC_UINT3264:
2891  {
2892  UINT val = *(UINT_PTR *)pMemory;
2893  TRACE("int3264=%ld <= %p\n", *(UINT_PTR *)pMemory, pMemory);
2894  safe_copy_to_buffer(pStubMsg, &val, sizeof(UINT));
2895  pMemory += sizeof(UINT_PTR);
2896  break;
2897  }
2898  case FC_FLOAT:
2899  TRACE("float=%f <= %p\n", *(float*)pMemory, pMemory);
2900  safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float));
2901  pMemory += sizeof(float);
2902  break;
2903  case FC_HYPER:
2904  TRACE("longlong=%s <= %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory);
2905  safe_copy_to_buffer(pStubMsg, pMemory, 8);
2906  pMemory += 8;
2907  break;
2908  case FC_DOUBLE:
2909  TRACE("double=%f <= %p\n", *(double*)pMemory, pMemory);
2910  safe_copy_to_buffer(pStubMsg, pMemory, sizeof(double));
2911  pMemory += sizeof(double);
2912  break;
2913  case FC_RP:
2914  case FC_UP:
2915  case FC_OP:
2916  case FC_FP:
2917  case FC_POINTER:
2918  {
2919  unsigned char *saved_buffer;
2920  BOOL pointer_buffer_mark_set = FALSE;
2921  TRACE("pointer=%p <= %p\n", *(unsigned char**)pMemory, pMemory);
2922  TRACE("pStubMsg->Buffer before %p\n", pStubMsg->Buffer);
2923  if (*pFormat != FC_POINTER)
2924  pPointer = pFormat;
2925  if (*pPointer != FC_RP)
2926  align_pointer_clear(&pStubMsg->Buffer, 4);
2927  saved_buffer = pStubMsg->Buffer;
2928  if (pStubMsg->PointerBufferMark)
2929  {
2930  pStubMsg->Buffer = pStubMsg->PointerBufferMark;
2931  pStubMsg->PointerBufferMark = NULL;
2932  pointer_buffer_mark_set = TRUE;
2933  }
2934  else if (*pPointer != FC_RP)
2935  safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
2936  PointerMarshall(pStubMsg, saved_buffer, *(unsigned char**)pMemory, pPointer);
2937  if (pointer_buffer_mark_set)
2938  {
2939  STD_OVERFLOW_CHECK(pStubMsg);
2940  pStubMsg->PointerBufferMark = pStubMsg->Buffer;
2941  pStubMsg->Buffer = saved_buffer;
2942  if (*pPointer != FC_RP)
2943  safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
2944  }
2945  TRACE("pStubMsg->Buffer after %p\n", pStubMsg->Buffer);
2946  if (*pFormat == FC_POINTER)
2947  pPointer += 4;
2948  else
2949  pFormat += 4;
2950  pMemory += sizeof(void *);
2951  break;
2952  }
2953  case FC_ALIGNM2:
2954  align_pointer_offset(&pMemory, mem_base, 2);
2955  break;
2956  case FC_ALIGNM4:
2957  align_pointer_offset(&pMemory, mem_base, 4);
2958  break;
2959  case FC_ALIGNM8:
2960  align_pointer_offset(&pMemory, mem_base, 8);
2961  break;
2962  case FC_STRUCTPAD1:
2963  case FC_STRUCTPAD2:
2964  case FC_STRUCTPAD3:
2965  case FC_STRUCTPAD4:
2966  case FC_STRUCTPAD5:
2967  case FC_STRUCTPAD6:
2968  case FC_STRUCTPAD7:
2969  pMemory += *pFormat - FC_STRUCTPAD1 + 1;
2970  break;
2971  case FC_EMBEDDED_COMPLEX:
2972  pMemory += pFormat[1];
2973  pFormat += 2;
2974  desc = pFormat + *(const SHORT*)pFormat;
2975  size = EmbeddedComplexSize(pStubMsg, desc);
2976  TRACE("embedded complex (size=%d) <= %p\n", size, pMemory);
2978  if (m)
2979  {
2980  /* for some reason interface pointers aren't generated as
2981  * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
2982  * they still need the dereferencing treatment that pointers are
2983  * given */
2984  if (*desc == FC_IP)
2985  m(pStubMsg, *(unsigned char **)pMemory, desc);
2986  else
2987  m(pStubMsg, pMemory, desc);
2988  }
2989  else FIXME("no marshaller for embedded type %02x\n", *desc);
2990  pMemory += size;
2991  pFormat += 2;
2992  continue;
2993  case FC_PAD:
2994  break;
2995  default:
2996  FIXME("unhandled format 0x%02x\n", *pFormat);
2997  }
2998  pFormat++;
2999  }
3000 
3001  return pMemory;
3002 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
#define TRUE
Definition: types.h:120
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
unsigned char *(WINAPI * NDR_MARSHALL)(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING)
Definition: ndr_misc.h:53
unsigned char * Buffer
Definition: rpcndr.h:203
unsigned char * PointerBufferMark
Definition: rpcndr.h:217
const GLfloat * m
Definition: glext.h:10848
unsigned int BOOL
Definition: ntddk_ex.h:94
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
static void align_pointer_offset(unsigned char **ptr, unsigned char *base, unsigned int align)
Definition: ndr_marshall.c:111
GLuint GLfloat * val
Definition: glext.h:7180
static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, unsigned char *Pointer, PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:816
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static void align_pointer_clear(unsigned char **ptr, unsigned int align)
Definition: ndr_marshall.c:104
uint64_t ULONGLONG
Definition: typedefs.h:65
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define RPC_X_ENUM_VALUE_OUT_OF_RANGE
Definition: winerror.h:1088
const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:175
unsigned short USHORT
Definition: pedump.c:61
unsigned int UINT
Definition: ndis.h:50
static void safe_buffer_increment(MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
Definition: ndr_marshall.c:716
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define STD_OVERFLOW_CHECK(_Msg)
Definition: ndr_marshall.c:124
static void safe_copy_to_buffer(MIDL_STUB_MESSAGE *pStubMsg, const void *p, ULONG size)
Definition: ndr_marshall.c:753
#define NDR_TABLE_MASK
Definition: ndr_marshall.c:133

Referenced by array_write_variance_and_marshall(), and NdrComplexStructMarshall().

◆ ComplexStructMemorySize()

static ULONG ComplexStructMemorySize ( PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat,
PFORMAT_STRING  pPointer 
)
static

Definition at line 3407 of file ndr_marshall.c.

3410 {
3412  ULONG size = 0;
3413 
3414  while (*pFormat != FC_END) {
3415  switch (*pFormat) {
3416  case FC_BYTE:
3417  case FC_CHAR:
3418  case FC_SMALL:
3419  case FC_USMALL:
3420  size += 1;
3421  safe_buffer_increment(pStubMsg, 1);
3422  break;
3423  case FC_WCHAR:
3424  case FC_SHORT:
3425  case FC_USHORT:
3426  size += 2;
3427  safe_buffer_increment(pStubMsg, 2);
3428  break;
3429  case FC_ENUM16:
3430  size += 4;
3431  safe_buffer_increment(pStubMsg, 2);
3432  break;
3433  case FC_LONG:
3434  case FC_ULONG:
3435  case FC_ENUM32:
3436  case FC_FLOAT:
3437  size += 4;
3438  safe_buffer_increment(pStubMsg, 4);
3439  break;
3440  case FC_INT3264:
3441  case FC_UINT3264:
3442  size += sizeof(INT_PTR);
3443  safe_buffer_increment(pStubMsg, 4);
3444  break;
3445  case FC_HYPER:
3446  case FC_DOUBLE:
3447  size += 8;
3448  safe_buffer_increment(pStubMsg, 8);
3449  break;
3450  case FC_RP:
3451  case FC_UP:
3452  case FC_OP:
3453  case FC_FP:
3454  case FC_POINTER:
3455  {
3456  unsigned char *saved_buffer;
3457  BOOL pointer_buffer_mark_set = FALSE;
3458  if (*pFormat != FC_POINTER)
3459  pPointer = pFormat;
3460  if (*pPointer != FC_RP)
3461  align_pointer(&pStubMsg->Buffer, 4);
3462  saved_buffer = pStubMsg->Buffer;
3463  if (pStubMsg->PointerBufferMark)
3464  {
3465  pStubMsg->Buffer = pStubMsg->PointerBufferMark;
3466  pStubMsg->PointerBufferMark = NULL;
3467  pointer_buffer_mark_set = TRUE;
3468  }
3469  else if (*pPointer != FC_RP)
3470  safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
3471 
3472  if (!pStubMsg->IgnoreEmbeddedPointers)
3473  PointerMemorySize(pStubMsg, saved_buffer, pPointer);
3474  if (pointer_buffer_mark_set)
3475  {
3476  STD_OVERFLOW_CHECK(pStubMsg);
3477  pStubMsg->PointerBufferMark = pStubMsg->Buffer;
3478  pStubMsg->Buffer = saved_buffer;
3479  if (*pPointer != FC_RP)
3480  safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
3481  }
3482  if (*pFormat == FC_POINTER)
3483  pPointer += 4;
3484  else
3485  pFormat += 4;
3486  size += sizeof(void *);
3487  break;
3488  }
3489  case FC_ALIGNM2:
3490  align_length(&size, 2);
3491  break;
3492  case FC_ALIGNM4:
3493  align_length(&size, 4);
3494  break;
3495  case FC_ALIGNM8:
3496  align_length(&size, 8);
3497  break;
3498  case FC_STRUCTPAD1:
3499  case FC_STRUCTPAD2:
3500  case FC_STRUCTPAD3:
3501  case FC_STRUCTPAD4:
3502  case FC_STRUCTPAD5:
3503  case FC_STRUCTPAD6:
3504  case FC_STRUCTPAD7:
3505  size += *pFormat - FC_STRUCTPAD1 + 1;
3506  break;
3507  case FC_EMBEDDED_COMPLEX:
3508  size += pFormat[1];
3509  pFormat += 2;
3510  desc = pFormat + *(const SHORT*)pFormat;
3511  size += EmbeddedComplexMemorySize(pStubMsg, desc);
3512  pFormat += 2;
3513  continue;
3514  case FC_PAD:
3515  break;
3516  default:
3517  FIXME("unhandled format 0x%02x\n", *pFormat);
3518  }
3519  pFormat++;
3520  }
3521 
3522  return size;
3523 }
static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, PFORMAT_STRING pFormat)
#define TRUE
Definition: types.h:120
unsigned char * Buffer
Definition: rpcndr.h:203
int32_t INT_PTR
Definition: typedefs.h:62
unsigned char * PointerBufferMark
Definition: rpcndr.h:217
static void align_length(ULONG *len, unsigned int align)
Definition: ndr_marshall.c:93
static void align_pointer(unsigned char **ptr, unsigned int align)
Definition: ndr_marshall.c:98
unsigned int BOOL
Definition: ntddk_ex.h:94
int IgnoreEmbeddedPointers
Definition: rpcndr.h:216
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
static void safe_buffer_increment(MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
Definition: ndr_marshall.c:716
unsigned int ULONG
Definition: retypes.h:1
static ULONG EmbeddedComplexMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
#define STD_OVERFLOW_CHECK(_Msg)
Definition: ndr_marshall.c:124

Referenced by array_memory_size(), and NdrComplexStructMemorySize().

◆ ComplexStructSize()

ULONG ComplexStructSize ( PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat 
)

Definition at line 3525 of file ndr_marshall.c.

3526 {
3528  ULONG size = 0;
3529 
3530  while (*pFormat != FC_END) {
3531  switch (*pFormat) {
3532  case FC_BYTE:
3533  case FC_CHAR:
3534  case FC_SMALL:
3535  case FC_USMALL:
3536  size += 1;
3537  break;
3538  case FC_WCHAR:
3539  case FC_SHORT:
3540  case FC_USHORT:
3541  size += 2;
3542  break;
3543  case FC_LONG:
3544  case FC_ULONG:
3545  case FC_ENUM16:
3546  case FC_ENUM32:
3547  case FC_FLOAT:
3548  size += 4;
3549  break;
3550  case FC_INT3264:
3551  case FC_UINT3264:
3552  size += sizeof(INT_PTR);
3553  break;
3554  case FC_HYPER:
3555  case FC_DOUBLE:
3556  size += 8;
3557  break;
3558  case FC_RP:
3559  case FC_UP:
3560  case FC_OP:
3561  case FC_FP:
3562  case FC_POINTER:
3563  size += sizeof(void *);
3564  if (*pFormat != FC_POINTER)
3565  pFormat += 4;
3566  break;
3567  case FC_ALIGNM2:
3568  align_length(&size, 2);
3569  break;
3570  case FC_ALIGNM4:
3571  align_length(&size, 4);
3572  break;
3573  case FC_ALIGNM8:
3574  align_length(&size, 8);
3575  break;
3576  case FC_STRUCTPAD1:
3577  case FC_STRUCTPAD2:
3578  case FC_STRUCTPAD3:
3579  case FC_STRUCTPAD4:
3580  case FC_STRUCTPAD5:
3581  case FC_STRUCTPAD6:
3582  case FC_STRUCTPAD7:
3583  size += *pFormat - FC_STRUCTPAD1 + 1;
3584  break;
3585  case FC_EMBEDDED_COMPLEX:
3586  size += pFormat[1];
3587  pFormat += 2;
3588  desc = pFormat + *(const SHORT*)pFormat;
3589  size += EmbeddedComplexSize(pStubMsg, desc);
3590  pFormat += 2;
3591  continue;
3592  case FC_PAD:
3593  break;
3594  default:
3595  FIXME("unhandled format 0x%02x\n", *pFormat);
3596  }
3597  pFormat++;
3598  }
3599 
3600  return size;
3601 }
static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
int32_t INT_PTR
Definition: typedefs.h:62
static void align_length(ULONG *len, unsigned int align)
Definition: ndr_marshall.c:93
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
GLsizeiptr size
Definition: glext.h:5919
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned int ULONG
Definition: retypes.h:1

Referenced by array_memory_size(), array_read_conformance(), array_read_variance_and_unmarshall(), calc_arg_size(), NdrComplexStructBufferSize(), and NdrComplexStructMarshall().

◆ ComplexUnmarshall()

static unsigned char * ComplexUnmarshall ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
PFORMAT_STRING  pPointer,
unsigned char  fMustAlloc 
)
static

Definition at line 3004 of file ndr_marshall.c.

3009 {
3010  unsigned char *mem_base = pMemory;
3012  NDR_UNMARSHALL m;
3013  ULONG size;
3014 
3015  while (*pFormat != FC_END) {
3016  switch (*pFormat) {
3017  case FC_BYTE:
3018  case FC_CHAR:
3019  case FC_SMALL:
3020  case FC_USMALL:
3021  safe_copy_from_buffer(pStubMsg, pMemory, 1);
3022  TRACE("byte=%d => %p\n", *(WORD*)pMemory, pMemory);
3023  pMemory += 1;
3024  break;
3025  case FC_WCHAR:
3026  case FC_SHORT:
3027  case FC_USHORT:
3028  safe_copy_from_buffer(pStubMsg, pMemory, 2);
3029  TRACE("short=%d => %p\n", *(WORD*)pMemory, pMemory);
3030  pMemory += 2;
3031  break;
3032  case FC_ENUM16:
3033  {
3034  WORD val;
3035  safe_copy_from_buffer(pStubMsg, &val, 2);
3036  *(DWORD*)pMemory = val;
3037  TRACE("enum16=%d => %p\n", *(DWORD*)pMemory, pMemory);
3038  if (32767 < *(DWORD*)pMemory)
3040  pMemory += 4;
3041  break;
3042  }
3043  case FC_LONG:
3044  case FC_ULONG:
3045  case FC_ENUM32:
3046  safe_copy_from_buffer(pStubMsg, pMemory, 4);
3047  TRACE("long=%d => %p\n", *(DWORD*)pMemory, pMemory);
3048  pMemory += 4;
3049  break;
3050  case FC_INT3264:
3051  {
3052  INT val;
3053  safe_copy_from_buffer(pStubMsg, &val, 4);
3054  *(INT_PTR *)pMemory = val;
3055  TRACE("int3264=%ld => %p\n", *(INT_PTR*)pMemory, pMemory);
3056  pMemory += sizeof(INT_PTR);
3057  break;
3058  }
3059  case FC_UINT3264:
3060  {
3061  UINT val;
3062  safe_copy_from_buffer(pStubMsg, &val, 4);
3063  *(UINT_PTR *)pMemory = val;
3064  TRACE("uint3264=%ld => %p\n", *(UINT_PTR*)pMemory, pMemory);
3065  pMemory += sizeof(UINT_PTR);
3066  break;
3067  }
3068  case FC_FLOAT:
3069  safe_copy_from_buffer(pStubMsg, pMemory, sizeof(float));
3070  TRACE("float=%f => %p\n", *(float*)pMemory, pMemory);
3071  pMemory += sizeof(float);
3072  break;
3073  case FC_HYPER:
3074  safe_copy_from_buffer(pStubMsg, pMemory, 8);
3075  TRACE("longlong=%s => %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory);
3076  pMemory += 8;
3077  break;
3078  case FC_DOUBLE:
3079  safe_copy_from_buffer(pStubMsg, pMemory, sizeof(double));
3080  TRACE("double=%f => %p\n", *(double*)pMemory, pMemory);
3081  pMemory += sizeof(double);
3082  break;
3083  case FC_RP:
3084  case FC_UP:
3085  case FC_OP:
3086  case FC_FP:
3087  case FC_POINTER:
3088  {
3089  unsigned char *saved_buffer;
3090  BOOL pointer_buffer_mark_set = FALSE;
3091  TRACE("pointer => %p\n", pMemory);
3092  if (*pFormat != FC_POINTER)
3093  pPointer = pFormat;
3094  if (*pPointer != FC_RP)
3095  align_pointer(&pStubMsg->Buffer, 4);
3096  saved_buffer = pStubMsg->Buffer;
3097  if (pStubMsg->PointerBufferMark)
3098  {
3099  pStubMsg->Buffer = pStubMsg->PointerBufferMark;
3100  pStubMsg->PointerBufferMark = NULL;
3101  pointer_buffer_mark_set = TRUE;
3102  }
3103  else if (*pPointer != FC_RP)
3104  safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
3105 
3106  PointerUnmarshall(pStubMsg, saved_buffer, (unsigned char**)pMemory, *(unsigned char**)pMemory, pPointer, fMustAlloc);
3107  if (pointer_buffer_mark_set)
3108  {
3109  STD_OVERFLOW_CHECK(pStubMsg);
3110  pStubMsg->PointerBufferMark = pStubMsg->Buffer;
3111  pStubMsg->Buffer = saved_buffer;
3112  if (*pPointer != FC_RP)
3113  safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
3114  }
3115  if (*pFormat == FC_POINTER)
3116  pPointer += 4;
3117  else
3118  pFormat += 4;
3119  pMemory += sizeof(void *);
3120  break;
3121  }
3122  case FC_ALIGNM2:
3123  align_pointer_offset_clear(&pMemory, mem_base, 2);
3124  break;
3125  case FC_ALIGNM4:
3126  align_pointer_offset_clear(&pMemory, mem_base, 4);
3127  break;
3128  case FC_ALIGNM8:
3129  align_pointer_offset_clear(&pMemory, mem_base, 8);
3130  break;
3131  case FC_STRUCTPAD1:
3132  case FC_STRUCTPAD2:
3133  case FC_STRUCTPAD3:
3134  case FC_STRUCTPAD4:
3135  case FC_STRUCTPAD5:
3136  case FC_STRUCTPAD6:
3137  case FC_STRUCTPAD7:
3138  memset(pMemory, 0, *pFormat - FC_STRUCTPAD1 + 1);
3139  pMemory += *pFormat - FC_STRUCTPAD1 + 1;
3140  break;
3141  case FC_EMBEDDED_COMPLEX:
3142  pMemory += pFormat[1];
3143  pFormat += 2;
3144  desc = pFormat + *(const SHORT*)pFormat;
3145  size = EmbeddedComplexSize(pStubMsg, desc);
3146  TRACE("embedded complex (size=%d) => %p\n", size, pMemory);
3147  if (fMustAlloc)
3148  /* we can't pass fMustAlloc=TRUE into the marshaller for this type
3149  * since the type is part of the memory block that is encompassed by
3150  * the whole complex type. Memory is forced to allocate when pointers
3151  * are set to NULL, so we emulate that part of fMustAlloc=TRUE by
3152  * clearing the memory we pass in to the unmarshaller */
3153  memset(pMemory, 0, size);
3155  if (m)
3156  {
3157  /* for some reason interface pointers aren't generated as
3158  * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
3159  * they still need the dereferencing treatment that pointers are
3160  * given */
3161  if (*desc == FC_IP)
3162  m(pStubMsg, (unsigned char **)pMemory, desc, FALSE);
3163  else
3164  m(pStubMsg, &pMemory, desc, FALSE);
3165  }
3166  else FIXME("no unmarshaller for embedded type %02x\n", *desc);
3167  pMemory += size;
3168  pFormat += 2;
3169  continue;
3170  case FC_PAD:
3171  break;
3172  default:
3173  FIXME("unhandled format %d\n", *pFormat);
3174  }
3175  pFormat++;
3176  }
3177 
3178  return pMemory;
3179 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
#define TRUE
Definition: types.h:120
static void align_pointer_offset_clear(unsigned char **ptr, unsigned char *base, unsigned int align)
Definition: ndr_marshall.c:117
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
unsigned char * Buffer
Definition: rpcndr.h:203
int32_t INT_PTR
Definition: typedefs.h:62
unsigned char * PointerBufferMark
Definition: rpcndr.h:217
int32_t INT
Definition: typedefs.h:56
const GLfloat * m
Definition: glext.h:10848
static void align_pointer(unsigned char **ptr, unsigned int align)
Definition: ndr_marshall.c:98
unsigned int BOOL
Definition: ntddk_ex.h:94
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
const NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:219
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, unsigned char **pPointer, unsigned char *pSrcPointer, PFORMAT_STRING pFormat, unsigned char fMustAlloc)
Definition: ndr_marshall.c:886
uint64_t ULONGLONG
Definition: typedefs.h:65
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
static void safe_copy_from_buffer(MIDL_STUB_MESSAGE *pStubMsg, void *p, ULONG size)
Definition: ndr_marshall.c:737
#define RPC_X_ENUM_VALUE_OUT_OF_RANGE
Definition: winerror.h:1088
unsigned int UINT
Definition: ndis.h:50
unsigned char *(WINAPI * NDR_UNMARSHALL)(PMIDL_STUB_MESSAGE, unsigned char **, PFORMAT_STRING, unsigned char)
Definition: ndr_misc.h:54
static void safe_buffer_increment(MIDL_STUB_MESSAGE *pStubMsg, ULONG size)
Definition: ndr_marshall.c:716
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define STD_OVERFLOW_CHECK(_Msg)
Definition: ndr_marshall.c:124
#define memset(x, y, z)
Definition: compat.h:39
#define NDR_TABLE_MASK
Definition: ndr_marshall.c:133

Referenced by array_read_variance_and_unmarshall(), and NdrComplexStructUnmarshall().

◆ ComputeConformanceOrVariance()

PFORMAT_STRING ComputeConformanceOrVariance ( MIDL_STUB_MESSAGE pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat,
ULONG_PTR  def,
ULONG_PTR pCount 
)

Definition at line 559 of file ndr_marshall.c.

562 {
563  BYTE dtype = pFormat[0] & 0xf;
564  short ofs = *(const short *)&pFormat[2];
565  LPVOID ptr = NULL;
566  ULONG_PTR data = 0;
567 
568  if (!IsConformanceOrVariancePresent(pFormat)) {
569  /* null descriptor */
570  *pCount = def;
571  goto finish_conf;
572  }
573 
574  switch (pFormat[0] & 0xf0) {
576  TRACE("normal conformance, ofs=%d\n", ofs);
577  ptr = pMemory;
578  break;
580  TRACE("pointer conformance, ofs=%d\n", ofs);
581  ptr = pStubMsg->Memory;
582  break;
584  TRACE("toplevel conformance, ofs=%d\n", ofs);
585  if (pStubMsg->StackTop) {
586  ptr = pStubMsg->StackTop;
587  }
588  else {
589  /* -Os mode, *pCount is already set */
590  goto finish_conf;
591  }
592  break;
594  data = ofs | ((DWORD)pFormat[1] << 16);
595  TRACE("constant conformance, val=%ld\n", data);
596  *pCount = data;
597  goto finish_conf;
599  FIXME("toplevel multidimensional conformance, ofs=%d\n", ofs);
600  if (pStubMsg->StackTop) {
601  ptr = pStubMsg->StackTop;
602  }
603  else {
604  /* ? */
605  goto done_conf_grab;
606  }
607  break;
608  default:
609  FIXME("unknown conformance type %x, expect crash.\n", pFormat[0] & 0xf0);
610  goto finish_conf;
611  }
612 
613  switch (pFormat[1]) {
614  case FC_DEREFERENCE:
615  ptr = *(LPVOID*)((char *)ptr + ofs);
616  break;
617  case FC_CALLBACK:
618  {
619  unsigned char *old_stack_top = pStubMsg->StackTop;
620  ULONG_PTR max_count, old_max_count = pStubMsg->MaxCount;
621 
622  pStubMsg->StackTop = ptr;
623 
624  /* ofs is index into StubDesc->apfnExprEval */
625  TRACE("callback conformance into apfnExprEval[%d]\n", ofs);
626  pStubMsg->StubDesc->apfnExprEval[ofs](pStubMsg);
627 
628  pStubMsg->StackTop = old_stack_top;
629 
630  /* the callback function always stores the computed value in MaxCount */
631  max_count = pStubMsg->MaxCount;
632  pStubMsg->MaxCount = old_max_count;
633  *pCount = max_count;
634  goto finish_conf;
635  }
636  default:
637  ptr = (char *)ptr + ofs;
638  break;
639  }
640 
641  switch (dtype) {
642  case FC_LONG:
643  case FC_ULONG:
644  data = *(DWORD*)ptr;
645  break;
646  case FC_SHORT:
647  data = *(SHORT*)ptr;
648  break;
649  case FC_USHORT:
650  data = *(USHORT*)ptr;
651  break;
652  case FC_CHAR:
653  case FC_SMALL:
654  data = *(CHAR*)ptr;
655  break;
656  case FC_BYTE:
657  case FC_USMALL:
658  data = *(UCHAR*)ptr;
659  break;
660  case FC_HYPER:
661  data = *(ULONGLONG *)ptr;
662  break;
663  default:
664  FIXME("unknown conformance data type %x\n", dtype);
665  goto done_conf_grab;
666  }
667  TRACE("dereferenced data type %x at %p, got %ld\n", dtype, ptr, data);
668 
669 done_conf_grab:
670  switch (pFormat[1]) {
671  case FC_DEREFERENCE: /* already handled */
672  case 0: /* no op */
673  *pCount = data;
674  break;
675  case FC_ADD_1:
676  *pCount = data + 1;
677  break;
678  case FC_SUB_1:
679  *pCount = data - 1;
680  break;
681  case FC_MULT_2:
682  *pCount = data * 2;
683  break;
684  case FC_DIV_2:
685  *pCount = data / 2;
686  break;
687  default:
688  FIXME("unknown conformance op %d\n", pFormat[1]);
689  goto finish_conf;
690  }
691 
692 finish_conf:
693  TRACE("resulting conformance is %ld\n", *pCount);
694 
695  return SkipConformance(pStubMsg, pFormat);
696 }
#define FC_TOP_LEVEL_CONFORMANCE
Definition: ndrtypes.h:300
char CHAR
Definition: xmlstorage.h:175
const struct _MIDL_STUB_DESC * StubDesc
Definition: rpcndr.h:230
#define FC_TOP_LEVEL_MULTID_CONFORMANCE
Definition: ndrtypes.h:302
#define DWORD
Definition: nt_native.h:44
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define FC_NORMAL_CONFORMANCE
Definition: ndrtypes.h:298
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
unsigned char * Memory
Definition: rpcndr.h:209
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR MaxCount
Definition: rpcndr.h:221
uint64_t ULONGLONG
Definition: typedefs.h:65
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:466
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:471
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned char BYTE
Definition: mem.h:68
#define FC_CONSTANT_CONFORMANCE
Definition: ndrtypes.h:301
unsigned short USHORT
Definition: pedump.c:61
unsigned char * StackTop
Definition: rpcndr.h:226
#define FC_POINTER_CONFORMANCE
Definition: ndrtypes.h:299

Referenced by ComputeConformance(), and ComputeVariance().

◆ dump_pointer_attr()

static void dump_pointer_attr ( unsigned char  attr)
inlinestatic

Definition at line 798 of file ndr_marshall.c.

799 {
801  TRACE(" FC_ALLOCATE_ALL_NODES");
802  if (attr & FC_DONT_FREE)
803  TRACE(" FC_DONT_FREE");
805  TRACE(" FC_ALLOCED_ON_STACK");
806  if (attr & FC_SIMPLE_POINTER)
807  TRACE(" FC_SIMPLE_POINTER");
808  if (attr & FC_POINTER_DEREF)
809  TRACE(" FC_POINTER_DEREF");
810  TRACE("\n");
811 }
#define FC_POINTER_DEREF
Definition: ndrtypes.h:276
#define FC_ALLOCATE_ALL_NODES
Definition: ndrtypes.h:272
#define FC_ALLOCED_ON_STACK
Definition: ndrtypes.h:274
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cookie.c:170
#define FC_DONT_FREE
Definition: ndrtypes.h:273
#define FC_SIMPLE_POINTER
Definition: ndrtypes.h:275

Referenced by PointerBufferSize(), PointerFree(), PointerMarshall(), PointerMemorySize(), and PointerUnmarshall().

◆ EmbeddedComplexMemorySize()

static ULONG EmbeddedComplexMemorySize ( PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat 
)
static

Definition at line 2830 of file ndr_marshall.c.

2832 {
2834 
2835  if (!m)
2836  {
2837  FIXME("no memorysizer for data type=%02x\n", *pFormat);
2838  return 0;
2839  }
2840 
2841  return m(pStubMsg, pFormat);
2842 }
ULONG(WINAPI * NDR_MEMORYSIZE)(PMIDL_STUB_MESSAGE, PFORMAT_STRING)
Definition: ndr_misc.h:56
const GLfloat * m
Definition: glext.h:10848
#define FIXME(fmt,...)
Definition: debug.h:110
const NDR_MEMORYSIZE NdrMemorySizer[NDR_TABLE_SIZE]
Definition: ndr_marshall.c:307
#define NDR_TABLE_MASK
Definition: ndr_marshall.c:133

Referenced by ComplexStructMemorySize().

◆ EmbeddedComplexSize()

static ULONG EmbeddedComplexSize ( MIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING  pFormat 
)
static

Definition at line 2769 of file ndr_marshall.c.

2771 {
2772  switch (*pFormat) {
2773  case FC_STRUCT:
2774  case FC_PSTRUCT:
2775  case FC_CSTRUCT:
2776  case FC_BOGUS_STRUCT:
2777  case FC_SMFARRAY:
2778  case FC_SMVARRAY:
2779  case FC_CSTRING:
2780  return *(const WORD*)&pFormat[2];
2781  case FC_LGFARRAY:
2782  case FC_LGVARRAY:
2783  return *(const ULONG*)&pFormat[2];
2784  case FC_USER_MARSHAL:
2785  return *(const WORD*)&pFormat[4];
2786  case FC_RANGE: {
2787  switch (((const NDR_RANGE *)pFormat)->flags_type & 0xf) {
2788  case FC_BYTE:
2789  case FC_CHAR:
2790  case FC_SMALL:
2791  case FC_USMALL:
2792  return sizeof(UCHAR);
2793  case FC_WCHAR:
2794  case FC_SHORT:
2795  case FC_USHORT:
2796  return sizeof(USHORT);
2797  case FC_LONG:
2798  case FC_ULONG:
2799  case FC_ENUM32:
2800  return sizeof(ULONG);
2801  case FC_FLOAT:
2802  return sizeof(float);
2803  case FC_DOUBLE:
2804  return sizeof(double);
2805  case FC_HYPER:
2806  return sizeof(ULONGLONG);
2807  case FC_ENUM16:
2808  return sizeof(UINT);
2809  default:
2810  ERR("unknown type 0x%x\n", ((const NDR_RANGE *)pFormat)->flags_type & 0xf);
2812  }
2813  }
2815  pFormat += 2;
2816  pFormat = SkipConformance(pStubMsg, pFormat);
2817  pFormat += *(const SHORT*)pFormat;
2818  return *(const SHORT*)pFormat;
2819  case FC_IP:
2820  return sizeof(void *);
2821  case FC_WSTRING:
2822  return *(const WORD*)&pFormat[2] * 2;
2823  default:
2824  FIXME("unhandled embedded type %02x\n", *pFormat);
2825  }
2826  return 0;
2827 }
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:189
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
uint64_t ULONGLONG
Definition: typedefs.h:65
unsigned short WORD
Definition: ntddk_ex.h:93
static PFORMAT_STRING SkipConformance(const PMIDL_STUB_MESSAGE pStubMsg, const PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:471
unsigned char UCHAR
Definition: xmlstorage.h:181
#define ERR(fmt,...)
Definition: debug.h:109
unsigned short USHORT
Definition: pedump.c:61
unsigned int UINT
Definition: ndis.h:50
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
unsigned int ULONG
Definition: retypes.h:1

Referenced by ComplexBufferSize(), ComplexFree(), ComplexMarshall(), ComplexStructSize(), and ComplexUnmarshall().

◆ EmbeddedPointerBufferSize()

static void EmbeddedPointerBufferSize ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat 
)
static

Definition at line 1340 of file ndr_marshall.c.

1343 {
1344  unsigned rep, count, stride;
1345  unsigned i;
1346  ULONG saved_buffer_length = 0;
1347 
1348  TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1349 
1350  if (pStubMsg->IgnoreEmbeddedPointers) return;
1351 
1352  if (*pFormat != FC_PP) return;
1353  pFormat += 2;
1354 
1355  if (pStubMsg->PointerLength)
1356  {
1357  saved_buffer_length = pStubMsg->BufferLength;
1358  pStubMsg->BufferLength = pStubMsg->PointerLength;
1359  pStubMsg->PointerLength = 0;
1360  }
1361 
1362  while (pFormat[0] != FC_END) {
1363  switch (pFormat[0]) {
1364  default:
1365  FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
1366  /* fallthrough */
1367  case FC_NO_REPEAT:
1368  rep = 1;
1369  stride = 0;
1370  count = 1;
1371  pFormat += 2;
1372  break;
1373  case FC_FIXED_REPEAT:
1374  rep = *(const WORD*)&pFormat[2];
1375  stride = *(const WORD*)&pFormat[4];
1376  count = *(const WORD*)&pFormat[8];
1377  pFormat += 10;
1378  break;
1379  case FC_VARIABLE_REPEAT:
1380  rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
1381  stride = *(const WORD*)&pFormat[2];
1382  count = *(const WORD*)&pFormat[6];
1383  pFormat += 8;
1384  break;
1385  }
1386  for (i = 0; i < rep; i++) {
1387  PFORMAT_STRING info = pFormat;
1388  unsigned char *membase = pMemory + (i * stride);
1389  unsigned u;
1390 
1391  for (u=0; u<count; u++,info+=8) {
1392  unsigned char *memptr = membase + *(const SHORT*)&info[0];
1393  unsigned char *saved_memory = pStubMsg->Memory;
1394 
1395  pStubMsg->Memory = membase;
1396  PointerBufferSize(pStubMsg, *(unsigned char**)memptr, info+4);
1397  pStubMsg->Memory = saved_memory;
1398  }
1399  }
1400  pFormat += 8 * count;
1401  }
1402 
1403  if (saved_buffer_length)
1404  {
1405  pStubMsg->PointerLength = pStubMsg->BufferLength;
1406  pStubMsg->BufferLength = saved_buffer_length;
1407  }
1408 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Pointer, PFORMAT_STRING pFormat)
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int IgnoreEmbeddedPointers
Definition: rpcndr.h:216
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned char * Memory
Definition: rpcndr.h:209
ULONG ActualCount
Definition: rpcndr.h:223
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei stride
Definition: glext.h:5848
ULONG_PTR MaxCount
Definition: rpcndr.h:221
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned short WORD
Definition: ntddk_ex.h:93
ULONG BufferLength
Definition: rpcndr.h:207
unsigned int ULONG
Definition: retypes.h:1
ULONG PointerLength
Definition: rpcndr.h:233

Referenced by array_buffer_size(), NdrConformantStructBufferSize(), NdrConformantVaryingStructBufferSize(), NdrFixedArrayBufferSize(), NdrSimpleStructBufferSize(), and NdrVaryingArrayBufferSize().

◆ EmbeddedPointerFree()

static void EmbeddedPointerFree ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat 
)
static

Definition at line 1483 of file ndr_marshall.c.

1486 {
1487  unsigned rep, count, stride;
1488  unsigned i;
1489 
1490  TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1491  if (*pFormat != FC_PP) return;
1492  pFormat += 2;
1493 
1494  while (pFormat[0] != FC_END) {
1495  switch (pFormat[0]) {
1496  default:
1497  FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
1498  /* fallthrough */
1499  case FC_NO_REPEAT:
1500  rep = 1;
1501  stride = 0;
1502  count = 1;
1503  pFormat += 2;
1504  break;
1505  case FC_FIXED_REPEAT:
1506  rep = *(const WORD*)&pFormat[2];
1507  stride = *(const WORD*)&pFormat[4];
1508  count = *(const WORD*)&pFormat[8];
1509  pFormat += 10;
1510  break;
1511  case FC_VARIABLE_REPEAT:
1512  rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
1513  stride = *(const WORD*)&pFormat[2];
1514  count = *(const WORD*)&pFormat[6];
1515  pFormat += 8;
1516  break;
1517  }
1518  for (i = 0; i < rep; i++) {
1519  PFORMAT_STRING info = pFormat;
1520  unsigned char *membase = pMemory + (i * stride);
1521  unsigned u;
1522 
1523  for (u=0; u<count; u++,info+=8) {
1524  unsigned char *memptr = membase + *(const SHORT*)&info[0];
1525  unsigned char *saved_memory = pStubMsg->Memory;
1526 
1527  pStubMsg->Memory = membase;
1528  PointerFree(pStubMsg, *(unsigned char**)memptr, info+4);
1529  pStubMsg->Memory = saved_memory;
1530  }
1531  }
1532  pFormat += 8 * count;
1533  }
1534 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned char * Memory
Definition: rpcndr.h:209
ULONG ActualCount
Definition: rpcndr.h:223
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei stride
Definition: glext.h:5848
ULONG_PTR MaxCount
Definition: rpcndr.h:221
static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Pointer, PFORMAT_STRING pFormat)
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned short WORD
Definition: ntddk_ex.h:93

Referenced by array_free(), NdrConformantStructFree(), NdrConformantVaryingStructFree(), NdrFixedArrayFree(), NdrSimpleStructFree(), and NdrVaryingArrayFree().

◆ EmbeddedPointerMarshall()

static unsigned char* EmbeddedPointerMarshall ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pMemory,
PFORMAT_STRING  pFormat 
)
static

Definition at line 1180 of file ndr_marshall.c.

1183 {
1184  unsigned char *Mark = pStubMsg->BufferMark;
1185  unsigned rep, count, stride;
1186  unsigned i;
1187  unsigned char *saved_buffer = NULL;
1188 
1189  TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1190 
1191  if (*pFormat != FC_PP) return NULL;
1192  pFormat += 2;
1193 
1194  if (pStubMsg->PointerBufferMark)
1195  {
1196  saved_buffer = pStubMsg->Buffer;
1197  pStubMsg->Buffer = pStubMsg->PointerBufferMark;
1198  pStubMsg->PointerBufferMark = NULL;
1199  }
1200 
1201  while (pFormat[0] != FC_END) {
1202  switch (pFormat[0]) {
1203  default:
1204  FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
1205  /* fallthrough */
1206  case FC_NO_REPEAT:
1207  rep = 1;
1208  stride = 0;
1209  count = 1;
1210  pFormat += 2;
1211  break;
1212  case FC_FIXED_REPEAT:
1213  rep = *(const WORD*)&pFormat[2];
1214  stride = *(const WORD*)&pFormat[4];
1215  count = *(const WORD*)&pFormat[8];
1216  pFormat += 10;
1217  break;
1218  case FC_VARIABLE_REPEAT:
1219  rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
1220  stride = *(const WORD*)&pFormat[2];
1221  count = *(const WORD*)&pFormat[6];
1222  pFormat += 8;
1223  break;
1224  }
1225  for (i = 0; i < rep; i++) {
1226  PFORMAT_STRING info = pFormat;
1227  unsigned char *membase = pMemory + (i * stride);
1228  unsigned char *bufbase = Mark + (i * stride);
1229  unsigned u;
1230 
1231  for (u=0; u<count; u++,info+=8) {
1232  unsigned char *memptr = membase + *(const SHORT*)&info[0];
1233  unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
1234  unsigned char *saved_memory = pStubMsg->Memory;
1235 
1236  pStubMsg->Memory = membase;
1237  PointerMarshall(pStubMsg, bufptr, *(unsigned char**)memptr, info+4);
1238  pStubMsg->Memory = saved_memory;
1239  }
1240  }
1241  pFormat += 8 * count;
1242  }
1243 
1244  if (saved_buffer)
1245  {
1246  pStubMsg->PointerBufferMark = pStubMsg->Buffer;
1247  pStubMsg->Buffer = saved_buffer;
1248  }
1249 
1250  STD_OVERFLOW_CHECK(pStubMsg);
1251 
1252  return NULL;
1253 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned char * BufferMark
Definition: rpcndr.h:206
static unsigned int bufptr
Definition: tncon.cpp:77
GLuint GLuint GLsizei count
Definition: gl.h:1545
unsigned char * Buffer
Definition: rpcndr.h:203
unsigned char * PointerBufferMark
Definition: rpcndr.h:217
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned char * Memory
Definition: rpcndr.h:209
smooth NULL
Definition: ftsmooth.c:416
ULONG ActualCount
Definition: rpcndr.h:223
static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, unsigned char *Pointer, PFORMAT_STRING pFormat)
Definition: ndr_marshall.c:816
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei stride
Definition: glext.h:5848
ULONG_PTR MaxCount
Definition: rpcndr.h:221
static VOID Mark(PGUI_CONSOLE_DATA GuiData)
Definition: conwnd.c:289
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned short WORD
Definition: ntddk_ex.h:93
#define STD_OVERFLOW_CHECK(_Msg)
Definition: ndr_marshall.c:124

Referenced by array_write_variance_and_marshall(), NdrConformantStructMarshall(), NdrConformantVaryingStructMarshall(), NdrFixedArrayMarshall(), NdrSimpleStructMarshall(), and NdrVaryingArrayMarshall().

◆ EmbeddedPointerMemorySize()

static ULONG EmbeddedPointerMemorySize ( PMIDL_STUB_MESSAGE  pStubMsg,
PFORMAT_STRING  pFormat 
)
static

Definition at line 1413 of file ndr_marshall.c.

1415 {
1416  unsigned char *Mark = pStubMsg->BufferMark;
1417  unsigned rep, count, stride;
1418  unsigned i;
1419  unsigned char *saved_buffer = NULL;
1420 
1421  TRACE("(%p,%p)\n", pStubMsg, pFormat);
1422 
1423  if (pStubMsg->IgnoreEmbeddedPointers) return 0;
1424 
1425  if (pStubMsg->PointerBufferMark)
1426  {
1427  saved_buffer = pStubMsg->Buffer;
1428  pStubMsg->Buffer = pStubMsg->PointerBufferMark;
1429  pStubMsg->PointerBufferMark = NULL;
1430  }
1431 
1432  if (*pFormat != FC_PP) return 0;
1433  pFormat += 2;
1434 
1435  while (pFormat[0] != FC_END) {
1436  switch (pFormat[0]) {
1437  default:
1438  FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
1439  /* fallthrough */
1440  case FC_NO_REPEAT:
1441  rep = 1;
1442  stride = 0;
1443  count = 1;
1444  pFormat += 2;
1445  break;
1446  case FC_FIXED_REPEAT:
1447  rep = *(const WORD*)&pFormat[2];
1448  stride = *(const WORD*)&pFormat[4];
1449  count = *(const WORD*)&pFormat[8];
1450  pFormat += 10;
1451  break;
1452  case FC_VARIABLE_REPEAT:
1453  rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
1454  stride = *(const WORD*)&pFormat[2];
1455  count = *(const WORD*)&pFormat[6];
1456  pFormat += 8;
1457  break;
1458  }
1459  for (i = 0; i < rep; i++) {
1460  PFORMAT_STRING info = pFormat;
1461  unsigned char *bufbase = Mark + (i * stride);
1462  unsigned u;
1463  for (u=0; u<count; u++,info+=8) {
1464  unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
1465  PointerMemorySize(pStubMsg, bufptr, info+4);
1466  }
1467  }
1468  pFormat += 8 * count;
1469  }
1470 
1471  if (saved_buffer)
1472  {
1473  pStubMsg->PointerBufferMark = pStubMsg->Buffer;
1474  pStubMsg->Buffer = saved_buffer;
1475  }
1476 
1477  return 0;
1478 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
unsigned char * BufferMark
Definition: rpcndr.h:206
static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer, PFORMAT_STRING pFormat)
static unsigned int bufptr
Definition: tncon.cpp:77
GLuint GLuint GLsizei count
Definition: gl.h:1545
unsigned char * Buffer
Definition: rpcndr.h:203
unsigned char * PointerBufferMark
Definition: rpcndr.h:217
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int IgnoreEmbeddedPointers
Definition: rpcndr.h:216
short SHORT
Definition: pedump.c:59
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
ULONG ActualCount
Definition: rpcndr.h:223
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei stride
Definition: glext.h:5848
ULONG_PTR MaxCount
Definition: rpcndr.h:221
static VOID Mark(PGUI_CONSOLE_DATA GuiData)
Definition: conwnd.c:289
const unsigned char * PFORMAT_STRING
Definition: rpcndr.h:176
unsigned short WORD
Definition: ntddk_ex.h:93

Referenced by array_memory_size(), NdrConformantVaryingStructMemorySize(), NdrFixedArrayMemorySize(), NdrSimpleStructMemorySize(), and NdrVaryingArrayMemorySize().

◆ EmbeddedPointerUnmarshall()

static unsigned char* EmbeddedPointerUnmarshall ( PMIDL_STUB_MESSAGE  pStubMsg,
unsigned char pDstBuffer,
unsigned char pSrcMemoryPtrs,
PFORMAT_STRING  pFormat,
unsigned char  fMustAlloc 
)
static

Definition at line 1263 of file ndr_marshall.c.

1268 {
1269  unsigned char *Mark = pStubMsg->