NT3.51 returns ERROR_MORE_DATA.
[wine/multimedia.git] / dlls / rpcrt4 / ndr_marshall.c
blob62686dc2a2e8508caea6891405f203ef773163f2
1 /*
2 * NDR data marshalling
4 * Copyright 2002 Greg Turner
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * TODO:
21 * - figure out whether we *really* got this right
22 * - check for errors and throw exceptions
25 #include <stdarg.h>
26 #include <stdio.h>
27 #include <string.h>
28 #include <assert.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winerror.h"
33 #include "winreg.h"
35 #include "ndr_misc.h"
36 #include "rpcndr.h"
38 #include "wine/unicode.h"
39 #include "wine/rpcfc.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(ole);
45 #define BUFFER_PARANOIA 20
47 #if defined(__i386__)
48 # define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32) \
49 (*((UINT32 *)(pchar)) = (uint32))
51 # define LITTLE_ENDIAN_UINT32_READ(pchar) \
52 (*((UINT32 *)(pchar)))
53 #else
54 /* these would work for i386 too, but less efficient */
55 # define LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32) \
56 (*(pchar) = LOBYTE(LOWORD(uint32)), \
57 *((pchar)+1) = HIBYTE(LOWORD(uint32)), \
58 *((pchar)+2) = LOBYTE(HIWORD(uint32)), \
59 *((pchar)+3) = HIBYTE(HIWORD(uint32)), \
60 (uint32)) /* allow as r-value */
62 # define LITTLE_ENDIAN_UINT32_READ(pchar) \
63 (MAKELONG( \
64 MAKEWORD(*(pchar), *((pchar)+1)), \
65 MAKEWORD(*((pchar)+2), *((pchar)+3))))
66 #endif
68 #define BIG_ENDIAN_UINT32_WRITE(pchar, uint32) \
69 (*((pchar)+3) = LOBYTE(LOWORD(uint32)), \
70 *((pchar)+2) = HIBYTE(LOWORD(uint32)), \
71 *((pchar)+1) = LOBYTE(HIWORD(uint32)), \
72 *(pchar) = HIBYTE(HIWORD(uint32)), \
73 (uint32)) /* allow as r-value */
75 #define BIG_ENDIAN_UINT32_READ(pchar) \
76 (MAKELONG( \
77 MAKEWORD(*((pchar)+3), *((pchar)+2)), \
78 MAKEWORD(*((pchar)+1), *(pchar))))
80 #ifdef NDR_LOCAL_IS_BIG_ENDIAN
81 # define NDR_LOCAL_UINT32_WRITE(pchar, uint32) \
82 BIG_ENDIAN_UINT32_WRITE(pchar, uint32)
83 # define NDR_LOCAL_UINT32_READ(pchar) \
84 BIG_ENDIAN_UINT32_READ(pchar)
85 #else
86 # define NDR_LOCAL_UINT32_WRITE(pchar, uint32) \
87 LITTLE_ENDIAN_UINT32_WRITE(pchar, uint32)
88 # define NDR_LOCAL_UINT32_READ(pchar) \
89 LITTLE_ENDIAN_UINT32_READ(pchar)
90 #endif
92 /* _Align must be the desired alignment minus 1,
93 * e.g. ALIGN_LENGTH(len, 3) to align on a dword boundary. */
94 #define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
95 #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
96 #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
97 #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
99 #define STD_OVERFLOW_CHECK(_Msg) do { \
100 TRACE("buffer=%d/%ld\n", _Msg->Buffer - _Msg->BufferStart, _Msg->BufferLength); \
101 if (_Msg->Buffer > _Msg->BufferEnd) ERR("buffer overflow %d bytes\n", _Msg->Buffer - _Msg->BufferEnd); \
102 } while (0)
104 #define NDR_TABLE_SIZE 128
105 #define NDR_TABLE_MASK 127
107 NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = {
108 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0,
110 /* 0x10 */
112 /* 0x11 */
113 NdrPointerMarshall, NdrPointerMarshall,
114 NdrPointerMarshall, NdrPointerMarshall,
115 /* 0x15 */
116 NdrSimpleStructMarshall, NdrSimpleStructMarshall,
117 NdrConformantStructMarshall, NdrConformantStructMarshall,
118 NdrConformantVaryingStructMarshall,
119 NdrComplexStructMarshall,
120 /* 0x1b */
121 NdrConformantArrayMarshall,
122 NdrConformantVaryingArrayMarshall,
123 NdrFixedArrayMarshall, NdrFixedArrayMarshall,
124 NdrVaryingArrayMarshall, NdrVaryingArrayMarshall,
125 NdrComplexArrayMarshall,
126 /* 0x22 */
127 NdrConformantStringMarshall, 0, 0,
128 NdrConformantStringMarshall,
129 NdrNonConformantStringMarshall, 0, 0, 0,
130 /* 0x2a */
131 NdrEncapsulatedUnionMarshall,
132 NdrNonEncapsulatedUnionMarshall,
134 NdrXmitOrRepAsMarshall, NdrXmitOrRepAsMarshall,
135 /* 0x2f */
136 NdrInterfacePointerMarshall,
137 /* 0xb0 */
138 0, 0, 0, 0,
139 NdrUserMarshalMarshall
141 NDR_UNMARSHALL NdrUnmarshaller[NDR_TABLE_SIZE] = {
142 0, 0, 0, 0, 0, 0, 0, 0,
143 0, 0, 0, 0, 0, 0, 0, 0,
144 /* 0x10 */
146 /* 0x11 */
147 NdrPointerUnmarshall, NdrPointerUnmarshall,
148 NdrPointerUnmarshall, NdrPointerUnmarshall,
149 /* 0x15 */
150 NdrSimpleStructUnmarshall, NdrSimpleStructUnmarshall,
151 NdrConformantStructUnmarshall, NdrConformantStructUnmarshall,
152 NdrConformantVaryingStructUnmarshall,
153 NdrComplexStructUnmarshall,
154 /* 0x1b */
155 NdrConformantArrayUnmarshall,
156 NdrConformantVaryingArrayUnmarshall,
157 NdrFixedArrayUnmarshall, NdrFixedArrayUnmarshall,
158 NdrVaryingArrayUnmarshall, NdrVaryingArrayUnmarshall,
159 NdrComplexArrayUnmarshall,
160 /* 0x22 */
161 NdrConformantStringUnmarshall, 0, 0,
162 NdrConformantStringUnmarshall,
163 NdrNonConformantStringUnmarshall, 0, 0, 0,
164 /* 0x2a */
165 NdrEncapsulatedUnionUnmarshall,
166 NdrNonEncapsulatedUnionUnmarshall,
168 NdrXmitOrRepAsUnmarshall, NdrXmitOrRepAsUnmarshall,
169 /* 0x2f */
170 NdrInterfacePointerUnmarshall,
171 /* 0xb0 */
172 0, 0, 0, 0,
173 NdrUserMarshalUnmarshall
175 NDR_BUFFERSIZE NdrBufferSizer[NDR_TABLE_SIZE] = {
176 0, 0, 0, 0, 0, 0, 0, 0,
177 0, 0, 0, 0, 0, 0, 0, 0,
178 /* 0x10 */
180 /* 0x11 */
181 NdrPointerBufferSize, NdrPointerBufferSize,
182 NdrPointerBufferSize, NdrPointerBufferSize,
183 /* 0x15 */
184 NdrSimpleStructBufferSize, NdrSimpleStructBufferSize,
185 NdrConformantStructBufferSize, NdrConformantStructBufferSize,
186 NdrConformantVaryingStructBufferSize,
187 NdrComplexStructBufferSize,
188 /* 0x1b */
189 NdrConformantArrayBufferSize,
190 NdrConformantVaryingArrayBufferSize,
191 NdrFixedArrayBufferSize, NdrFixedArrayBufferSize,
192 NdrVaryingArrayBufferSize, NdrVaryingArrayBufferSize,
193 NdrComplexArrayBufferSize,
194 /* 0x22 */
195 NdrConformantStringBufferSize, 0, 0,
196 NdrConformantStringBufferSize,
197 NdrNonConformantStringBufferSize, 0, 0, 0,
198 /* 0x2a */
199 NdrEncapsulatedUnionBufferSize,
200 NdrNonEncapsulatedUnionBufferSize,
202 NdrXmitOrRepAsBufferSize, NdrXmitOrRepAsBufferSize,
203 /* 0x2f */
204 NdrInterfacePointerBufferSize,
205 /* 0xb0 */
206 0, 0, 0, 0,
207 NdrUserMarshalBufferSize
209 NDR_MEMORYSIZE NdrMemorySizer[NDR_TABLE_SIZE] = {
210 0, 0, 0, 0, 0, 0, 0, 0,
211 0, 0, 0, 0, 0, 0, 0, 0,
212 /* 0x10 */
214 /* 0x11 */
215 NdrPointerMemorySize, NdrPointerMemorySize,
216 NdrPointerMemorySize, NdrPointerMemorySize,
217 /* 0x15 */
218 NdrSimpleStructMemorySize, NdrSimpleStructMemorySize,
219 0, 0, 0,
220 NdrComplexStructMemorySize,
221 /* 0x1b */
222 NdrConformantArrayMemorySize, 0, 0, 0, 0, 0,
223 NdrComplexArrayMemorySize,
224 /* 0x22 */
225 NdrConformantStringMemorySize, 0, 0,
226 NdrConformantStringMemorySize,
227 NdrNonConformantStringMemorySize, 0, 0, 0,
228 /* 0x2a */
229 0, 0, 0, 0, 0,
230 /* 0x2f */
231 NdrInterfacePointerMemorySize,
232 /* 0xb0 */
233 0, 0, 0, 0,
234 NdrUserMarshalMemorySize
236 NDR_FREE NdrFreer[NDR_TABLE_SIZE] = {
237 0, 0, 0, 0, 0, 0, 0, 0,
238 0, 0, 0, 0, 0, 0, 0, 0,
239 /* 0x10 */
241 /* 0x11 */
242 NdrPointerFree, NdrPointerFree,
243 NdrPointerFree, NdrPointerFree,
244 /* 0x15 */
245 NdrSimpleStructFree, NdrSimpleStructFree,
246 NdrConformantStructFree, NdrConformantStructFree,
247 NdrConformantVaryingStructFree,
248 NdrComplexStructFree,
249 /* 0x1b */
250 NdrConformantArrayFree,
251 NdrConformantVaryingArrayFree,
252 NdrFixedArrayFree, NdrFixedArrayFree,
253 NdrVaryingArrayFree, NdrVaryingArrayFree,
254 NdrComplexArrayFree,
255 /* 0x22 */
256 0, 0, 0,
257 0, 0, 0, 0, 0,
258 /* 0x2a */
259 NdrEncapsulatedUnionFree,
260 NdrNonEncapsulatedUnionFree,
262 NdrXmitOrRepAsFree, NdrXmitOrRepAsFree,
263 /* 0x2f */
264 NdrInterfacePointerFree,
265 /* 0xb0 */
266 0, 0, 0, 0,
267 NdrUserMarshalFree
270 void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, size_t len)
272 /* hmm, this is probably supposed to do more? */
273 return pStubMsg->pfnAllocate(len);
276 static void WINAPI NdrFree(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *Pointer)
278 pStubMsg->pfnFree(Pointer);
281 PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
283 pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
284 pStubMsg->Buffer += 4;
285 TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount);
286 return pFormat+4;
289 PFORMAT_STRING ComputeConformance(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
290 PFORMAT_STRING pFormat, ULONG_PTR def)
292 BYTE dtype = pFormat[0] & 0xf;
293 DWORD ofs = (DWORD)pFormat[2] | ((DWORD)pFormat[3] << 8);
294 LPVOID ptr = NULL;
295 DWORD data = 0;
297 if (pFormat[0] == 0xff) {
298 /* null descriptor */
299 pStubMsg->MaxCount = def;
300 goto finish_conf;
303 switch (pFormat[0] & 0xf0) {
304 case RPC_FC_NORMAL_CONFORMANCE:
305 TRACE("normal conformance, ofs=%ld\n", ofs);
306 ptr = pMemory + ofs;
307 break;
308 case RPC_FC_POINTER_CONFORMANCE:
309 TRACE("pointer conformance, ofs=%ld\n", ofs);
310 ptr = pStubMsg->Memory + ofs;
311 break;
312 case RPC_FC_TOP_LEVEL_CONFORMANCE:
313 TRACE("toplevel conformance, ofs=%ld\n", ofs);
314 if (pStubMsg->StackTop) {
315 ptr = pStubMsg->StackTop + ofs;
317 else {
318 /* -Os mode, MaxCount is already set */
319 goto finish_conf;
321 break;
322 case RPC_FC_CONSTANT_CONFORMANCE:
323 data = ofs | ((DWORD)pFormat[1] << 16);
324 TRACE("constant conformance, val=%ld\n", data);
325 pStubMsg->MaxCount = data;
326 goto finish_conf;
327 case RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE:
328 FIXME("toplevel multidimensional conformance, ofs=%ld\n", ofs);
329 if (pStubMsg->StackTop) {
330 ptr = pStubMsg->StackTop + ofs;
332 else {
333 /* ? */
334 goto done_conf_grab;
336 break;
337 default:
338 FIXME("unknown conformance type %x\n", pFormat[0] & 0xf0);
341 switch (pFormat[1]) {
342 case RPC_FC_DEREFERENCE:
343 ptr = *(LPVOID*)ptr;
344 break;
345 case RPC_FC_CALLBACK:
346 /* ofs is index into StubDesc->apfnExprEval */
347 FIXME("handle callback\n");
348 goto finish_conf;
349 default:
350 break;
353 switch (dtype) {
354 case RPC_FC_LONG:
355 case RPC_FC_ULONG:
356 data = *(DWORD*)ptr;
357 break;
358 case RPC_FC_SHORT:
359 data = *(SHORT*)ptr;
360 break;
361 case RPC_FC_USHORT:
362 data = *(USHORT*)ptr;
363 break;
364 case RPC_FC_SMALL:
365 data = *(CHAR*)ptr;
366 break;
367 case RPC_FC_USMALL:
368 data = *(UCHAR*)ptr;
369 break;
370 default:
371 FIXME("unknown conformance data type %x\n", dtype);
372 goto done_conf_grab;
374 TRACE("dereferenced data type %x at %p, got %ld\n", dtype, ptr, data);
376 done_conf_grab:
377 switch (pFormat[1]) {
378 case 0: /* no op */
379 pStubMsg->MaxCount = data;
380 break;
381 case RPC_FC_DEREFERENCE:
382 /* already handled */
383 break;
384 default:
385 FIXME("unknown conformance op %d\n", pFormat[1]);
386 goto finish_conf;
389 finish_conf:
390 TRACE("resulting conformance is %ld\n", pStubMsg->MaxCount);
391 return pFormat+4;
396 * NdrConformantString:
398 * What MS calls a ConformantString is, in DCE terminology,
399 * a Varying-Conformant String.
401 * maxlen: DWORD (max # of CHARTYPE characters, inclusive of '\0')
402 * offset: DWORD (actual string data begins at (offset) CHARTYPE's
403 * into unmarshalled string)
404 * length: DWORD (# of CHARTYPE characters, inclusive of '\0')
405 * [
406 * data: CHARTYPE[maxlen]
407 * ]
408 * ], where CHARTYPE is the appropriate character type (specified externally)
412 /***********************************************************************
413 * NdrConformantStringMarshall [RPCRT4.@]
415 unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg,
416 unsigned char *pszMessage, PFORMAT_STRING pFormat)
418 unsigned long len, esize;
419 unsigned char *c;
421 TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat);
423 assert(pFormat);
424 if (*pFormat == RPC_FC_C_CSTRING) {
425 TRACE("string=%s\n", debugstr_a((char*)pszMessage));
426 len = strlen((char*)pszMessage)+1;
427 esize = 1;
429 else if (*pFormat == RPC_FC_C_WSTRING) {
430 TRACE("string=%s\n", debugstr_w((LPWSTR)pszMessage));
431 len = strlenW((LPWSTR)pszMessage)+1;
432 esize = 2;
434 else {
435 ERR("Unhandled string type: %#x\n", *pFormat);
436 /* FIXME: raise an exception. */
437 return NULL;
440 if (pFormat[1] != RPC_FC_PAD) {
441 FIXME("sized string format=%d\n", pFormat[1]);
444 assert( (pStubMsg->BufferLength >= (len*esize + 13)) && (pStubMsg->Buffer != NULL) );
446 c = pStubMsg->Buffer;
447 memset(c, 0, 12);
448 NDR_LOCAL_UINT32_WRITE(c, len); /* max length: strlen + 1 (for '\0') */
449 c += 8; /* offset: 0 */
450 NDR_LOCAL_UINT32_WRITE(c, len); /* actual length: (same) */
451 c += 4;
452 memcpy(c, pszMessage, len*esize); /* the string itself */
453 c += len*esize;
454 pStubMsg->Buffer = c;
456 STD_OVERFLOW_CHECK(pStubMsg);
458 /* success */
459 return NULL; /* is this always right? */
462 /***********************************************************************
463 * NdrConformantStringBufferSize [RPCRT4.@]
465 void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
466 unsigned char* pMemory, PFORMAT_STRING pFormat)
468 TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
470 assert(pFormat);
471 if (*pFormat == RPC_FC_C_CSTRING) {
472 /* we need 12 octets for the [maxlen, offset, len] DWORDS, + 1 octet for '\0' */
473 TRACE("string=%s\n", debugstr_a((char*)pMemory));
474 pStubMsg->BufferLength += strlen((char*)pMemory) + 13 + BUFFER_PARANOIA;
476 else if (*pFormat == RPC_FC_C_WSTRING) {
477 /* we need 12 octets for the [maxlen, offset, len] DWORDS, + 2 octets for L'\0' */
478 TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory));
479 pStubMsg->BufferLength += strlenW((LPWSTR)pMemory)*2 + 14 + BUFFER_PARANOIA;
481 else {
482 ERR("Unhandled string type: %#x\n", *pFormat);
483 /* FIXME: raise an exception */
486 if (pFormat[1] != RPC_FC_PAD) {
487 FIXME("sized string format=%d\n", pFormat[1]);
491 /************************************************************************
492 * NdrConformantStringMemorySize [RPCRT4.@]
494 unsigned long WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
495 PFORMAT_STRING pFormat )
497 unsigned long rslt = 0;
499 TRACE("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat);
501 assert(pStubMsg && pFormat);
503 if (*pFormat == RPC_FC_C_CSTRING) {
504 rslt = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); /* maxlen */
506 else if (*pFormat == RPC_FC_C_WSTRING) {
507 rslt = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer)*2; /* maxlen */
509 else {
510 ERR("Unhandled string type: %#x\n", *pFormat);
511 /* FIXME: raise an exception */
514 if (pFormat[1] != RPC_FC_PAD) {
515 FIXME("sized string format=%d\n", pFormat[1]);
518 TRACE(" --> %lu\n", rslt);
519 return rslt;
522 /************************************************************************
523 * NdrConformantStringUnmarshall [RPCRT4.@]
525 unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg,
526 unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc )
528 unsigned long len, esize, ofs;
529 unsigned char *pMem;
531 TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n",
532 pStubMsg, *ppMemory, pFormat, fMustAlloc);
534 assert(pFormat && ppMemory && pStubMsg);
536 pStubMsg->Buffer += 4;
537 ofs = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
538 pStubMsg->Buffer += 4;
539 len = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
540 pStubMsg->Buffer += 4;
542 if (*pFormat == RPC_FC_C_CSTRING) esize = 1;
543 else if (*pFormat == RPC_FC_C_WSTRING) esize = 2;
544 else {
545 ERR("Unhandled string type: %#x\n", *pFormat);
546 /* FIXME: raise an exception */
547 esize = 0;
550 if (pFormat[1] != RPC_FC_PAD) {
551 FIXME("sized string format=%d\n", pFormat[1]);
554 if (fMustAlloc) {
555 *ppMemory = NdrAllocate(pStubMsg, len*esize + BUFFER_PARANOIA);
556 } else {
557 if (pStubMsg->ReuseBuffer && !*ppMemory)
558 /* for servers, we may just point straight into the RPC buffer, I think
559 * (I guess that's what MS does since MIDL code doesn't try to free) */
560 *ppMemory = pStubMsg->Buffer - ofs*esize;
561 /* for clients, memory should be provided by caller */
564 pMem = *ppMemory + ofs*esize;
566 if (pMem != pStubMsg->Buffer)
567 memcpy(pMem, pStubMsg->Buffer, len*esize);
569 pStubMsg->Buffer += len*esize;
571 if (*pFormat == RPC_FC_C_CSTRING) {
572 TRACE("string=%s\n", debugstr_a((char*)pMem));
574 else if (*pFormat == RPC_FC_C_WSTRING) {
575 TRACE("string=%s\n", debugstr_w((LPWSTR)pMem));
578 return NULL; /* FIXME: is this always right? */
581 /***********************************************************************
582 * NdrNonConformantStringMarshall [RPCRT4.@]
584 unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubMsg,
585 unsigned char *pMemory,
586 PFORMAT_STRING pFormat)
588 FIXME("stub\n");
589 return NULL;
592 /***********************************************************************
593 * NdrNonConformantStringUnmarshall [RPCRT4.@]
595 unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
596 unsigned char **ppMemory,
597 PFORMAT_STRING pFormat,
598 unsigned char fMustAlloc)
600 FIXME("stub\n");
601 return NULL;
604 /***********************************************************************
605 * NdrNonConformantStringBufferSize [RPCRT4.@]
607 void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
608 unsigned char *pMemory,
609 PFORMAT_STRING pFormat)
611 FIXME("stub\n");
614 /***********************************************************************
615 * NdrNonConformantStringMemorySize [RPCRT4.@]
617 unsigned long WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
618 PFORMAT_STRING pFormat)
620 FIXME("stub\n");
621 return 0;
624 static inline void dump_pointer_attr(unsigned char attr)
626 if (attr & RPC_FC_P_ALLOCALLNODES)
627 TRACE(" RPC_FC_P_ALLOCALLNODES");
628 if (attr & RPC_FC_P_DONTFREE)
629 TRACE(" RPC_FC_P_DONTFREE");
630 if (attr & RPC_FC_P_ONSTACK)
631 TRACE(" RPC_FC_P_ONSTACK");
632 if (attr & RPC_FC_P_SIMPLEPOINTER)
633 TRACE(" RPC_FC_P_SIMPLEPOINTER");
634 if (attr & RPC_FC_P_DEREF)
635 TRACE(" RPC_FC_P_DEREF");
636 TRACE("\n");
639 /***********************************************************************
640 * PointerMarshall
642 void WINAPI PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
643 unsigned char *Buffer,
644 unsigned char *Pointer,
645 PFORMAT_STRING pFormat)
647 unsigned type = pFormat[0], attr = pFormat[1];
648 PFORMAT_STRING desc;
649 NDR_MARSHALL m;
651 TRACE("(%p,%p,%p,%p)\n", pStubMsg, Buffer, Pointer, pFormat);
652 TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
653 pFormat += 2;
654 if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
655 else desc = pFormat + *(const SHORT*)pFormat;
656 if (attr & RPC_FC_P_DEREF) {
657 Pointer = *(unsigned char**)Pointer;
658 TRACE("deref => %p\n", Pointer);
661 switch (type) {
662 case RPC_FC_RP: /* ref pointer (always non-null) */
663 #if 0 /* this causes problems for InstallShield so is disabled - we need more tests */
664 if (!Pointer)
665 RpcRaiseException(RPC_X_NULL_REF_POINTER);
666 #endif
667 break;
668 case RPC_FC_UP: /* unique pointer */
669 case RPC_FC_OP: /* object pointer - same as unique here */
670 TRACE("writing %p to buffer\n", Pointer);
671 NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, (unsigned long)Pointer);
672 pStubMsg->Buffer += 4;
673 break;
674 case RPC_FC_FP:
675 default:
676 FIXME("unhandled ptr type=%02x\n", type);
677 RpcRaiseException(RPC_X_BAD_STUB_DATA);
680 TRACE("calling marshaller for type 0x%x\n", (int)*desc);
682 if (Pointer) {
683 m = NdrMarshaller[*desc & NDR_TABLE_MASK];
684 if (m) m(pStubMsg, Pointer, desc);
685 else FIXME("no marshaller for data type=%02x\n", *desc);
688 STD_OVERFLOW_CHECK(pStubMsg);
691 /***********************************************************************
692 * PointerUnmarshall
694 void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
695 unsigned char *Buffer,
696 unsigned char **pPointer,
697 PFORMAT_STRING pFormat,
698 unsigned char fMustAlloc)
700 unsigned type = pFormat[0], attr = pFormat[1];
701 PFORMAT_STRING desc;
702 NDR_UNMARSHALL m;
703 DWORD pointer_id = 0;
705 TRACE("(%p,%p,%p,%p,%d)\n", pStubMsg, Buffer, pPointer, pFormat, fMustAlloc);
706 TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
707 pFormat += 2;
708 if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
709 else desc = pFormat + *(const SHORT*)pFormat;
710 if (attr & RPC_FC_P_DEREF) {
711 pPointer = *(unsigned char***)pPointer;
712 TRACE("deref => %p\n", pPointer);
715 switch (type) {
716 case RPC_FC_RP: /* ref pointer (always non-null) */
717 pointer_id = ~0UL;
718 break;
719 case RPC_FC_UP: /* unique pointer */
720 pointer_id = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
721 pStubMsg->Buffer += 4;
722 break;
723 case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
724 pointer_id = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
725 pStubMsg->Buffer += 4;
726 if (*pPointer)
727 FIXME("free object pointer %p\n", *pPointer);
728 break;
729 case RPC_FC_FP:
730 default:
731 FIXME("unhandled ptr type=%02x\n", type);
732 RpcRaiseException(RPC_X_BAD_STUB_DATA);
735 *pPointer = NULL;
737 if (pointer_id) {
738 m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
739 if (m) m(pStubMsg, pPointer, desc, fMustAlloc);
740 else FIXME("no unmarshaller for data type=%02x\n", *desc);
743 TRACE("pointer=%p\n", *pPointer);
746 /***********************************************************************
747 * PointerBufferSize
749 void WINAPI PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
750 unsigned char *Pointer,
751 PFORMAT_STRING pFormat)
753 unsigned type = pFormat[0], attr = pFormat[1];
754 PFORMAT_STRING desc;
755 NDR_BUFFERSIZE m;
757 TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
758 TRACE("type=%d, attr=%d\n", type, attr);
759 pFormat += 2;
760 if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
761 else desc = pFormat + *(const SHORT*)pFormat;
762 if (attr & RPC_FC_P_DEREF) {
763 Pointer = *(unsigned char**)Pointer;
764 TRACE("deref => %p\n", Pointer);
767 switch (type) {
768 case RPC_FC_RP: /* ref pointer (always non-null) */
769 break;
770 case RPC_FC_OP:
771 case RPC_FC_UP:
772 pStubMsg->BufferLength += 4;
773 /* NULL pointer has no further representation */
774 if (!Pointer)
775 return;
776 break;
777 case RPC_FC_FP:
778 default:
779 FIXME("unhandled ptr type=%02x\n", type);
780 RpcRaiseException(RPC_X_BAD_STUB_DATA);
783 m = NdrBufferSizer[*desc & NDR_TABLE_MASK];
784 if (m) m(pStubMsg, Pointer, desc);
785 else FIXME("no buffersizer for data type=%02x\n", *desc);
788 /***********************************************************************
789 * PointerMemorySize [RPCRT4.@]
791 unsigned long WINAPI PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
792 unsigned char *Buffer,
793 PFORMAT_STRING pFormat)
795 unsigned type = pFormat[0], attr = pFormat[1];
796 PFORMAT_STRING desc;
797 NDR_MEMORYSIZE m;
799 FIXME("(%p,%p,%p): stub\n", pStubMsg, Buffer, pFormat);
800 TRACE("type=%d, attr=", type); dump_pointer_attr(attr);
801 pFormat += 2;
802 if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
803 else desc = pFormat + *(const SHORT*)pFormat;
804 if (attr & RPC_FC_P_DEREF) {
805 TRACE("deref\n");
808 switch (type) {
809 case RPC_FC_RP: /* ref pointer (always non-null) */
810 break;
811 default:
812 FIXME("unhandled ptr type=%02x\n", type);
813 RpcRaiseException(RPC_X_BAD_STUB_DATA);
816 m = NdrMemorySizer[*desc & NDR_TABLE_MASK];
817 if (m) m(pStubMsg, desc);
818 else FIXME("no memorysizer for data type=%02x\n", *desc);
820 return 0;
823 /***********************************************************************
824 * PointerFree [RPCRT4.@]
826 void WINAPI PointerFree(PMIDL_STUB_MESSAGE pStubMsg,
827 unsigned char *Pointer,
828 PFORMAT_STRING pFormat)
830 unsigned type = pFormat[0], attr = pFormat[1];
831 PFORMAT_STRING desc;
832 NDR_FREE m;
834 TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
835 TRACE("type=%d, attr=", type); dump_pointer_attr(attr);
836 if (attr & RPC_FC_P_DONTFREE) return;
837 pFormat += 2;
838 if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
839 else desc = pFormat + *(const SHORT*)pFormat;
840 if (attr & RPC_FC_P_DEREF) {
841 Pointer = *(unsigned char**)Pointer;
842 TRACE("deref => %p\n", Pointer);
845 if (!Pointer) return;
847 m = NdrFreer[*desc & NDR_TABLE_MASK];
848 if (m) m(pStubMsg, Pointer, desc);
850 /* hmm... is this sensible?
851 * perhaps we should check if the memory comes from NdrAllocate,
852 * and deallocate only if so - checking if the pointer is between
853 * BufferStart and BufferEnd is probably no good since the buffer
854 * may be reallocated when the server wants to marshal the reply */
855 switch (*desc) {
856 case RPC_FC_BOGUS_STRUCT:
857 case RPC_FC_BOGUS_ARRAY:
858 case RPC_FC_USER_MARSHAL:
859 break;
860 default:
861 FIXME("unhandled data type=%02x\n", *desc);
862 case RPC_FC_CARRAY:
863 case RPC_FC_C_CSTRING:
864 case RPC_FC_C_WSTRING:
865 if (pStubMsg->ReuseBuffer) goto notfree;
866 break;
867 case RPC_FC_IP:
868 goto notfree;
871 if (attr & RPC_FC_P_ONSTACK) {
872 TRACE("not freeing stack ptr %p\n", Pointer);
873 return;
875 TRACE("freeing %p\n", Pointer);
876 NdrFree(pStubMsg, Pointer);
877 return;
878 notfree:
879 TRACE("not freeing %p\n", Pointer);
882 /***********************************************************************
883 * EmbeddedPointerMarshall
885 unsigned char * WINAPI EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
886 unsigned char *pMemory,
887 PFORMAT_STRING pFormat)
889 unsigned char *Mark = pStubMsg->BufferMark;
890 unsigned long Offset = pStubMsg->Offset;
891 unsigned ofs, rep, count, stride, xofs;
893 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
895 if (*pFormat != RPC_FC_PP) return NULL;
896 pFormat += 2;
898 while (pFormat[0] != RPC_FC_END) {
899 switch (pFormat[0]) {
900 default:
901 FIXME("unknown repeat type %d\n", pFormat[0]);
902 case RPC_FC_NO_REPEAT:
903 rep = 1;
904 stride = 0;
905 ofs = 0;
906 count = 1;
907 xofs = 0;
908 pFormat += 2;
909 break;
910 case RPC_FC_FIXED_REPEAT:
911 rep = *(const WORD*)&pFormat[2];
912 stride = *(const WORD*)&pFormat[4];
913 ofs = *(const WORD*)&pFormat[6];
914 count = *(const WORD*)&pFormat[8];
915 xofs = 0;
916 pFormat += 10;
917 break;
918 case RPC_FC_VARIABLE_REPEAT:
919 rep = pStubMsg->MaxCount;
920 stride = *(const WORD*)&pFormat[2];
921 ofs = *(const WORD*)&pFormat[4];
922 count = *(const WORD*)&pFormat[6];
923 xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
924 pFormat += 8;
925 break;
927 /* ofs doesn't seem to matter in this context */
928 while (rep) {
929 PFORMAT_STRING info = pFormat;
930 unsigned char *membase = pMemory + xofs;
931 unsigned u;
932 for (u=0; u<count; u++,info+=8) {
933 unsigned char *memptr = membase + *(const SHORT*)&info[0];
934 unsigned char *bufptr = Mark + *(const SHORT*)&info[2];
935 PointerMarshall(pStubMsg, bufptr, *(unsigned char**)memptr, info+4);
937 rep--;
939 pFormat += 8 * count;
942 STD_OVERFLOW_CHECK(pStubMsg);
944 return NULL;
947 /***********************************************************************
948 * EmbeddedPointerUnmarshall
950 unsigned char * WINAPI EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
951 unsigned char **ppMemory,
952 PFORMAT_STRING pFormat,
953 unsigned char fMustAlloc)
955 unsigned char *Mark = pStubMsg->BufferMark;
956 unsigned long Offset = pStubMsg->Offset;
957 unsigned ofs, rep, count, stride, xofs;
959 TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
961 if (*pFormat != RPC_FC_PP) return NULL;
962 pFormat += 2;
964 while (pFormat[0] != RPC_FC_END) {
965 switch (pFormat[0]) {
966 default:
967 FIXME("unknown repeat type %d\n", pFormat[0]);
968 case RPC_FC_NO_REPEAT:
969 rep = 1;
970 stride = 0;
971 ofs = 0;
972 count = 1;
973 xofs = 0;
974 pFormat += 2;
975 break;
976 case RPC_FC_FIXED_REPEAT:
977 rep = *(const WORD*)&pFormat[2];
978 stride = *(const WORD*)&pFormat[4];
979 ofs = *(const WORD*)&pFormat[6];
980 count = *(const WORD*)&pFormat[8];
981 xofs = 0;
982 pFormat += 10;
983 break;
984 case RPC_FC_VARIABLE_REPEAT:
985 rep = pStubMsg->MaxCount;
986 stride = *(const WORD*)&pFormat[2];
987 ofs = *(const WORD*)&pFormat[4];
988 count = *(const WORD*)&pFormat[6];
989 xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
990 pFormat += 8;
991 break;
993 /* ofs doesn't seem to matter in this context */
994 while (rep) {
995 PFORMAT_STRING info = pFormat;
996 unsigned char *membase = *ppMemory + xofs;
997 unsigned u;
998 for (u=0; u<count; u++,info+=8) {
999 unsigned char *memptr = membase + *(const SHORT*)&info[0];
1000 unsigned char *bufptr = Mark + *(const SHORT*)&info[2];
1001 PointerUnmarshall(pStubMsg, bufptr, (unsigned char**)memptr, info+4, fMustAlloc);
1003 rep--;
1005 pFormat += 8 * count;
1008 return NULL;
1011 /***********************************************************************
1012 * EmbeddedPointerBufferSize
1014 void WINAPI EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
1015 unsigned char *pMemory,
1016 PFORMAT_STRING pFormat)
1018 unsigned long Offset = pStubMsg->Offset;
1019 unsigned ofs, rep, count, stride, xofs;
1021 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1022 if (*pFormat != RPC_FC_PP) return;
1023 pFormat += 2;
1025 while (pFormat[0] != RPC_FC_END) {
1026 switch (pFormat[0]) {
1027 default:
1028 FIXME("unknown repeat type %d\n", pFormat[0]);
1029 case RPC_FC_NO_REPEAT:
1030 rep = 1;
1031 stride = 0;
1032 ofs = 0;
1033 count = 1;
1034 xofs = 0;
1035 pFormat += 2;
1036 break;
1037 case RPC_FC_FIXED_REPEAT:
1038 rep = *(const WORD*)&pFormat[2];
1039 stride = *(const WORD*)&pFormat[4];
1040 ofs = *(const WORD*)&pFormat[6];
1041 count = *(const WORD*)&pFormat[8];
1042 xofs = 0;
1043 pFormat += 10;
1044 break;
1045 case RPC_FC_VARIABLE_REPEAT:
1046 rep = pStubMsg->MaxCount;
1047 stride = *(const WORD*)&pFormat[2];
1048 ofs = *(const WORD*)&pFormat[4];
1049 count = *(const WORD*)&pFormat[6];
1050 xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
1051 pFormat += 8;
1052 break;
1054 /* ofs doesn't seem to matter in this context */
1055 while (rep) {
1056 PFORMAT_STRING info = pFormat;
1057 unsigned char *membase = pMemory + xofs;
1058 unsigned u;
1059 for (u=0; u<count; u++,info+=8) {
1060 unsigned char *memptr = membase + *(const SHORT*)&info[0];
1061 PointerBufferSize(pStubMsg, *(unsigned char**)memptr, info+4);
1063 rep--;
1065 pFormat += 8 * count;
1069 /***********************************************************************
1070 * EmbeddedPointerMemorySize
1072 unsigned long WINAPI EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
1073 PFORMAT_STRING pFormat)
1075 unsigned long Offset = pStubMsg->Offset;
1076 unsigned char *Mark = pStubMsg->BufferMark;
1077 unsigned ofs, rep, count, stride, xofs;
1079 FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
1080 if (*pFormat != RPC_FC_PP) return 0;
1081 pFormat += 2;
1083 while (pFormat[0] != RPC_FC_END) {
1084 switch (pFormat[0]) {
1085 default:
1086 FIXME("unknown repeat type %d\n", pFormat[0]);
1087 case RPC_FC_NO_REPEAT:
1088 rep = 1;
1089 stride = 0;
1090 ofs = 0;
1091 count = 1;
1092 xofs = 0;
1093 pFormat += 2;
1094 break;
1095 case RPC_FC_FIXED_REPEAT:
1096 rep = *(const WORD*)&pFormat[2];
1097 stride = *(const WORD*)&pFormat[4];
1098 ofs = *(const WORD*)&pFormat[6];
1099 count = *(const WORD*)&pFormat[8];
1100 xofs = 0;
1101 pFormat += 10;
1102 break;
1103 case RPC_FC_VARIABLE_REPEAT:
1104 rep = pStubMsg->MaxCount;
1105 stride = *(const WORD*)&pFormat[2];
1106 ofs = *(const WORD*)&pFormat[4];
1107 count = *(const WORD*)&pFormat[6];
1108 xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
1109 pFormat += 8;
1110 break;
1112 /* ofs doesn't seem to matter in this context */
1113 while (rep) {
1114 PFORMAT_STRING info = pFormat;
1115 unsigned u;
1116 for (u=0; u<count; u++,info+=8) {
1117 unsigned char *bufptr = Mark + *(const SHORT*)&info[2];
1118 PointerMemorySize(pStubMsg, bufptr, info+4);
1120 rep--;
1122 pFormat += 8 * count;
1125 return 0;
1128 /***********************************************************************
1129 * EmbeddedPointerFree
1131 void WINAPI EmbeddedPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
1132 unsigned char *pMemory,
1133 PFORMAT_STRING pFormat)
1135 unsigned long Offset = pStubMsg->Offset;
1136 unsigned ofs, rep, count, stride, xofs;
1138 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1139 if (*pFormat != RPC_FC_PP) return;
1140 pFormat += 2;
1142 while (pFormat[0] != RPC_FC_END) {
1143 switch (pFormat[0]) {
1144 default:
1145 FIXME("unknown repeat type %d\n", pFormat[0]);
1146 case RPC_FC_NO_REPEAT:
1147 rep = 1;
1148 stride = 0;
1149 ofs = 0;
1150 count = 1;
1151 xofs = 0;
1152 pFormat += 2;
1153 break;
1154 case RPC_FC_FIXED_REPEAT:
1155 rep = *(const WORD*)&pFormat[2];
1156 stride = *(const WORD*)&pFormat[4];
1157 ofs = *(const WORD*)&pFormat[6];
1158 count = *(const WORD*)&pFormat[8];
1159 xofs = 0;
1160 pFormat += 10;
1161 break;
1162 case RPC_FC_VARIABLE_REPEAT:
1163 rep = pStubMsg->MaxCount;
1164 stride = *(const WORD*)&pFormat[2];
1165 ofs = *(const WORD*)&pFormat[4];
1166 count = *(const WORD*)&pFormat[6];
1167 xofs = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? Offset * stride : 0;
1168 pFormat += 8;
1169 break;
1171 /* ofs doesn't seem to matter in this context */
1172 while (rep) {
1173 PFORMAT_STRING info = pFormat;
1174 unsigned char *membase = pMemory + xofs;
1175 unsigned u;
1176 for (u=0; u<count; u++,info+=8) {
1177 unsigned char *memptr = membase + *(const SHORT*)&info[0];
1178 PointerFree(pStubMsg, *(unsigned char**)memptr, info+4);
1180 rep--;
1182 pFormat += 8 * count;
1186 /***********************************************************************
1187 * NdrPointerMarshall [RPCRT4.@]
1189 unsigned char * WINAPI NdrPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
1190 unsigned char *pMemory,
1191 PFORMAT_STRING pFormat)
1193 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1195 pStubMsg->BufferMark = pStubMsg->Buffer;
1196 PointerMarshall(pStubMsg, pStubMsg->Buffer, pMemory, pFormat);
1198 STD_OVERFLOW_CHECK(pStubMsg);
1200 return NULL;
1203 /***********************************************************************
1204 * NdrPointerUnmarshall [RPCRT4.@]
1206 unsigned char * WINAPI NdrPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
1207 unsigned char **ppMemory,
1208 PFORMAT_STRING pFormat,
1209 unsigned char fMustAlloc)
1211 TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
1213 pStubMsg->BufferMark = pStubMsg->Buffer;
1214 PointerUnmarshall(pStubMsg, pStubMsg->Buffer, ppMemory, pFormat, fMustAlloc);
1216 return NULL;
1219 /***********************************************************************
1220 * NdrPointerBufferSize [RPCRT4.@]
1222 void WINAPI NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
1223 unsigned char *pMemory,
1224 PFORMAT_STRING pFormat)
1226 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1227 PointerBufferSize(pStubMsg, pMemory, pFormat);
1230 /***********************************************************************
1231 * NdrPointerMemorySize [RPCRT4.@]
1233 unsigned long WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
1234 PFORMAT_STRING pFormat)
1236 /* unsigned size = *(LPWORD)(pFormat+2); */
1237 FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
1238 PointerMemorySize(pStubMsg, pStubMsg->Buffer, pFormat);
1239 return 0;
1242 /***********************************************************************
1243 * NdrPointerFree [RPCRT4.@]
1245 void WINAPI NdrPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
1246 unsigned char *pMemory,
1247 PFORMAT_STRING pFormat)
1249 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1250 PointerFree(pStubMsg, pMemory, pFormat);
1253 /***********************************************************************
1254 * NdrSimpleStructMarshall [RPCRT4.@]
1256 unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
1257 unsigned char *pMemory,
1258 PFORMAT_STRING pFormat)
1260 unsigned size = *(const WORD*)(pFormat+2);
1261 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1263 memcpy(pStubMsg->Buffer, pMemory, size);
1264 pStubMsg->BufferMark = pStubMsg->Buffer;
1265 pStubMsg->Buffer += size;
1267 if (pFormat[0] != RPC_FC_STRUCT)
1268 EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat+4);
1270 STD_OVERFLOW_CHECK(pStubMsg);
1272 return NULL;
1275 /***********************************************************************
1276 * NdrSimpleStructUnmarshall [RPCRT4.@]
1278 unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
1279 unsigned char **ppMemory,
1280 PFORMAT_STRING pFormat,
1281 unsigned char fMustAlloc)
1283 unsigned size = *(const WORD*)(pFormat+2);
1284 TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
1286 if (fMustAlloc) {
1287 *ppMemory = NdrAllocate(pStubMsg, size);
1288 memcpy(*ppMemory, pStubMsg->Buffer, size);
1289 } else {
1290 if (pStubMsg->ReuseBuffer && !*ppMemory)
1291 /* for servers, we may just point straight into the RPC buffer, I think
1292 * (I guess that's what MS does since MIDL code doesn't try to free) */
1293 *ppMemory = pStubMsg->Buffer;
1294 else
1295 /* for clients, memory should be provided by caller */
1296 memcpy(*ppMemory, pStubMsg->Buffer, size);
1299 pStubMsg->BufferMark = pStubMsg->Buffer;
1300 pStubMsg->Buffer += size;
1302 if (pFormat[0] != RPC_FC_STRUCT)
1303 EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat+4, fMustAlloc);
1305 return NULL;
1309 /***********************************************************************
1310 * NdrSimpleStructUnmarshall [RPCRT4.@]
1312 void WINAPI NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory,
1313 unsigned char FormatChar )
1315 FIXME("stub\n");
1319 /***********************************************************************
1320 * NdrSimpleStructUnmarshall [RPCRT4.@]
1322 void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory,
1323 unsigned char FormatChar )
1325 FIXME("stub\n");
1329 /***********************************************************************
1330 * NdrSimpleStructBufferSize [RPCRT4.@]
1332 void WINAPI NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
1333 unsigned char *pMemory,
1334 PFORMAT_STRING pFormat)
1336 unsigned size = *(const WORD*)(pFormat+2);
1337 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1338 pStubMsg->BufferLength += size;
1339 if (pFormat[0] != RPC_FC_STRUCT)
1340 EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat+4);
1343 /***********************************************************************
1344 * NdrSimpleStructMemorySize [RPCRT4.@]
1346 unsigned long WINAPI NdrSimpleStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
1347 PFORMAT_STRING pFormat)
1349 /* unsigned size = *(LPWORD)(pFormat+2); */
1350 FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
1351 if (pFormat[0] != RPC_FC_STRUCT)
1352 EmbeddedPointerMemorySize(pStubMsg, pFormat+4);
1353 return 0;
1356 /***********************************************************************
1357 * NdrSimpleStructFree [RPCRT4.@]
1359 void WINAPI NdrSimpleStructFree(PMIDL_STUB_MESSAGE pStubMsg,
1360 unsigned char *pMemory,
1361 PFORMAT_STRING pFormat)
1363 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1364 if (pFormat[0] != RPC_FC_STRUCT)
1365 EmbeddedPointerFree(pStubMsg, pMemory, pFormat+4);
1369 unsigned long WINAPI EmbeddedComplexSize(PMIDL_STUB_MESSAGE pStubMsg,
1370 PFORMAT_STRING pFormat)
1372 switch (*pFormat) {
1373 case RPC_FC_STRUCT:
1374 case RPC_FC_PSTRUCT:
1375 case RPC_FC_CSTRUCT:
1376 case RPC_FC_BOGUS_STRUCT:
1377 return *(const WORD*)&pFormat[2];
1378 case RPC_FC_USER_MARSHAL:
1379 return *(const WORD*)&pFormat[4];
1380 default:
1381 FIXME("unhandled embedded type %02x\n", *pFormat);
1383 return 0;
1387 unsigned char * WINAPI ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
1388 unsigned char *pMemory,
1389 PFORMAT_STRING pFormat,
1390 PFORMAT_STRING pPointer)
1392 PFORMAT_STRING desc;
1393 NDR_MARSHALL m;
1394 unsigned long size;
1396 while (*pFormat != RPC_FC_END) {
1397 switch (*pFormat) {
1398 case RPC_FC_SHORT:
1399 case RPC_FC_USHORT:
1400 TRACE("short=%d <= %p\n", *(WORD*)pMemory, pMemory);
1401 memcpy(pStubMsg->Buffer, pMemory, 2);
1402 pStubMsg->Buffer += 2;
1403 pMemory += 2;
1404 break;
1405 case RPC_FC_LONG:
1406 case RPC_FC_ULONG:
1407 TRACE("long=%ld <= %p\n", *(DWORD*)pMemory, pMemory);
1408 memcpy(pStubMsg->Buffer, pMemory, 4);
1409 pStubMsg->Buffer += 4;
1410 pMemory += 4;
1411 break;
1412 case RPC_FC_POINTER:
1413 TRACE("pointer=%p <= %p\n", *(unsigned char**)pMemory, pMemory);
1414 NdrPointerMarshall(pStubMsg, *(unsigned char**)pMemory, pPointer);
1415 pPointer += 4;
1416 pMemory += 4;
1417 break;
1418 case RPC_FC_ALIGNM4:
1419 ALIGN_POINTER(pMemory, 3);
1420 break;
1421 case RPC_FC_ALIGNM8:
1422 ALIGN_POINTER(pMemory, 7);
1423 break;
1424 case RPC_FC_EMBEDDED_COMPLEX:
1425 pMemory += pFormat[1];
1426 pFormat += 2;
1427 desc = pFormat + *(const SHORT*)pFormat;
1428 size = EmbeddedComplexSize(pStubMsg, desc);
1429 TRACE("embedded complex (size=%ld) <= %p\n", size, pMemory);
1430 m = NdrMarshaller[*desc & NDR_TABLE_MASK];
1431 if (m) m(pStubMsg, pMemory, desc);
1432 else FIXME("no marshaller for embedded type %02x\n", *desc);
1433 pMemory += size;
1434 pFormat += 2;
1435 continue;
1436 case RPC_FC_PAD:
1437 break;
1438 default:
1439 FIXME("unhandled format %02x\n", *pFormat);
1441 pFormat++;
1444 return pMemory;
1447 unsigned char * WINAPI ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
1448 unsigned char *pMemory,
1449 PFORMAT_STRING pFormat,
1450 PFORMAT_STRING pPointer,
1451 unsigned char fMustAlloc)
1453 PFORMAT_STRING desc;
1454 NDR_UNMARSHALL m;
1455 unsigned long size;
1457 while (*pFormat != RPC_FC_END) {
1458 switch (*pFormat) {
1459 case RPC_FC_SHORT:
1460 case RPC_FC_USHORT:
1461 memcpy(pMemory, pStubMsg->Buffer, 2);
1462 TRACE("short=%d => %p\n", *(WORD*)pMemory, pMemory);
1463 pStubMsg->Buffer += 2;
1464 pMemory += 2;
1465 break;
1466 case RPC_FC_LONG:
1467 case RPC_FC_ULONG:
1468 memcpy(pMemory, pStubMsg->Buffer, 4);
1469 TRACE("long=%ld => %p\n", *(DWORD*)pMemory, pMemory);
1470 pStubMsg->Buffer += 4;
1471 pMemory += 4;
1472 break;
1473 case RPC_FC_POINTER:
1474 *(unsigned char**)pMemory = NULL;
1475 TRACE("pointer => %p\n", pMemory);
1476 NdrPointerUnmarshall(pStubMsg, (unsigned char**)pMemory, pPointer, fMustAlloc);
1477 pPointer += 4;
1478 pMemory += 4;
1479 break;
1480 case RPC_FC_ALIGNM4:
1481 ALIGN_POINTER(pMemory, 3);
1482 break;
1483 case RPC_FC_ALIGNM8:
1484 ALIGN_POINTER(pMemory, 7);
1485 break;
1486 case RPC_FC_EMBEDDED_COMPLEX:
1487 pMemory += pFormat[1];
1488 pFormat += 2;
1489 desc = pFormat + *(const SHORT*)pFormat;
1490 size = EmbeddedComplexSize(pStubMsg, desc);
1491 TRACE("embedded complex (size=%ld) => %p\n", size, pMemory);
1492 m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
1493 memset(pMemory, 0, size); /* just in case */
1494 if (m) m(pStubMsg, &pMemory, desc, fMustAlloc);
1495 else FIXME("no unmarshaller for embedded type %02x\n", *desc);
1496 pMemory += size;
1497 pFormat += 2;
1498 continue;
1499 case RPC_FC_PAD:
1500 break;
1501 default:
1502 FIXME("unhandled format %d\n", *pFormat);
1504 pFormat++;
1507 return pMemory;
1510 unsigned char * WINAPI ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
1511 unsigned char *pMemory,
1512 PFORMAT_STRING pFormat,
1513 PFORMAT_STRING pPointer)
1515 PFORMAT_STRING desc;
1516 NDR_BUFFERSIZE m;
1517 unsigned long size;
1519 while (*pFormat != RPC_FC_END) {
1520 switch (*pFormat) {
1521 case RPC_FC_SHORT:
1522 case RPC_FC_USHORT:
1523 pStubMsg->BufferLength += 2;
1524 pMemory += 2;
1525 break;
1526 case RPC_FC_LONG:
1527 case RPC_FC_ULONG:
1528 pStubMsg->BufferLength += 4;
1529 pMemory += 4;
1530 break;
1531 case RPC_FC_POINTER:
1532 NdrPointerBufferSize(pStubMsg, *(unsigned char**)pMemory, pPointer);
1533 pPointer += 4;
1534 pMemory += 4;
1535 break;
1536 case RPC_FC_ALIGNM4:
1537 ALIGN_POINTER(pMemory, 3);
1538 break;
1539 case RPC_FC_ALIGNM8:
1540 ALIGN_POINTER(pMemory, 7);
1541 break;
1542 case RPC_FC_EMBEDDED_COMPLEX:
1543 pMemory += pFormat[1];
1544 pFormat += 2;
1545 desc = pFormat + *(const SHORT*)pFormat;
1546 size = EmbeddedComplexSize(pStubMsg, desc);
1547 m = NdrBufferSizer[*desc & NDR_TABLE_MASK];
1548 if (m) m(pStubMsg, pMemory, desc);
1549 else FIXME("no buffersizer for embedded type %02x\n", *desc);
1550 pMemory += size;
1551 pFormat += 2;
1552 continue;
1553 case RPC_FC_PAD:
1554 break;
1555 default:
1556 FIXME("unhandled format %d\n", *pFormat);
1558 pFormat++;
1561 return pMemory;
1564 unsigned char * WINAPI ComplexFree(PMIDL_STUB_MESSAGE pStubMsg,
1565 unsigned char *pMemory,
1566 PFORMAT_STRING pFormat,
1567 PFORMAT_STRING pPointer)
1569 PFORMAT_STRING desc;
1570 NDR_FREE m;
1571 unsigned long size;
1573 while (*pFormat != RPC_FC_END) {
1574 switch (*pFormat) {
1575 case RPC_FC_SHORT:
1576 case RPC_FC_USHORT:
1577 pMemory += 2;
1578 break;
1579 case RPC_FC_LONG:
1580 case RPC_FC_ULONG:
1581 pMemory += 4;
1582 break;
1583 case RPC_FC_POINTER:
1584 NdrPointerFree(pStubMsg, *(unsigned char**)pMemory, pPointer);
1585 pPointer += 4;
1586 pMemory += 4;
1587 break;
1588 case RPC_FC_ALIGNM4:
1589 ALIGN_POINTER(pMemory, 3);
1590 break;
1591 case RPC_FC_ALIGNM8:
1592 ALIGN_POINTER(pMemory, 7);
1593 break;
1594 case RPC_FC_EMBEDDED_COMPLEX:
1595 pMemory += pFormat[1];
1596 pFormat += 2;
1597 desc = pFormat + *(const SHORT*)pFormat;
1598 size = EmbeddedComplexSize(pStubMsg, desc);
1599 m = NdrFreer[*desc & NDR_TABLE_MASK];
1600 if (m) m(pStubMsg, pMemory, desc);
1601 else FIXME("no freer for embedded type %02x\n", *desc);
1602 pMemory += size;
1603 pFormat += 2;
1604 continue;
1605 case RPC_FC_PAD:
1606 break;
1607 default:
1608 FIXME("unhandled format %d\n", *pFormat);
1610 pFormat++;
1613 return pMemory;
1616 unsigned long WINAPI ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg,
1617 PFORMAT_STRING pFormat)
1619 PFORMAT_STRING desc;
1620 unsigned long size = 0;
1622 while (*pFormat != RPC_FC_END) {
1623 switch (*pFormat) {
1624 case RPC_FC_SHORT:
1625 case RPC_FC_USHORT:
1626 size += 2;
1627 break;
1628 case RPC_FC_LONG:
1629 case RPC_FC_ULONG:
1630 size += 4;
1631 break;
1632 case RPC_FC_POINTER:
1633 size += 4;
1634 break;
1635 case RPC_FC_ALIGNM4:
1636 ALIGN_LENGTH(size, 3);
1637 break;
1638 case RPC_FC_ALIGNM8:
1639 ALIGN_LENGTH(size, 7);
1640 break;
1641 case RPC_FC_EMBEDDED_COMPLEX:
1642 size += pFormat[1];
1643 pFormat += 2;
1644 desc = pFormat + *(const SHORT*)pFormat;
1645 size += EmbeddedComplexSize(pStubMsg, desc);
1646 pFormat += 2;
1647 continue;
1648 case RPC_FC_PAD:
1649 break;
1650 default:
1651 FIXME("unhandled format %d\n", *pFormat);
1653 pFormat++;
1656 return size;
1659 /***********************************************************************
1660 * NdrComplexStructMarshall [RPCRT4.@]
1662 unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
1663 unsigned char *pMemory,
1664 PFORMAT_STRING pFormat)
1666 PFORMAT_STRING conf_array = NULL;
1667 PFORMAT_STRING pointer_desc = NULL;
1668 unsigned char *OldMemory = pStubMsg->Memory;
1670 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1672 pFormat += 4;
1673 if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
1674 pFormat += 2;
1675 if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
1676 pFormat += 2;
1678 pStubMsg->Memory = pMemory;
1680 ComplexMarshall(pStubMsg, pMemory, pFormat, pointer_desc);
1682 if (conf_array)
1683 NdrConformantArrayMarshall(pStubMsg, pMemory, conf_array);
1685 pStubMsg->Memory = OldMemory;
1687 STD_OVERFLOW_CHECK(pStubMsg);
1689 return NULL;
1692 /***********************************************************************
1693 * NdrComplexStructUnmarshall [RPCRT4.@]
1695 unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
1696 unsigned char **ppMemory,
1697 PFORMAT_STRING pFormat,
1698 unsigned char fMustAlloc)
1700 unsigned size = *(const WORD*)(pFormat+2);
1701 PFORMAT_STRING conf_array = NULL;
1702 PFORMAT_STRING pointer_desc = NULL;
1703 unsigned char *pMemory;
1705 TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
1707 if (fMustAlloc || !*ppMemory)
1708 *ppMemory = NdrAllocate(pStubMsg, size);
1710 pFormat += 4;
1711 if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
1712 pFormat += 2;
1713 if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
1714 pFormat += 2;
1716 pMemory = ComplexUnmarshall(pStubMsg, *ppMemory, pFormat, pointer_desc, fMustAlloc);
1718 if (conf_array)
1719 NdrConformantArrayUnmarshall(pStubMsg, &pMemory, conf_array, fMustAlloc);
1721 return NULL;
1724 /***********************************************************************
1725 * NdrComplexStructBufferSize [RPCRT4.@]
1727 void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
1728 unsigned char *pMemory,
1729 PFORMAT_STRING pFormat)
1731 PFORMAT_STRING conf_array = NULL;
1732 PFORMAT_STRING pointer_desc = NULL;
1733 unsigned char *OldMemory = pStubMsg->Memory;
1735 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1737 pFormat += 4;
1738 if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
1739 pFormat += 2;
1740 if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
1741 pFormat += 2;
1743 pStubMsg->Memory = pMemory;
1745 pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, pointer_desc);
1747 if (conf_array)
1748 NdrConformantArrayBufferSize(pStubMsg, pMemory, conf_array);
1750 pStubMsg->Memory = OldMemory;
1753 /***********************************************************************
1754 * NdrComplexStructMemorySize [RPCRT4.@]
1756 unsigned long WINAPI NdrComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
1757 PFORMAT_STRING pFormat)
1759 /* unsigned size = *(LPWORD)(pFormat+2); */
1760 PFORMAT_STRING conf_array = NULL;
1761 PFORMAT_STRING pointer_desc = NULL;
1763 FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
1765 pFormat += 4;
1766 if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
1767 pFormat += 2;
1768 if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
1769 pFormat += 2;
1771 return 0;
1774 /***********************************************************************
1775 * NdrComplexStructFree [RPCRT4.@]
1777 void WINAPI NdrComplexStructFree(PMIDL_STUB_MESSAGE pStubMsg,
1778 unsigned char *pMemory,
1779 PFORMAT_STRING pFormat)
1781 PFORMAT_STRING conf_array = NULL;
1782 PFORMAT_STRING pointer_desc = NULL;
1783 unsigned char *OldMemory = pStubMsg->Memory;
1785 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1787 pFormat += 4;
1788 if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
1789 pFormat += 2;
1790 if (*(const WORD*)pFormat) pointer_desc = pFormat + *(const WORD*)pFormat;
1791 pFormat += 2;
1793 pStubMsg->Memory = pMemory;
1795 pMemory = ComplexFree(pStubMsg, pMemory, pFormat, pointer_desc);
1797 if (conf_array)
1798 NdrConformantArrayFree(pStubMsg, pMemory, conf_array);
1800 pStubMsg->Memory = OldMemory;
1803 /***********************************************************************
1804 * NdrConformantArrayMarshall [RPCRT4.@]
1806 unsigned char * WINAPI NdrConformantArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
1807 unsigned char *pMemory,
1808 PFORMAT_STRING pFormat)
1810 DWORD size = 0, esize = *(const WORD*)(pFormat+2);
1811 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1812 if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
1814 pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
1815 size = pStubMsg->MaxCount;
1817 NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, size);
1818 pStubMsg->Buffer += 4;
1820 memcpy(pStubMsg->Buffer, pMemory, size*esize);
1821 pStubMsg->BufferMark = pStubMsg->Buffer;
1822 pStubMsg->Buffer += size*esize;
1824 EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
1826 STD_OVERFLOW_CHECK(pStubMsg);
1828 return NULL;
1831 /***********************************************************************
1832 * NdrConformantArrayUnmarshall [RPCRT4.@]
1834 unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
1835 unsigned char **ppMemory,
1836 PFORMAT_STRING pFormat,
1837 unsigned char fMustAlloc)
1839 DWORD size = 0, esize = *(const WORD*)(pFormat+2);
1840 TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
1841 if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
1843 pFormat = ReadConformance(pStubMsg, pFormat+4);
1844 size = pStubMsg->MaxCount;
1846 if (fMustAlloc || !*ppMemory)
1847 *ppMemory = NdrAllocate(pStubMsg, size*esize);
1849 memcpy(*ppMemory, pStubMsg->Buffer, size*esize);
1851 pStubMsg->BufferMark = pStubMsg->Buffer;
1852 pStubMsg->Buffer += size*esize;
1854 EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
1856 return NULL;
1859 /***********************************************************************
1860 * NdrConformantArrayBufferSize [RPCRT4.@]
1862 void WINAPI NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
1863 unsigned char *pMemory,
1864 PFORMAT_STRING pFormat)
1866 DWORD size = 0, esize = *(const WORD*)(pFormat+2);
1867 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1868 if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
1870 pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
1871 size = pStubMsg->MaxCount;
1873 pStubMsg->BufferLength += size*esize;
1875 EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
1878 /***********************************************************************
1879 * NdrConformantArrayMemorySize [RPCRT4.@]
1881 unsigned long WINAPI NdrConformantArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
1882 PFORMAT_STRING pFormat)
1884 DWORD size = 0;
1885 FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
1886 if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
1888 pFormat = ReadConformance(pStubMsg, pFormat+4);
1889 size = pStubMsg->MaxCount;
1891 EmbeddedPointerMemorySize(pStubMsg, pFormat);
1893 return 0;
1896 /***********************************************************************
1897 * NdrConformantArrayFree [RPCRT4.@]
1899 void WINAPI NdrConformantArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
1900 unsigned char *pMemory,
1901 PFORMAT_STRING pFormat)
1903 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1904 if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]);
1906 EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
1910 /***********************************************************************
1911 * NdrConformantVaryingArrayMarshall [RPCRT4.@]
1913 unsigned char* WINAPI NdrConformantVaryingArrayMarshall( PMIDL_STUB_MESSAGE pStubMsg,
1914 unsigned char* pMemory,
1915 PFORMAT_STRING pFormat )
1917 FIXME( "stub\n" );
1918 return NULL;
1922 /***********************************************************************
1923 * NdrConformantVaryingArrayUnmarshall [RPCRT4.@]
1925 unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pStubMsg,
1926 unsigned char** ppMemory,
1927 PFORMAT_STRING pFormat,
1928 unsigned char fMustAlloc )
1930 FIXME( "stub\n" );
1931 return NULL;
1935 /***********************************************************************
1936 * NdrConformantVaryingArrayFree [RPCRT4.@]
1938 void WINAPI NdrConformantVaryingArrayFree( PMIDL_STUB_MESSAGE pStubMsg,
1939 unsigned char* pMemory,
1940 PFORMAT_STRING pFormat )
1942 FIXME( "stub\n" );
1946 /***********************************************************************
1947 * NdrConformantVaryingArrayBufferSize [RPCRT4.@]
1949 void WINAPI NdrConformantVaryingArrayBufferSize( PMIDL_STUB_MESSAGE pStubMsg,
1950 unsigned char* pMemory, PFORMAT_STRING pFormat )
1952 FIXME( "stub\n" );
1956 /***********************************************************************
1957 * NdrConformantVaryingArrayMemorySize [RPCRT4.@]
1959 unsigned long WINAPI NdrConformantVaryingArrayMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
1960 PFORMAT_STRING pFormat )
1962 FIXME( "stub\n" );
1963 return 0;
1967 /***********************************************************************
1968 * NdrComplexArrayMarshall [RPCRT4.@]
1970 unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
1971 unsigned char *pMemory,
1972 PFORMAT_STRING pFormat)
1974 DWORD size = 0, count, def;
1975 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
1977 def = *(const WORD*)&pFormat[2];
1978 pFormat += 4;
1980 pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
1981 size = pStubMsg->MaxCount;
1982 TRACE("conformance=%ld\n", size);
1984 if (*(const DWORD*)pFormat != 0xffffffff)
1985 FIXME("compute variance\n");
1986 pFormat += 4;
1988 NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, size);
1989 pStubMsg->Buffer += 4;
1991 for (count=0; count<size; count++)
1992 pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL);
1994 STD_OVERFLOW_CHECK(pStubMsg);
1996 return NULL;
1999 /***********************************************************************
2000 * NdrComplexArrayUnmarshall [RPCRT4.@]
2002 unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2003 unsigned char **ppMemory,
2004 PFORMAT_STRING pFormat,
2005 unsigned char fMustAlloc)
2007 DWORD size = 0, count, esize;
2008 unsigned char *pMemory;
2009 TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
2011 pFormat += 4;
2013 pFormat = ReadConformance(pStubMsg, pFormat);
2014 size = pStubMsg->MaxCount;
2015 TRACE("conformance=%ld\n", size);
2017 pFormat += 4;
2019 esize = ComplexStructSize(pStubMsg, pFormat);
2021 if (fMustAlloc || !*ppMemory)
2022 *ppMemory = NdrAllocate(pStubMsg, size*esize);
2024 pMemory = *ppMemory;
2025 for (count=0; count<size; count++)
2026 pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL, fMustAlloc);
2028 return NULL;
2031 /***********************************************************************
2032 * NdrComplexArrayBufferSize [RPCRT4.@]
2034 void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2035 unsigned char *pMemory,
2036 PFORMAT_STRING pFormat)
2038 DWORD size = 0, count, def;
2039 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
2041 def = *(const WORD*)&pFormat[2];
2042 pFormat += 4;
2044 pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
2045 size = pStubMsg->MaxCount;
2046 TRACE("conformance=%ld\n", size);
2048 if (*(const DWORD*)pFormat != 0xffffffff)
2049 FIXME("compute variance\n");
2050 pFormat += 4;
2052 for (count=0; count<size; count++)
2053 pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL);
2056 /***********************************************************************
2057 * NdrComplexArrayMemorySize [RPCRT4.@]
2059 unsigned long WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2060 PFORMAT_STRING pFormat)
2062 DWORD size = 0;
2063 FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
2065 pFormat += 4;
2067 pFormat = ReadConformance(pStubMsg, pFormat);
2068 size = pStubMsg->MaxCount;
2069 TRACE("conformance=%ld\n", size);
2071 pFormat += 4;
2073 return 0;
2076 /***********************************************************************
2077 * NdrComplexArrayFree [RPCRT4.@]
2079 void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
2080 unsigned char *pMemory,
2081 PFORMAT_STRING pFormat)
2083 DWORD size = 0, count, def;
2084 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
2086 def = *(const WORD*)&pFormat[2];
2087 pFormat += 4;
2089 pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
2090 size = pStubMsg->MaxCount;
2091 TRACE("conformance=%ld\n", size);
2093 if (*(const DWORD*)pFormat != 0xffffffff)
2094 FIXME("compute variance\n");
2095 pFormat += 4;
2097 for (count=0; count<size; count++)
2098 pMemory = ComplexFree(pStubMsg, pMemory, pFormat, NULL);
2101 unsigned long UserMarshalFlags(PMIDL_STUB_MESSAGE pStubMsg)
2103 return MAKELONG(pStubMsg->dwDestContext,
2104 pStubMsg->RpcMsg->DataRepresentation);
2107 /***********************************************************************
2108 * NdrUserMarshalMarshall [RPCRT4.@]
2110 unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2111 unsigned char *pMemory,
2112 PFORMAT_STRING pFormat)
2114 /* unsigned flags = pFormat[1]; */
2115 unsigned index = *(const WORD*)&pFormat[2];
2116 unsigned long uflag = UserMarshalFlags(pStubMsg);
2117 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
2118 TRACE("index=%d\n", index);
2120 pStubMsg->Buffer =
2121 pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnMarshall(
2122 &uflag, pStubMsg->Buffer, pMemory);
2124 STD_OVERFLOW_CHECK(pStubMsg);
2126 return NULL;
2129 /***********************************************************************
2130 * NdrUserMarshalUnmarshall [RPCRT4.@]
2132 unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2133 unsigned char **ppMemory,
2134 PFORMAT_STRING pFormat,
2135 unsigned char fMustAlloc)
2137 /* unsigned flags = pFormat[1];*/
2138 unsigned index = *(const WORD*)&pFormat[2];
2139 DWORD memsize = *(const WORD*)&pFormat[4];
2140 unsigned long uflag = UserMarshalFlags(pStubMsg);
2141 TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
2142 TRACE("index=%d\n", index);
2144 if (fMustAlloc || !*ppMemory)
2145 *ppMemory = NdrAllocate(pStubMsg, memsize);
2147 pStubMsg->Buffer =
2148 pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnUnmarshall(
2149 &uflag, pStubMsg->Buffer, *ppMemory);
2151 return NULL;
2154 /***********************************************************************
2155 * NdrUserMarshalBufferSize [RPCRT4.@]
2157 void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2158 unsigned char *pMemory,
2159 PFORMAT_STRING pFormat)
2161 /* unsigned flags = pFormat[1];*/
2162 unsigned index = *(const WORD*)&pFormat[2];
2163 DWORD bufsize = *(const WORD*)&pFormat[6];
2164 unsigned long uflag = UserMarshalFlags(pStubMsg);
2165 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
2166 TRACE("index=%d\n", index);
2168 if (bufsize) {
2169 TRACE("size=%ld\n", bufsize);
2170 pStubMsg->BufferLength += bufsize;
2171 return;
2174 pStubMsg->BufferLength =
2175 pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnBufferSize(
2176 &uflag, pStubMsg->BufferLength, pMemory);
2179 /***********************************************************************
2180 * NdrUserMarshalMemorySize [RPCRT4.@]
2182 unsigned long WINAPI NdrUserMarshalMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2183 PFORMAT_STRING pFormat)
2185 unsigned index = *(const WORD*)&pFormat[2];
2186 /* DWORD memsize = *(const WORD*)&pFormat[4]; */
2187 FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
2188 TRACE("index=%d\n", index);
2190 return 0;
2193 /***********************************************************************
2194 * NdrUserMarshalFree [RPCRT4.@]
2196 void WINAPI NdrUserMarshalFree(PMIDL_STUB_MESSAGE pStubMsg,
2197 unsigned char *pMemory,
2198 PFORMAT_STRING pFormat)
2200 /* unsigned flags = pFormat[1]; */
2201 unsigned index = *(const WORD*)&pFormat[2];
2202 unsigned long uflag = UserMarshalFlags(pStubMsg);
2203 TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
2204 TRACE("index=%d\n", index);
2206 pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnFree(
2207 &uflag, pMemory);
2210 /***********************************************************************
2211 * NdrClearOutParameters [RPCRT4.@]
2213 void WINAPI NdrClearOutParameters(PMIDL_STUB_MESSAGE pStubMsg,
2214 PFORMAT_STRING pFormat,
2215 void *ArgAddr)
2217 FIXME("(%p,%p,%p): stub\n", pStubMsg, pFormat, ArgAddr);
2220 /***********************************************************************
2221 * NdrConvert [RPCRT4.@]
2223 void WINAPI NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
2225 FIXME("(pStubMsg == ^%p, pFormat == ^%p): stub.\n", pStubMsg, pFormat);
2226 /* FIXME: since this stub doesn't do any converting, the proper behavior
2227 is to raise an exception */
2230 /***********************************************************************
2231 * NdrConvert2 [RPCRT4.@]
2233 void WINAPI NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, long NumberParams )
2235 FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %ld): stub.\n",
2236 pStubMsg, pFormat, NumberParams);
2237 /* FIXME: since this stub doesn't do any converting, the proper behavior
2238 is to raise an exception */
2241 /***********************************************************************
2242 * NdrConformantStructMarshall [RPCRT4.@]
2244 unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2245 unsigned char *pMemory,
2246 PFORMAT_STRING pFormat)
2248 FIXME("stub\n");
2249 return NULL;
2252 /***********************************************************************
2253 * NdrConformantStructUnmarshall [RPCRT4.@]
2255 unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2256 unsigned char **ppMemory,
2257 PFORMAT_STRING pFormat,
2258 unsigned char fMustAlloc)
2260 FIXME("stub\n");
2261 return NULL;
2264 /***********************************************************************
2265 * NdrConformantStructBufferSize [RPCRT4.@]
2267 void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2268 unsigned char *pMemory,
2269 PFORMAT_STRING pFormat)
2271 FIXME("stub\n");
2274 /***********************************************************************
2275 * NdrConformantStructMemorySize [RPCRT4.@]
2277 unsigned long WINAPI NdrConformantStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2278 PFORMAT_STRING pFormat)
2280 FIXME("stub\n");
2281 return 0;
2284 /***********************************************************************
2285 * NdrConformantStructFree [RPCRT4.@]
2287 void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg,
2288 unsigned char *pMemory,
2289 PFORMAT_STRING pFormat)
2291 FIXME("stub\n");
2294 /***********************************************************************
2295 * NdrConformantVaryingStructMarshall [RPCRT4.@]
2297 unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2298 unsigned char *pMemory,
2299 PFORMAT_STRING pFormat)
2301 FIXME("stub\n");
2302 return NULL;
2305 /***********************************************************************
2306 * NdrConformantVaryingStructUnmarshall [RPCRT4.@]
2308 unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2309 unsigned char **ppMemory,
2310 PFORMAT_STRING pFormat,
2311 unsigned char fMustAlloc)
2313 FIXME("stub\n");
2314 return NULL;
2317 /***********************************************************************
2318 * NdrConformantVaryingStructBufferSize [RPCRT4.@]
2320 void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2321 unsigned char *pMemory,
2322 PFORMAT_STRING pFormat)
2324 FIXME("stub\n");
2327 /***********************************************************************
2328 * NdrConformantVaryingStructMemorySize [RPCRT4.@]
2330 unsigned long WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2331 PFORMAT_STRING pFormat)
2333 FIXME("stub\n");
2334 return 0;
2337 /***********************************************************************
2338 * NdrConformantVaryingStructFree [RPCRT4.@]
2340 void WINAPI NdrConformantVaryingStructFree(PMIDL_STUB_MESSAGE pStubMsg,
2341 unsigned char *pMemory,
2342 PFORMAT_STRING pFormat)
2344 FIXME("stub\n");
2347 /***********************************************************************
2348 * NdrFixedArrayMarshall [RPCRT4.@]
2350 unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2351 unsigned char *pMemory,
2352 PFORMAT_STRING pFormat)
2354 FIXME("stub\n");
2355 return NULL;
2358 /***********************************************************************
2359 * NdrFixedArrayUnmarshall [RPCRT4.@]
2361 unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2362 unsigned char **ppMemory,
2363 PFORMAT_STRING pFormat,
2364 unsigned char fMustAlloc)
2366 FIXME("stub\n");
2367 return NULL;
2370 /***********************************************************************
2371 * NdrFixedArrayBufferSize [RPCRT4.@]
2373 void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2374 unsigned char *pMemory,
2375 PFORMAT_STRING pFormat)
2377 FIXME("stub\n");
2380 /***********************************************************************
2381 * NdrFixedArrayMemorySize [RPCRT4.@]
2383 unsigned long WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2384 PFORMAT_STRING pFormat)
2386 FIXME("stub\n");
2387 return 0;
2390 /***********************************************************************
2391 * NdrFixedArrayFree [RPCRT4.@]
2393 void WINAPI NdrFixedArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
2394 unsigned char *pMemory,
2395 PFORMAT_STRING pFormat)
2397 FIXME("stub\n");
2400 /***********************************************************************
2401 * NdrVaryingArrayMarshall [RPCRT4.@]
2403 unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2404 unsigned char *pMemory,
2405 PFORMAT_STRING pFormat)
2407 FIXME("stub\n");
2408 return NULL;
2411 /***********************************************************************
2412 * NdrVaryingArrayUnmarshall [RPCRT4.@]
2414 unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2415 unsigned char **ppMemory,
2416 PFORMAT_STRING pFormat,
2417 unsigned char fMustAlloc)
2419 FIXME("stub\n");
2420 return NULL;
2423 /***********************************************************************
2424 * NdrVaryingArrayBufferSize [RPCRT4.@]
2426 void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2427 unsigned char *pMemory,
2428 PFORMAT_STRING pFormat)
2430 FIXME("stub\n");
2433 /***********************************************************************
2434 * NdrVaryingArrayMemorySize [RPCRT4.@]
2436 unsigned long WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2437 PFORMAT_STRING pFormat)
2439 FIXME("stub\n");
2440 return 0;
2443 /***********************************************************************
2444 * NdrVaryingArrayFree [RPCRT4.@]
2446 void WINAPI NdrVaryingArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
2447 unsigned char *pMemory,
2448 PFORMAT_STRING pFormat)
2450 FIXME("stub\n");
2453 /***********************************************************************
2454 * NdrEncapsulatedUnionMarshall [RPCRT4.@]
2456 unsigned char * WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2457 unsigned char *pMemory,
2458 PFORMAT_STRING pFormat)
2460 FIXME("stub\n");
2461 return NULL;
2464 /***********************************************************************
2465 * NdrEncapsulatedUnionUnmarshall [RPCRT4.@]
2467 unsigned char * WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2468 unsigned char **ppMemory,
2469 PFORMAT_STRING pFormat,
2470 unsigned char fMustAlloc)
2472 FIXME("stub\n");
2473 return NULL;
2476 /***********************************************************************
2477 * NdrEncapsulatedUnionBufferSize [RPCRT4.@]
2479 void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2480 unsigned char *pMemory,
2481 PFORMAT_STRING pFormat)
2483 FIXME("stub\n");
2486 /***********************************************************************
2487 * NdrEncapsulatedUnionMemorySize [RPCRT4.@]
2489 unsigned long WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2490 PFORMAT_STRING pFormat)
2492 FIXME("stub\n");
2493 return 0;
2496 /***********************************************************************
2497 * NdrEncapsulatedUnionFree [RPCRT4.@]
2499 void WINAPI NdrEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
2500 unsigned char *pMemory,
2501 PFORMAT_STRING pFormat)
2503 FIXME("stub\n");
2506 /***********************************************************************
2507 * NdrNonEncapsulatedUnionMarshall [RPCRT4.@]
2509 unsigned char * WINAPI NdrNonEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2510 unsigned char *pMemory,
2511 PFORMAT_STRING pFormat)
2513 FIXME("stub\n");
2514 return NULL;
2517 /***********************************************************************
2518 * NdrNonEncapsulatedUnionUnmarshall [RPCRT4.@]
2520 unsigned char * WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2521 unsigned char **ppMemory,
2522 PFORMAT_STRING pFormat,
2523 unsigned char fMustAlloc)
2525 FIXME("stub\n");
2526 return NULL;
2529 /***********************************************************************
2530 * NdrNonEncapsulatedUnionBufferSize [RPCRT4.@]
2532 void WINAPI NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2533 unsigned char *pMemory,
2534 PFORMAT_STRING pFormat)
2536 FIXME("stub\n");
2539 /***********************************************************************
2540 * NdrNonEncapsulatedUnionMemorySize [RPCRT4.@]
2542 unsigned long WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2543 PFORMAT_STRING pFormat)
2545 FIXME("stub\n");
2546 return 0;
2549 /***********************************************************************
2550 * NdrNonEncapsulatedUnionFree [RPCRT4.@]
2552 void WINAPI NdrNonEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
2553 unsigned char *pMemory,
2554 PFORMAT_STRING pFormat)
2556 FIXME("stub\n");
2559 /***********************************************************************
2560 * NdrByteCountPointerMarshall [RPCRT4.@]
2562 unsigned char * WINAPI NdrByteCountPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2563 unsigned char *pMemory,
2564 PFORMAT_STRING pFormat)
2566 FIXME("stub\n");
2567 return NULL;
2570 /***********************************************************************
2571 * NdrByteCountPointerUnmarshall [RPCRT4.@]
2573 unsigned char * WINAPI NdrByteCountPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2574 unsigned char **ppMemory,
2575 PFORMAT_STRING pFormat,
2576 unsigned char fMustAlloc)
2578 FIXME("stub\n");
2579 return NULL;
2582 /***********************************************************************
2583 * NdrByteCountPointerBufferSize [RPCRT4.@]
2585 void WINAPI NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2586 unsigned char *pMemory,
2587 PFORMAT_STRING pFormat)
2589 FIXME("stub\n");
2592 /***********************************************************************
2593 * NdrByteCountPointerMemorySize [RPCRT4.@]
2595 unsigned long WINAPI NdrByteCountPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2596 PFORMAT_STRING pFormat)
2598 FIXME("stub\n");
2599 return 0;
2602 /***********************************************************************
2603 * NdrByteCountPointerFree [RPCRT4.@]
2605 void WINAPI NdrByteCountPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
2606 unsigned char *pMemory,
2607 PFORMAT_STRING pFormat)
2609 FIXME("stub\n");
2612 /***********************************************************************
2613 * NdrXmitOrRepAsMarshall [RPCRT4.@]
2615 unsigned char * WINAPI NdrXmitOrRepAsMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2616 unsigned char *pMemory,
2617 PFORMAT_STRING pFormat)
2619 FIXME("stub\n");
2620 return NULL;
2623 /***********************************************************************
2624 * NdrXmitOrRepAsUnmarshall [RPCRT4.@]
2626 unsigned char * WINAPI NdrXmitOrRepAsUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2627 unsigned char **ppMemory,
2628 PFORMAT_STRING pFormat,
2629 unsigned char fMustAlloc)
2631 FIXME("stub\n");
2632 return NULL;
2635 /***********************************************************************
2636 * NdrXmitOrRepAsBufferSize [RPCRT4.@]
2638 void WINAPI NdrXmitOrRepAsBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
2639 unsigned char *pMemory,
2640 PFORMAT_STRING pFormat)
2642 FIXME("stub\n");
2645 /***********************************************************************
2646 * NdrXmitOrRepAsMemorySize [RPCRT4.@]
2648 unsigned long WINAPI NdrXmitOrRepAsMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
2649 PFORMAT_STRING pFormat)
2651 FIXME("stub\n");
2652 return 0;
2655 /***********************************************************************
2656 * NdrXmitOrRepAsFree [RPCRT4.@]
2658 void WINAPI NdrXmitOrRepAsFree(PMIDL_STUB_MESSAGE pStubMsg,
2659 unsigned char *pMemory,
2660 PFORMAT_STRING pFormat)
2662 FIXME("stub\n");
2665 /***********************************************************************
2666 * NdrClientContextMarshall
2668 void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2669 NDR_CCONTEXT ContextHandle,
2670 int fCheck)
2672 FIXME("(%p, %p, %d): stub\n", pStubMsg, ContextHandle, fCheck);
2675 /***********************************************************************
2676 * NdrClientContextUnmarshall
2678 void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2679 NDR_CCONTEXT * pContextHandle,
2680 RPC_BINDING_HANDLE BindHandle)
2682 FIXME("(%p, %p, %p): stub\n", pStubMsg, pContextHandle, BindHandle);
2685 void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2686 NDR_SCONTEXT ContextHandle,
2687 NDR_RUNDOWN RundownRoutine )
2689 FIXME("(%p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine);
2692 NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg)
2694 FIXME("(%p): stub\n", pStubMsg);
2695 return NULL;
2698 void WINAPI NdrContextHandleSize(PMIDL_STUB_MESSAGE pStubMsg,
2699 unsigned char* pMemory,
2700 PFORMAT_STRING pFormat)
2702 FIXME("(%p, %p, %p): stub\n", pStubMsg, pMemory, pFormat);
2705 NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,
2706 PFORMAT_STRING pFormat)
2708 FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
2709 return NULL;
2712 void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
2713 NDR_SCONTEXT ContextHandle,
2714 NDR_RUNDOWN RundownRoutine,
2715 PFORMAT_STRING pFormat)
2717 FIXME("(%p, %p, %p, %p): stub\n", pStubMsg, ContextHandle, RundownRoutine, pFormat);
2720 NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
2721 PFORMAT_STRING pFormat)
2723 FIXME("(%p, %p): stub\n", pStubMsg, pFormat);
2724 return NULL;
2727 RPC_BINDING_HANDLE WINAPI NDRCContextBinding(NDR_CCONTEXT CContext)
2729 FIXME("(%p): stub\n", CContext);
2730 return NULL;