d3drm: Improve IDirect3DRMMeshBuilderImpl_Load and corresponding test.
[wine] / include / rpcndr.h
1 /*
2  * Copyright (C) 2000 Francois Gouget
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef __RPCNDR_H_VERSION__
20 /* FIXME: What version?   Perhaps something is better than nothing, however incorrect */
21 #define __RPCNDR_H_VERSION__ ( 399 )
22 #endif
23
24 #ifndef __WINE_RPCNDR_H
25 #define __WINE_RPCNDR_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <basetsd.h>
32
33 #undef CONST_VTBL
34 #ifdef CONST_VTABLE
35 # define CONST_VTBL const
36 #else
37 # define CONST_VTBL
38 #endif
39
40 /* stupid #if can't handle casts... this __stupidity
41    is just a workaround for that limitation */
42
43 #define __NDR_CHAR_REP_MASK  0x000fL
44 #define __NDR_INT_REP_MASK   0x00f0L
45 #define __NDR_FLOAT_REP_MASK 0xff00L
46
47 #define __NDR_IEEE_FLOAT     0x0000L
48 #define __NDR_VAX_FLOAT      0x0100L
49 #define __NDR_IBM_FLOAT      0x0300L
50
51 #define __NDR_ASCII_CHAR     0x0000L
52 #define __NDR_EBCDIC_CHAR    0x0001L
53
54 #define __NDR_LITTLE_ENDIAN  0x0010L
55 #define __NDR_BIG_ENDIAN     0x0000L
56
57 /* Mac's are special */
58 #if defined(__RPC_MAC__)
59 # define __NDR_LOCAL_DATA_REPRESENTATION \
60     (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_BIG_ENDIAN)
61 #else
62 # define __NDR_LOCAL_DATA_REPRESENTATION \
63     (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_LITTLE_ENDIAN)
64 #endif
65
66 #define __NDR_LOCAL_ENDIAN \
67   (__NDR_LOCAL_DATA_REPRESENTATION & __NDR_INT_REP_MASK)
68
69 /* for convenience, define NDR_LOCAL_IS_BIG_ENDIAN iff it is */
70 #if __NDR_LOCAL_ENDIAN == __NDR_BIG_ENDIAN
71 # define NDR_LOCAL_IS_BIG_ENDIAN
72 #elif __NDR_LOCAL_ENDIAN == __NDR_LITTLE_ENDIAN
73 # undef NDR_LOCAL_IS_BIG_ENDIAN
74 #else
75 # error alien NDR_LOCAL_ENDIAN - Greg botched the defines again, please report
76 #endif
77
78 /* finally, do the casts like Microsoft */
79
80 #define NDR_CHAR_REP_MASK             ((ULONG) __NDR_CHAR_REP_MASK)
81 #define NDR_INT_REP_MASK              ((ULONG) __NDR_INT_REP_MASK)
82 #define NDR_FLOAT_REP_MASK            ((ULONG) __NDR_FLOAT_REP_MASK)
83 #define NDR_IEEE_FLOAT                ((ULONG) __NDR_IEEE_FLOAT)
84 #define NDR_VAX_FLOAT                 ((ULONG) __NDR_VAX_FLOAT)
85 #define NDR_IBM_FLOAT                 ((ULONG) __NDR_IBM_FLOAT)
86 #define NDR_ASCII_CHAR                ((ULONG) __NDR_ASCII_CHAR)
87 #define NDR_EBCDIC_CHAR               ((ULONG) __NDR_EBCDIC_CHAR)
88 #define NDR_LITTLE_ENDIAN             ((ULONG) __NDR_LITTLE_ENDIAN)
89 #define NDR_BIG_ENDIAN                ((ULONG) __NDR_BIG_ENDIAN)
90 #define NDR_LOCAL_DATA_REPRESENTATION ((ULONG) __NDR_LOCAL_DATA_REPRESENTATION)
91 #define NDR_LOCAL_ENDIAN              ((ULONG) __NDR_LOCAL_ENDIAN)
92
93
94 #define TARGET_IS_NT50_OR_LATER 1
95 #define TARGET_IS_NT40_OR_LATER 1
96 #define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
97
98 #define small char
99 typedef unsigned char byte;
100 typedef INT64 hyper;
101 typedef UINT64 MIDL_uhyper;
102 typedef unsigned char boolean;
103
104 #define __RPC_CALLEE WINAPI
105 #define RPC_VAR_ENTRY __cdecl
106 #define NDR_SHAREABLE static
107
108 #define MIDL_ascii_strlen(s) strlen(s)
109 #define MIDL_ascii_strcpy(d,s) strcpy(d,s)
110 #define MIDL_memset(d,v,n) memset(d,v,n)
111 #define midl_user_free MIDL_user_free
112 #define midl_user_allocate MIDL_user_allocate
113
114 #define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8)
115 #define NdrFcLong(s)  (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \
116   (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24)
117
118 #define RPC_BAD_STUB_DATA_EXCEPTION_FILTER  \
119   ((RpcExceptionCode() == STATUS_ACCESS_VIOLATION) || \
120    (RpcExceptionCode() == STATUS_DATATYPE_MISALIGNMENT) || \
121    (RpcExceptionCode() == RPC_X_BAD_STUB_DATA) || \
122    (RpcExceptionCode() == RPC_S_INVALID_BOUND))
123
124 typedef struct
125 {
126   void *pad[2];
127   void *userContext;
128 } *NDR_SCONTEXT;
129
130 #define NDRSContextValue(hContext) (&(hContext)->userContext)
131 #define cbNDRContext 20
132
133 typedef void (__RPC_USER *NDR_RUNDOWN)(void *context);
134 typedef void (__RPC_USER *NDR_NOTIFY_ROUTINE)(void);
135 typedef void (__RPC_USER *NDR_NOTIFY2_ROUTINE)(boolean flag);
136
137 #define DECLSPEC_UUID(x)
138 #define MIDL_INTERFACE(x)   struct
139
140 struct _MIDL_STUB_MESSAGE;
141 struct _MIDL_STUB_DESC;
142 struct _FULL_PTR_XLAT_TABLES;
143 struct NDR_ALLOC_ALL_NODES_CONTEXT;
144 struct NDR_POINTER_QUEUE_STATE;
145
146 typedef unsigned char *RPC_BUFPTR;
147 typedef ULONG RPC_LENGTH;
148 typedef void (__RPC_USER *EXPR_EVAL)(struct _MIDL_STUB_MESSAGE *);
149 typedef const unsigned char *PFORMAT_STRING;
150
151 typedef struct
152 {
153   LONG Dimension;
154   ULONG *BufferConformanceMark;
155   ULONG *BufferVarianceMark;
156   ULONG *MaxCountArray;
157   ULONG *OffsetArray;
158   ULONG *ActualCountArray;
159 } ARRAY_INFO, *PARRAY_INFO;
160
161 typedef struct
162 {
163   ULONG WireCodeset;
164   ULONG DesiredReceivingCodeset;
165   void *CSArrayInfo;
166 } CS_STUB_INFO;
167
168 typedef struct _NDR_PIPE_DESC *PNDR_PIPE_DESC;
169 typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE;
170 typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
171 typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO;
172
173 typedef struct _MIDL_STUB_MESSAGE
174 {
175   PRPC_MESSAGE RpcMsg;
176   unsigned char *Buffer;
177   unsigned char *BufferStart;
178   unsigned char *BufferEnd;
179   unsigned char *BufferMark;
180   ULONG BufferLength;
181   ULONG MemorySize;
182   unsigned char *Memory;
183   unsigned char IsClient;
184   unsigned char Pad;
185   unsigned short uFlags2;
186   int ReuseBuffer;
187   struct NDR_ALLOC_ALL_NODES_CONTEXT *pAllocAllNodesContext;
188   struct NDR_POINTER_QUEUE_STATE *pPointerQueueState;
189   int IgnoreEmbeddedPointers;
190   unsigned char *PointerBufferMark;
191   unsigned char CorrDespIncrement;
192   unsigned char uFlags;
193   unsigned short UniquePtrCount;
194   ULONG_PTR MaxCount;
195   ULONG Offset;
196   ULONG ActualCount;
197   void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T);
198   void (__RPC_API *pfnFree)(void *);
199   unsigned char *StackTop;
200   unsigned char *pPresentedType;
201   unsigned char *pTransmitType;
202   handle_t SavedHandle;
203   const struct _MIDL_STUB_DESC *StubDesc;
204   struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
205   ULONG FullPtrRefId;
206   ULONG PointerLength;
207   unsigned int fInDontFree:1;
208   unsigned int fDontCallFreeInst:1;
209   unsigned int fInOnlyParam:1;
210   unsigned int fHasReturn:1;
211   unsigned int fHasExtensions:1;
212   unsigned int fHasNewCorrDesc:1;
213   unsigned int fIsIn:1;
214   unsigned int fIsOut:1;
215   unsigned int fIsOicf:1;
216   unsigned int fBufferValid:1;
217   unsigned int fHasMemoryValidateCallback:1;
218   unsigned int fInFree:1;
219   unsigned int fNeedMCCP:1;
220   int fUnused:3;
221   int fUnused2:16;
222   DWORD dwDestContext;
223   void *pvDestContext;
224   NDR_SCONTEXT *SavedContextHandles;
225   LONG ParamNumber;
226   struct IRpcChannelBuffer *pRpcChannelBuffer;
227   PARRAY_INFO pArrayInfo;
228   ULONG *SizePtrCountArray;
229   ULONG *SizePtrOffsetArray;
230   ULONG *SizePtrLengthArray;
231   void *pArgQueue;
232   DWORD dwStubPhase;
233   void *LowStackMark;
234   PNDR_ASYNC_MESSAGE pAsyncMsg;
235   PNDR_CORRELATION_INFO pCorrInfo;
236   unsigned char *pCorrMemory;
237   void *pMemoryList;
238   CS_STUB_INFO *pCSInfo;
239   unsigned char *ConformanceMark;
240   unsigned char *VarianceMark;
241   INT_PTR Unused; /* BackingStoreLowMark on IA64 */
242   struct _NDR_PROC_CONTEXT *pContext;
243   void* ContextHandleHash;
244   void* pUserMarshalList;
245   INT_PTR Reserved51_3;
246   INT_PTR Reserved51_4;
247   INT_PTR Reserved51_5;
248 } MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
249
250 typedef void * (__RPC_API * GENERIC_BINDING_ROUTINE)(void *);
251 typedef void (__RPC_API * GENERIC_UNBIND_ROUTINE)(void *, unsigned char *);
252
253 typedef struct _GENERIC_BINDING_ROUTINE_PAIR
254 {
255   GENERIC_BINDING_ROUTINE pfnBind;
256   GENERIC_UNBIND_ROUTINE pfnUnbind;
257 } GENERIC_BINDING_ROUTINE_PAIR, *PGENERIC_BINDING_ROUTINE_PAIR;
258
259 typedef struct __GENERIC_BINDING_INFO
260 {
261   void *pObj;
262   unsigned int Size;
263   GENERIC_BINDING_ROUTINE pfnBind;
264   GENERIC_UNBIND_ROUTINE pfnUnbind;
265 } GENERIC_BINDING_INFO, *PGENERIC_BINDING_INFO;
266
267 typedef void (__RPC_USER *XMIT_HELPER_ROUTINE)(PMIDL_STUB_MESSAGE);
268
269 typedef struct _XMIT_ROUTINE_QUINTUPLE
270 {
271   XMIT_HELPER_ROUTINE pfnTranslateToXmit;
272   XMIT_HELPER_ROUTINE pfnTranslateFromXmit;
273   XMIT_HELPER_ROUTINE pfnFreeXmit;
274   XMIT_HELPER_ROUTINE pfnFreeInst;
275 } XMIT_ROUTINE_QUINTUPLE, *PXMIT_ROUTINE_QUINTUPLE;
276
277 typedef ULONG (__RPC_USER *USER_MARSHAL_SIZING_ROUTINE)(ULONG *, ULONG, void *);
278 typedef unsigned char * (__RPC_USER *USER_MARSHAL_MARSHALLING_ROUTINE)(ULONG *, unsigned char *, void *);
279 typedef unsigned char * (__RPC_USER *USER_MARSHAL_UNMARSHALLING_ROUTINE)(ULONG *, unsigned char *, void *);
280 typedef void (__RPC_USER *USER_MARSHAL_FREEING_ROUTINE)(ULONG *, void *);
281
282 typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE
283 {
284   USER_MARSHAL_SIZING_ROUTINE pfnBufferSize;
285   USER_MARSHAL_MARSHALLING_ROUTINE pfnMarshall;
286   USER_MARSHAL_UNMARSHALLING_ROUTINE pfnUnmarshall;
287   USER_MARSHAL_FREEING_ROUTINE pfnFree;
288 } USER_MARSHAL_ROUTINE_QUADRUPLE;
289
290 /* 'USRC' */
291 #define USER_MARSHAL_CB_SIGNATURE \
292         ( ( (DWORD)'U' << 24 ) | ( (DWORD)'S' << 16 ) | \
293           ( (DWORD)'R' << 8  ) | ( (DWORD)'C'       ) )
294
295 typedef enum
296 {
297     USER_MARSHAL_CB_BUFFER_SIZE,
298     USER_MARSHAL_CB_MARSHALL,
299     USER_MARSHAL_CB_UNMARSHALL,
300     USER_MARSHAL_CB_FREE
301 } USER_MARSHAL_CB_TYPE;
302
303 typedef struct _USER_MARSHAL_CB
304 {
305     ULONG Flags;
306     PMIDL_STUB_MESSAGE pStubMsg;
307     PFORMAT_STRING pReserve;
308     ULONG Signature;
309     USER_MARSHAL_CB_TYPE CBType;
310     PFORMAT_STRING pFormat;
311     PFORMAT_STRING pTypeFormat;
312 } USER_MARSHAL_CB;
313
314 #define USER_CALL_CTXT_MASK(f) ((f) & 0x00ff)
315 #define USER_CALL_AUX_MASK(f) ((f) & 0xff00)
316 #define GET_USER_DATA_REP(f) HIWORD(f)
317
318 #define USER_CALL_IS_ASYNC 0x0100
319 #define USER_CALL_NEW_CORRELATION_DESC 0x0200
320
321 typedef struct _MALLOC_FREE_STRUCT
322 {
323   void * (__WINE_ALLOC_SIZE(1) __RPC_USER *pfnAllocate)(SIZE_T);
324   void   (__RPC_USER *pfnFree)(void *);
325 } MALLOC_FREE_STRUCT;
326
327 typedef struct _COMM_FAULT_OFFSETS
328 {
329   short CommOffset;
330   short FaultOffset;
331 } COMM_FAULT_OFFSETS;
332
333 typedef struct _MIDL_STUB_DESC
334 {
335   void *RpcInterfaceInformation;
336   void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T);
337   void (__RPC_API *pfnFree)(void *);
338   union {
339     handle_t *pAutoHandle;
340     handle_t *pPrimitiveHandle;
341     PGENERIC_BINDING_INFO pGenericBindingInfo;
342   } IMPLICIT_HANDLE_INFO;
343   const NDR_RUNDOWN *apfnNdrRundownRoutines;
344   const GENERIC_BINDING_ROUTINE_PAIR *aGenericBindingRoutinePairs;
345   const EXPR_EVAL *apfnExprEval;
346   const XMIT_ROUTINE_QUINTUPLE *aXmitQuintuple;
347   const unsigned char *pFormatTypes;
348   int fCheckBounds;
349   ULONG Version;
350   MALLOC_FREE_STRUCT *pMallocFreeStruct;
351   LONG MIDLVersion;
352   const COMM_FAULT_OFFSETS *CommFaultOffsets;
353   const USER_MARSHAL_ROUTINE_QUADRUPLE *aUserMarshalQuadruple;
354   const NDR_NOTIFY_ROUTINE *NotifyRoutineTable;
355   ULONG_PTR mFlags;
356   ULONG_PTR Reserved3;
357   ULONG_PTR Reserved4;
358   ULONG_PTR Reserved5;
359 } MIDL_STUB_DESC;
360 typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;
361
362 typedef struct _MIDL_FORMAT_STRING
363 {
364   short Pad;
365 #if defined(__GNUC__)
366   unsigned char Format[0];
367 #else
368   unsigned char Format[1];
369 #endif
370 } MIDL_FORMAT_STRING;
371
372 typedef struct _MIDL_SYNTAX_INFO
373 {
374   RPC_SYNTAX_IDENTIFIER TransferSyntax;
375   RPC_DISPATCH_TABLE* DispatchTable;
376   PFORMAT_STRING ProcString;
377   const unsigned short* FmtStringOffset;
378   PFORMAT_STRING TypeString;
379   const void* aUserMarshalQuadruple;
380   ULONG_PTR pReserved1;
381   ULONG_PTR pReserved2;
382 } MIDL_SYNTAX_INFO, *PMIDL_SYNTAX_INFO;
383
384 typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
385
386 #ifdef WINE_STRICT_PROTOTYPES
387 typedef LONG (__RPC_API *SERVER_ROUTINE)(void);
388 #else
389 typedef LONG (__RPC_API *SERVER_ROUTINE)();
390 #endif
391
392 typedef struct _MIDL_SERVER_INFO_
393 {
394   PMIDL_STUB_DESC pStubDesc;
395   const SERVER_ROUTINE *DispatchTable;
396   PFORMAT_STRING ProcString;
397   const unsigned short *FmtStringOffset;
398   const STUB_THUNK *ThunkTable;
399   PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
400   ULONG_PTR nCount;
401   PMIDL_SYNTAX_INFO pSyntaxInfo;
402 } MIDL_SERVER_INFO, *PMIDL_SERVER_INFO;
403
404 typedef struct _MIDL_STUBLESS_PROXY_INFO
405 {
406   PMIDL_STUB_DESC pStubDesc;
407   PFORMAT_STRING ProcFormatString;
408   const unsigned short *FormatStringOffset;
409   PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
410   ULONG_PTR nCount;
411   PMIDL_SYNTAX_INFO pSyntaxInfo;
412 } MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;
413
414 typedef union _CLIENT_CALL_RETURN
415 {
416   void *Pointer;
417   LONG_PTR Simple;
418 } CLIENT_CALL_RETURN;
419
420 typedef enum {
421   STUB_UNMARSHAL,
422   STUB_CALL_SERVER,
423   STUB_MARSHAL,
424   STUB_CALL_SERVER_NO_HRESULT
425 } STUB_PHASE;
426
427 typedef enum {
428   PROXY_CALCSIZE,
429   PROXY_GETBUFFER,
430   PROXY_MARSHAL,
431   PROXY_SENDRECEIVE,
432   PROXY_UNMARSHAL
433 } PROXY_PHASE;
434
435 typedef enum {
436   XLAT_SERVER = 1,
437   XLAT_CLIENT
438 } XLAT_SIDE;
439
440 typedef struct _FULL_PTR_TO_REFID_ELEMENT {
441   struct _FULL_PTR_TO_REFID_ELEMENT *Next;
442   void *Pointer;
443   ULONG RefId;
444   unsigned char State;
445 } FULL_PTR_TO_REFID_ELEMENT, *PFULL_PTR_TO_REFID_ELEMENT;
446
447 /* Full pointer translation tables */
448 typedef struct _FULL_PTR_XLAT_TABLES {
449   struct {
450     void **XlatTable;
451     unsigned char *StateTable;
452     ULONG NumberOfEntries;
453   } RefIdToPointer;
454
455   struct {
456     PFULL_PTR_TO_REFID_ELEMENT *XlatTable;
457     ULONG NumberOfBuckets;
458     ULONG HashMask;
459   } PointerToRefId;
460
461   ULONG                   NextRefId;
462   XLAT_SIDE               XlatSide;
463 } FULL_PTR_XLAT_TABLES,  *PFULL_PTR_XLAT_TABLES;
464
465 struct IRpcStubBuffer;
466
467 typedef ULONG error_status_t;
468 typedef void  * NDR_CCONTEXT;
469
470 typedef struct _SCONTEXT_QUEUE {
471   ULONG NumberOfObjects;
472   NDR_SCONTEXT *ArrayOfObjects;
473 } SCONTEXT_QUEUE, *PSCONTEXT_QUEUE;
474
475 typedef struct _NDR_USER_MARSHAL_INFO_LEVEL1
476 {
477     void *Buffer;
478     ULONG BufferSize;
479     void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T);
480     void (__RPC_API *pfnFree)(void *);
481     struct IRpcChannelBuffer *pRpcChannelBuffer;
482     ULONG_PTR Reserved[5];
483 } NDR_USER_MARSHAL_INFO_LEVEL1;
484
485 typedef struct _NDR_USER_MARSHAL_INFO
486 {
487     ULONG InformationLevel;
488     union
489     {
490         NDR_USER_MARSHAL_INFO_LEVEL1 Level1;
491     } DUMMYUNIONNAME1;
492 } NDR_USER_MARSHAL_INFO;
493
494 /* Context Handles */
495
496 RPCRTAPI RPC_BINDING_HANDLE RPC_ENTRY
497   NDRCContextBinding( NDR_CCONTEXT CContext );
498
499 RPCRTAPI void RPC_ENTRY
500   NDRCContextMarshall( NDR_CCONTEXT CContext, void *pBuff );
501
502 RPCRTAPI void RPC_ENTRY
503   NDRCContextUnmarshall( NDR_CCONTEXT *pCContext, RPC_BINDING_HANDLE hBinding,
504                          void *pBuff, ULONG DataRepresentation );
505
506 RPCRTAPI void RPC_ENTRY
507   NDRSContextMarshall( NDR_SCONTEXT CContext, void *pBuff, NDR_RUNDOWN userRunDownIn );
508
509 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
510   NDRSContextUnmarshall( void *pBuff, ULONG DataRepresentation );
511
512 RPCRTAPI void RPC_ENTRY
513   NDRSContextMarshallEx( RPC_BINDING_HANDLE BindingHandle, NDR_SCONTEXT CContext,
514                          void *pBuff, NDR_RUNDOWN userRunDownIn );
515
516 RPCRTAPI void RPC_ENTRY
517   NDRSContextMarshall2( RPC_BINDING_HANDLE BindingHandle, NDR_SCONTEXT CContext,
518                         void *pBuff, NDR_RUNDOWN userRunDownIn, void * CtxGuard,
519                         ULONG Flags );
520
521 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
522   NDRSContextUnmarshallEx( RPC_BINDING_HANDLE BindingHandle, void *pBuff,
523                            ULONG DataRepresentation );
524
525 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
526   NDRSContextUnmarshall2( RPC_BINDING_HANDLE BindingHandle, void *pBuff,
527                           ULONG DataRepresentation, void *CtxGuard,
528                           ULONG Flags );
529
530 RPCRTAPI void RPC_ENTRY
531   NdrClientContextMarshall ( PMIDL_STUB_MESSAGE pStubMsg, NDR_CCONTEXT ContextHandle, int fCheck );
532
533 RPCRTAPI void RPC_ENTRY
534   NdrClientContextUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, NDR_CCONTEXT* pContextHandle,
535                               RPC_BINDING_HANDLE BindHandle );
536
537 RPCRTAPI void RPC_ENTRY
538   NdrServerContextMarshall ( PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT ContextHandle, NDR_RUNDOWN RundownRoutine );
539
540 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
541   NdrServerContextUnmarshall( PMIDL_STUB_MESSAGE pStubMsg );
542
543 RPCRTAPI void RPC_ENTRY
544   NdrContextHandleSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
545
546 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
547   NdrContextHandleInitialize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
548
549 RPCRTAPI void RPC_ENTRY
550   NdrServerContextNewMarshall( PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT ContextHandle,
551                                NDR_RUNDOWN RundownRoutine, PFORMAT_STRING pFormat );
552
553 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
554   NdrServerContextNewUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
555
556 RPCRTAPI RPC_STATUS RPC_ENTRY
557   RpcSmDestroyClientContext( void **ContextHandle );
558
559 RPCRTAPI void RPC_ENTRY
560   RpcSsDestroyClientContext( void **ContextHandle );
561
562 RPCRTAPI void RPC_ENTRY
563   NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
564 RPCRTAPI void RPC_ENTRY
565   NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
566
567 RPCRTAPI unsigned char* RPC_ENTRY
568   NdrByteCountPointerMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
569 RPCRTAPI unsigned char* RPC_ENTRY
570   NdrByteCountPointerUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc );
571 RPCRTAPI void RPC_ENTRY
572   NdrByteCountPointerBufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
573 RPCRTAPI void RPC_ENTRY
574   NdrByteCountPointerFree( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
575
576 RPCRTAPI unsigned char* RPC_ENTRY
577   NdrRangeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc );
578
579 /* while MS declares each prototype separately, I prefer to use macros for this kind of thing instead */
580 #define SIMPLE_TYPE_MARSHAL(type) \
581 RPCRTAPI unsigned char* RPC_ENTRY \
582   Ndr##type##Marshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
583 RPCRTAPI unsigned char* RPC_ENTRY \
584   Ndr##type##Unmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc ); \
585 RPCRTAPI void RPC_ENTRY \
586   Ndr##type##BufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
587 RPCRTAPI ULONG RPC_ENTRY \
588   Ndr##type##MemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
589
590 #define TYPE_MARSHAL(type) \
591   SIMPLE_TYPE_MARSHAL(type) \
592 RPCRTAPI void RPC_ENTRY \
593   Ndr##type##Free( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
594
595 TYPE_MARSHAL(Pointer)
596 TYPE_MARSHAL(SimpleStruct)
597 TYPE_MARSHAL(ConformantStruct)
598 TYPE_MARSHAL(ConformantVaryingStruct)
599 TYPE_MARSHAL(ComplexStruct)
600 TYPE_MARSHAL(FixedArray)
601 TYPE_MARSHAL(ConformantArray)
602 TYPE_MARSHAL(ConformantVaryingArray)
603 TYPE_MARSHAL(VaryingArray)
604 TYPE_MARSHAL(ComplexArray)
605 TYPE_MARSHAL(EncapsulatedUnion)
606 TYPE_MARSHAL(NonEncapsulatedUnion)
607 TYPE_MARSHAL(XmitOrRepAs)
608 TYPE_MARSHAL(UserMarshal)
609 TYPE_MARSHAL(InterfacePointer)
610
611 SIMPLE_TYPE_MARSHAL(ConformantString)
612 SIMPLE_TYPE_MARSHAL(NonConformantString)
613
614 #undef TYPE_MARSHAL
615 #undef SIMPLE_TYPE_MARSHAL
616
617 RPCRTAPI void RPC_ENTRY
618   NdrCorrelationInitialize( PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG flags );
619 RPCRTAPI void RPC_ENTRY
620   NdrCorrelationPass( PMIDL_STUB_MESSAGE pStubMsg );
621 RPCRTAPI void RPC_ENTRY
622   NdrCorrelationFree( PMIDL_STUB_MESSAGE pStubMsg );
623
624 RPCRTAPI void RPC_ENTRY
625   NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, LONG NumberParams );
626 RPCRTAPI void RPC_ENTRY
627   NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
628
629 #define USER_MARSHAL_FC_BYTE    1
630 #define USER_MARSHAL_FC_CHAR    2
631 #define USER_MARSHAL_FC_SMALL   3
632 #define USER_MARSHAL_FC_USMALL  4
633 #define USER_MARSHAL_FC_WCHAR   5
634 #define USER_MARSHAL_FC_SHORT   6
635 #define USER_MARSHAL_FC_USHORT  7
636 #define USER_MARSHAL_FC_LONG    8
637 #define USER_MARSHAL_FC_ULONG   9
638 #define USER_MARSHAL_FC_FLOAT   10
639 #define USER_MARSHAL_FC_HYPER   11
640 #define USER_MARSHAL_FC_DOUBLE  12
641
642 RPCRTAPI unsigned char* RPC_ENTRY
643   NdrUserMarshalSimpleTypeConvert( ULONG *pFlags, unsigned char *pBuffer, unsigned char FormatChar );
644
645 /* Note: this should return a CLIENT_CALL_RETURN, but calling convention for
646  * returning structures/unions is different between Windows and gcc on i386. */
647 LONG_PTR RPC_VAR_ENTRY
648   NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
649 LONG_PTR RPC_VAR_ENTRY
650   NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
651 LONG_PTR RPC_VAR_ENTRY
652   NdrAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
653 LONG_PTR RPC_VAR_ENTRY
654   NdrDcomAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
655
656 RPCRTAPI void RPC_ENTRY
657   NdrServerCall2( PRPC_MESSAGE pRpcMsg );
658 RPCRTAPI void RPC_ENTRY
659   NdrServerCall( PRPC_MESSAGE pRpcMsg );
660 RPCRTAPI void RPC_ENTRY
661   NdrAsyncServerCall( PRPC_MESSAGE pRpcMsg );
662
663 RPCRTAPI LONG RPC_ENTRY
664   NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
665 RPCRTAPI LONG RPC_ENTRY
666   NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
667 RPCRTAPI LONG RPC_ENTRY
668   NdrAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
669 RPCRTAPI LONG RPC_ENTRY
670   NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
671
672 RPCRTAPI void* RPC_ENTRY
673   NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2);
674
675 RPCRTAPI void RPC_ENTRY
676   NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr );
677
678 RPCRTAPI RPC_STATUS RPC_ENTRY
679   NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg, ULONG *pCommStatus,
680                             ULONG *pFaultStatus, RPC_STATUS Status_ );
681
682 RPCRTAPI void* RPC_ENTRY
683   NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
684 RPCRTAPI void RPC_ENTRY
685   NdrOleFree( void* NodeToFree );
686
687 RPCRTAPI void RPC_ENTRY
688   NdrClientInitialize( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
689                        PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum );
690 RPCRTAPI void RPC_ENTRY
691   NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
692                           PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum );
693 RPCRTAPI unsigned char* RPC_ENTRY
694   NdrServerInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc );
695 RPCRTAPI unsigned char* RPC_ENTRY
696   NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc );
697 RPCRTAPI unsigned char* RPC_ENTRY
698   NdrServerInitializeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc, PRPC_MESSAGE pRpcMsg );
699 RPCRTAPI void RPC_ENTRY
700   NdrServerInitializeMarshall( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg  );
701 RPCRTAPI void RPC_ENTRY
702   NdrServerMarshall( struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
703 RPCRTAPI void RPC_ENTRY
704   NdrServerUnmarshall( struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg,
705                        PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc,
706                        PFORMAT_STRING pFormat, void *pParamList );
707 RPCRTAPI unsigned char* RPC_ENTRY
708   NdrGetBuffer( PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC_BINDING_HANDLE handle );
709 RPCRTAPI void RPC_ENTRY
710   NdrFreeBuffer( PMIDL_STUB_MESSAGE pStubMsg );
711 RPCRTAPI unsigned char* RPC_ENTRY
712   NdrSendReceive( PMIDL_STUB_MESSAGE stubmsg, unsigned char *buffer );
713
714 RPCRTAPI unsigned char * RPC_ENTRY
715   NdrNsGetBuffer( PMIDL_STUB_MESSAGE pStubMsg, ULONG BufferLength, RPC_BINDING_HANDLE Handle );
716 RPCRTAPI unsigned char * RPC_ENTRY
717   NdrNsSendReceive( PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pBufferEnd, RPC_BINDING_HANDLE *pAutoHandle );
718
719 RPCRTAPI RPC_STATUS RPC_ENTRY
720   NdrGetDcomProtocolVersion( PMIDL_STUB_MESSAGE pStubMsg, RPC_VERSION *pVersion );
721
722 RPCRTAPI PFULL_PTR_XLAT_TABLES RPC_ENTRY
723   NdrFullPointerXlatInit( ULONG NumberOfPointers, XLAT_SIDE XlatSide );
724 RPCRTAPI void RPC_ENTRY
725   NdrFullPointerXlatFree( PFULL_PTR_XLAT_TABLES pXlatTables );
726 RPCRTAPI int RPC_ENTRY
727   NdrFullPointerQueryPointer( PFULL_PTR_XLAT_TABLES pXlatTables, void *pPointer,
728                               unsigned char QueryType, ULONG *pRefId );
729 RPCRTAPI int RPC_ENTRY
730   NdrFullPointerQueryRefId( PFULL_PTR_XLAT_TABLES pXlatTables, ULONG RefId,
731                             unsigned char QueryType, void **ppPointer );
732 RPCRTAPI void RPC_ENTRY
733   NdrFullPointerInsertRefId( PFULL_PTR_XLAT_TABLES pXlatTables, ULONG RefId, void *pPointer );
734 RPCRTAPI int RPC_ENTRY
735   NdrFullPointerFree( PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer );
736
737 RPCRTAPI void RPC_ENTRY
738   NdrRpcSsEnableAllocate( PMIDL_STUB_MESSAGE pMessage );
739 RPCRTAPI void RPC_ENTRY
740   NdrRpcSsDisableAllocate( PMIDL_STUB_MESSAGE pMessage );
741 RPCRTAPI void RPC_ENTRY
742   NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage );
743 RPCRTAPI void * RPC_ENTRY
744   NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
745 RPCRTAPI void RPC_ENTRY
746   NdrRpcSmClientFree( void *NodeToFree );
747 RPCRTAPI void * RPC_ENTRY
748   NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1);
749 RPCRTAPI void RPC_ENTRY
750   NdrRpcSsDefaultFree( void *NodeToFree );
751
752 RPCRTAPI RPC_STATUS RPC_ENTRY
753   NdrGetUserMarshalInfo( ULONG *pFlags, ULONG InformationLevel, NDR_USER_MARSHAL_INFO *pMarshalInfo );
754
755 #ifdef __cplusplus
756 }
757 #endif
758 #endif /*__WINE_RPCNDR_H */