Annotate with allocation size attribute.
[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 #define hyper __int64
101 #define MIDL_uhyper unsigned __int64
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 typedef struct
119 {
120   void *pad[2];
121   void *userContext;
122 } *NDR_SCONTEXT;
123
124 #define NDRSContextValue(hContext) (&(hContext)->userContext)
125 #define cbNDRContext 20
126
127 typedef void (__RPC_USER *NDR_RUNDOWN)(void *context);
128 typedef void (__RPC_USER *NDR_NOTIFY_ROUTINE)(void);
129 typedef void (__RPC_USER *NDR_NOTIFY2_ROUTINE)(boolean flag);
130
131 #define DECLSPEC_UUID(x)
132 #define MIDL_INTERFACE(x)   struct
133
134 struct _MIDL_STUB_MESSAGE;
135 struct _MIDL_STUB_DESC;
136 struct _FULL_PTR_XLAT_TABLES;
137 struct NDR_ALLOC_ALL_NODES_CONTEXT;
138 struct NDR_POINTER_QUEUE_STATE;
139
140 typedef unsigned char *RPC_BUFPTR;
141 typedef unsigned long RPC_LENGTH;
142 typedef void (__RPC_USER *EXPR_EVAL)(struct _MIDL_STUB_MESSAGE *);
143 typedef const unsigned char *PFORMAT_STRING;
144
145 typedef struct
146 {
147   LONG Dimension;
148   ULONG *BufferConformanceMark;
149   ULONG *BufferVarianceMark;
150   ULONG *MaxCountArray;
151   ULONG *OffsetArray;
152   ULONG *ActualCountArray;
153 } ARRAY_INFO, *PARRAY_INFO;
154
155 typedef struct
156 {
157   ULONG WireCodeset;
158   ULONG DesiredReceivingCodeset;
159   void *CSArrayInfo;
160 } CS_STUB_INFO;
161
162 typedef struct _NDR_PIPE_DESC *PNDR_PIPE_DESC;
163 typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE;
164 typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
165 typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO;
166
167 #include <pshpack4.h>
168 typedef struct _MIDL_STUB_MESSAGE
169 {
170   PRPC_MESSAGE RpcMsg;
171   unsigned char *Buffer;
172   unsigned char *BufferStart;
173   unsigned char *BufferEnd;
174   unsigned char *BufferMark;
175   ULONG BufferLength;
176   ULONG MemorySize;
177   unsigned char *Memory;
178   unsigned char IsClient;
179   unsigned char Pad;
180   unsigned short uFlags2;
181   int ReuseBuffer;
182   struct NDR_ALLOC_ALL_NODES_CONTEXT *pAllocAllNodesContext;
183   struct NDR_POINTER_QUEUE_STATE *pPointerQueueState;
184   int IgnoreEmbeddedPointers;
185   unsigned char *PointerBufferMark;
186   unsigned char CorrDespIncrement;
187   unsigned char uFlags;
188   unsigned short UniquePtrCount;
189   ULONG_PTR MaxCount;
190   ULONG Offset;
191   ULONG ActualCount;
192   void * (__RPC_API *pfnAllocate)(size_t);
193   void (__RPC_API *pfnFree)(void *);
194   unsigned char *StackTop;
195   unsigned char *pPresentedType;
196   unsigned char *pTransmitType;
197   handle_t SavedHandle;
198   const struct _MIDL_STUB_DESC *StubDesc;
199   struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
200   ULONG FullPtrRefId;
201   ULONG PointerLength;
202   int fInDontFree:1;
203   int fDontCallFreeInst:1;
204   int fInOnlyParam:1;
205   int fHasReturn:1;
206   int fHasExtensions:1;
207   int fHasNewCorrDesc:1;
208   int fIsIn:1;
209   int fIsOut:1;
210   int fIsOicf:1;
211   int fBufferValid:1;
212   int fHasMemoryValidateCallback:1;
213   int fInFree:1;
214   int fNeedMCCP:1;
215   int fUnused:3;
216   int fUnused2:16;
217   DWORD dwDestContext;
218   void *pvDestContext;
219   NDR_SCONTEXT *SavedContextHandles;
220   LONG ParamNumber;
221   struct IRpcChannelBuffer *pRpcChannelBuffer;
222   PARRAY_INFO pArrayInfo;
223   ULONG *SizePtrCountArray;
224   ULONG *SizePtrOffsetArray;
225   ULONG *SizePtrLengthArray;
226   void *pArgQueue;
227   DWORD dwStubPhase;
228   void *LowStackMark;
229   PNDR_ASYNC_MESSAGE pAsyncMsg;
230   PNDR_CORRELATION_INFO pCorrInfo;
231   unsigned char *pCorrMemory;
232   void *pMemoryList;
233   CS_STUB_INFO *pCSInfo;
234   unsigned char *ConformanceMark;
235   unsigned char *VarianceMark;
236   INT_PTR Unused; /* BackingStoreLowMark on IA64 */
237   struct _NDR_PROC_CONTEXT *pContext;
238   void* ContextHandleHash;
239   void* pUserMarshalList;
240   INT_PTR Reserved51_3;
241   INT_PTR Reserved51_4;
242   INT_PTR Reserved51_5;
243 } MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
244 #include <poppack.h>
245
246 typedef void * (__RPC_API * GENERIC_BINDING_ROUTINE)(void *);
247 typedef void (__RPC_API * GENERIC_UNBIND_ROUTINE)(void *, unsigned char *);
248
249 typedef struct _GENERIC_BINDING_ROUTINE_PAIR
250 {
251   GENERIC_BINDING_ROUTINE pfnBind;
252   GENERIC_UNBIND_ROUTINE pfnUnbind;
253 } GENERIC_BINDING_ROUTINE_PAIR, *PGENERIC_BINDING_ROUTINE_PAIR;
254
255 typedef struct __GENERIC_BINDING_INFO
256 {
257   void *pObj;
258   unsigned int Size;
259   GENERIC_BINDING_ROUTINE pfnBind;
260   GENERIC_UNBIND_ROUTINE pfnUnbind;
261 } GENERIC_BINDING_INFO, *PGENERIC_BINDING_INFO;
262
263 typedef void (__RPC_USER *XMIT_HELPER_ROUTINE)(PMIDL_STUB_MESSAGE);
264
265 typedef struct _XMIT_ROUTINE_QUINTUPLE
266 {
267   XMIT_HELPER_ROUTINE pfnTranslateToXmit;
268   XMIT_HELPER_ROUTINE pfnTranslateFromXmit;
269   XMIT_HELPER_ROUTINE pfnFreeXmit;
270   XMIT_HELPER_ROUTINE pfnFreeInst;
271 } XMIT_ROUTINE_QUINTUPLE, *PXMIT_ROUTINE_QUINTUPLE;
272
273 typedef ULONG (__RPC_USER *USER_MARSHAL_SIZING_ROUTINE)(ULONG *, ULONG, void *);
274 typedef unsigned char * (__RPC_USER *USER_MARSHAL_MARSHALLING_ROUTINE)(ULONG *, unsigned char *, void *);
275 typedef unsigned char * (__RPC_USER *USER_MARSHAL_UNMARSHALLING_ROUTINE)(ULONG *, unsigned char *, void *);
276 typedef void (__RPC_USER *USER_MARSHAL_FREEING_ROUTINE)(ULONG *, void *);
277
278 typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE
279 {
280   USER_MARSHAL_SIZING_ROUTINE pfnBufferSize;
281   USER_MARSHAL_MARSHALLING_ROUTINE pfnMarshall;
282   USER_MARSHAL_UNMARSHALLING_ROUTINE pfnUnmarshall;
283   USER_MARSHAL_FREEING_ROUTINE pfnFree;
284 } USER_MARSHAL_ROUTINE_QUADRUPLE;
285
286 /* 'USRC' */
287 #define USER_MARSHAL_CB_SIGNATURE \
288         ( ( (DWORD)'U' << 24 ) | ( (DWORD)'S' << 16 ) | \
289           ( (DWORD)'R' << 8  ) | ( (DWORD)'C'       ) )
290
291 typedef enum
292 {
293     USER_MARSHAL_CB_BUFFER_SIZE,
294     USER_MARSHAL_CB_MARSHALL,
295     USER_MARSHAL_CB_UNMARSHALL,
296     USER_MARSHAL_CB_FREE
297 } USER_MARSHAL_CB_TYPE;
298
299 typedef struct _USER_MARSHAL_CB
300 {
301     ULONG Flags;
302     PMIDL_STUB_MESSAGE pStubMsg;
303     PFORMAT_STRING pReserve;
304     ULONG Signature;
305     USER_MARSHAL_CB_TYPE CBType;
306     PFORMAT_STRING pFormat;
307     PFORMAT_STRING pTypeFormat;
308 } USER_MARSHAL_CB;
309
310 #define USER_CALL_CTXT_MASK(f) ((f) & 0x00ff)
311 #define USER_CALL_AUX_MASK(f) ((f) & 0xff00)
312 #define GET_USER_DATA_REP(f) HIWORD(f)
313
314 #define USER_CALL_IS_ASYNC 0x0100
315 #define USER_CALL_NEW_CORRELATION_DESC 0x0200
316
317 typedef struct _MALLOC_FREE_STRUCT
318 {
319   void * (__RPC_USER *pfnAllocate)(size_t);
320   void   (__RPC_USER *pfnFree)(void *);
321 } MALLOC_FREE_STRUCT;
322
323 typedef struct _COMM_FAULT_OFFSETS
324 {
325   short CommOffset;
326   short FaultOffset;
327 } COMM_FAULT_OFFSETS;
328
329 typedef struct _MIDL_STUB_DESC
330 {
331   void *RpcInterfaceInformation;
332   void * (__RPC_API *pfnAllocate)(size_t);
333   void (__RPC_API *pfnFree)(void *);
334   union {
335     handle_t *pAutoHandle;
336     handle_t *pPrimitiveHandle;
337     PGENERIC_BINDING_INFO pGenericBindingInfo;
338   } IMPLICIT_HANDLE_INFO;
339   const NDR_RUNDOWN *apfnNdrRundownRoutines;
340   const GENERIC_BINDING_ROUTINE_PAIR *aGenericBindingRoutinePairs;
341   const EXPR_EVAL *apfnExprEval;
342   const XMIT_ROUTINE_QUINTUPLE *aXmitQuintuple;
343   const unsigned char *pFormatTypes;
344   int fCheckBounds;
345   ULONG Version;
346   MALLOC_FREE_STRUCT *pMallocFreeStruct;
347   LONG MIDLVersion;
348   const COMM_FAULT_OFFSETS *CommFaultOffsets;
349   const USER_MARSHAL_ROUTINE_QUADRUPLE *aUserMarshalQuadruple;
350   const NDR_NOTIFY_ROUTINE *NotifyRoutineTable;
351   ULONG_PTR mFlags;
352   ULONG_PTR Reserved3;
353   ULONG_PTR Reserved4;
354   ULONG_PTR Reserved5;
355 } MIDL_STUB_DESC;
356 typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;
357
358 typedef struct _MIDL_FORMAT_STRING
359 {
360   short Pad;
361 #if defined(__GNUC__)
362   unsigned char Format[0];
363 #else
364   unsigned char Format[1];
365 #endif
366 } MIDL_FORMAT_STRING;
367
368 typedef struct _MIDL_SYNTAX_INFO
369 {
370   RPC_SYNTAX_IDENTIFIER TransferSyntax;
371   RPC_DISPATCH_TABLE* DispatchTable;
372   PFORMAT_STRING ProcString;
373   const unsigned short* FmtStringOffset;
374   PFORMAT_STRING TypeString;
375   const void* aUserMarshalQuadruple;
376   ULONG_PTR pReserved1;
377   ULONG_PTR pReserved2;
378 } MIDL_SYNTAX_INFO, *PMIDL_SYNTAX_INFO;
379
380 typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
381
382 typedef LONG (__RPC_API *SERVER_ROUTINE)();
383
384 typedef struct _MIDL_SERVER_INFO_
385 {
386   PMIDL_STUB_DESC pStubDesc;
387   const SERVER_ROUTINE *DispatchTable;
388   PFORMAT_STRING ProcString;
389   const unsigned short *FmtStringOffset;
390   const STUB_THUNK *ThunkTable;
391   PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
392   ULONG_PTR nCount;
393   PMIDL_SYNTAX_INFO pSyntaxInfo;
394 } MIDL_SERVER_INFO, *PMIDL_SERVER_INFO;
395
396 typedef struct _MIDL_STUBLESS_PROXY_INFO
397 {
398   PMIDL_STUB_DESC pStubDesc;
399   PFORMAT_STRING ProcFormatString;
400   const unsigned short *FormatStringOffset;
401   PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
402   ULONG_PTR nCount;
403   PMIDL_SYNTAX_INFO pSyntaxInfo;
404 } MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;
405
406 typedef union _CLIENT_CALL_RETURN
407 {
408   void *Pointer;
409   LONG_PTR Simple;
410 } CLIENT_CALL_RETURN;
411
412 typedef enum {
413   STUB_UNMARSHAL,
414   STUB_CALL_SERVER,
415   STUB_MARSHAL,
416   STUB_CALL_SERVER_NO_HRESULT
417 } STUB_PHASE;
418
419 typedef enum {
420   PROXY_CALCSIZE,
421   PROXY_GETBUFFER,
422   PROXY_MARSHAL,
423   PROXY_SENDRECEIVE,
424   PROXY_UNMARSHAL
425 } PROXY_PHASE;
426
427 typedef enum {
428   XLAT_SERVER = 1,
429   XLAT_CLIENT
430 } XLAT_SIDE;
431
432 typedef struct _FULL_PTR_TO_REFID_ELEMENT {
433   struct _FULL_PTR_TO_REFID_ELEMENT *Next;
434   void *Pointer;
435   ULONG RefId;
436   unsigned char State;
437 } FULL_PTR_TO_REFID_ELEMENT, *PFULL_PTR_TO_REFID_ELEMENT;
438
439 /* Full pointer translation tables */
440 typedef struct _FULL_PTR_XLAT_TABLES {
441   struct {
442     void **XlatTable;
443     unsigned char *StateTable;
444     ULONG NumberOfEntries;
445   } RefIdToPointer;
446
447   struct {
448     PFULL_PTR_TO_REFID_ELEMENT *XlatTable;
449     ULONG NumberOfBuckets;
450     ULONG HashMask;
451   } PointerToRefId;
452
453   ULONG                   NextRefId;
454   XLAT_SIDE               XlatSide;
455 } FULL_PTR_XLAT_TABLES,  *PFULL_PTR_XLAT_TABLES;
456
457 struct IRpcStubBuffer;
458
459 typedef ULONG error_status_t;
460 typedef void  * NDR_CCONTEXT;
461
462 typedef struct _SCONTEXT_QUEUE {
463   ULONG NumberOfObjects;
464   NDR_SCONTEXT *ArrayOfObjects;
465 } SCONTEXT_QUEUE, *PSCONTEXT_QUEUE;
466
467 typedef struct _NDR_USER_MARSHAL_INFO_LEVEL1
468 {
469     void *Buffer;
470     ULONG BufferSize;
471     void * (__RPC_API *pfnAllocate)(size_t);
472     void (__RPC_API *pfnFree)(void *);
473     struct IRpcChannelBuffer *pRpcChannelBuffer;
474     ULONG_PTR Reserved[5];
475 } NDR_USER_MARSHAL_INFO_LEVEL1;
476
477 typedef struct _NDR_USER_MARSHAL_INFO
478 {
479     ULONG InformationLevel;
480     union
481     {
482         NDR_USER_MARSHAL_INFO_LEVEL1 Level1;
483     } DUMMYUNIONNAME1;
484 } NDR_USER_MARSHAL_INFO;
485
486 /* Context Handles */
487
488 RPCRTAPI RPC_BINDING_HANDLE RPC_ENTRY
489   NDRCContextBinding( NDR_CCONTEXT CContext );
490
491 RPCRTAPI void RPC_ENTRY
492   NDRCContextMarshall( NDR_CCONTEXT CContext, void *pBuff );
493
494 RPCRTAPI void RPC_ENTRY
495   NDRCContextUnmarshall( NDR_CCONTEXT *pCContext, RPC_BINDING_HANDLE hBinding,
496                          void *pBuff, ULONG DataRepresentation );
497
498 RPCRTAPI void RPC_ENTRY
499   NDRSContextMarshall( NDR_SCONTEXT CContext, void *pBuff, NDR_RUNDOWN userRunDownIn );
500
501 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
502   NDRSContextUnmarshall( void *pBuff, ULONG DataRepresentation );
503
504 RPCRTAPI void RPC_ENTRY
505   NDRSContextMarshallEx( RPC_BINDING_HANDLE BindingHandle, NDR_SCONTEXT CContext,
506                          void *pBuff, NDR_RUNDOWN userRunDownIn );
507
508 RPCRTAPI void RPC_ENTRY
509   NDRSContextMarshall2( RPC_BINDING_HANDLE BindingHandle, NDR_SCONTEXT CContext,
510                         void *pBuff, NDR_RUNDOWN userRunDownIn, void * CtxGuard,
511                         ULONG Flags );
512
513 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
514   NDRSContextUnmarshallEx( RPC_BINDING_HANDLE BindingHandle, void *pBuff,
515                            ULONG DataRepresentation );
516
517 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
518   NDRSContextUnmarshall2( RPC_BINDING_HANDLE BindingHandle, void *pBuff,
519                           ULONG DataRepresentation, void *CtxGuard,
520                           ULONG Flags );
521
522 RPCRTAPI void RPC_ENTRY
523   NdrClientContextMarshall ( PMIDL_STUB_MESSAGE pStubMsg, NDR_CCONTEXT ContextHandle, int fCheck );
524
525 RPCRTAPI void RPC_ENTRY
526   NdrClientContextUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, NDR_CCONTEXT* pContextHandle,
527                               RPC_BINDING_HANDLE BindHandle );
528
529 RPCRTAPI void RPC_ENTRY
530   NdrServerContextMarshall ( PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT ContextHandle, NDR_RUNDOWN RundownRoutine );
531
532 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
533   NdrServerContextUnmarshall( PMIDL_STUB_MESSAGE pStubMsg );
534
535 RPCRTAPI void RPC_ENTRY
536   NdrContextHandleSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
537
538 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
539   NdrContextHandleInitialize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
540
541 RPCRTAPI void RPC_ENTRY
542   NdrServerContextNewMarshall( PMIDL_STUB_MESSAGE pStubMsg, NDR_SCONTEXT ContextHandle,
543                                NDR_RUNDOWN RundownRoutine, PFORMAT_STRING pFormat );
544
545 RPCRTAPI NDR_SCONTEXT RPC_ENTRY
546   NdrServerContextNewUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
547
548 RPCRTAPI RPC_STATUS RPC_ENTRY
549   RpcSmDestroyClientContext( void **ContextHandle );
550
551 RPCRTAPI void RPC_ENTRY
552   RpcSsDestroyClientContext( void **ContextHandle );
553
554 RPCRTAPI void RPC_ENTRY
555   NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
556 RPCRTAPI void RPC_ENTRY
557   NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
558
559 /* while MS declares each prototype separately, I prefer to use macros for this kind of thing instead */
560 #define SIMPLE_TYPE_MARSHAL(type) \
561 RPCRTAPI unsigned char* RPC_ENTRY \
562   Ndr##type##Marshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
563 RPCRTAPI unsigned char* RPC_ENTRY \
564   Ndr##type##Unmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc ); \
565 RPCRTAPI void RPC_ENTRY \
566   Ndr##type##BufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
567 RPCRTAPI ULONG RPC_ENTRY \
568   Ndr##type##MemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
569
570 #define TYPE_MARSHAL(type) \
571   SIMPLE_TYPE_MARSHAL(type) \
572 RPCRTAPI void RPC_ENTRY \
573   Ndr##type##Free( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
574
575 TYPE_MARSHAL(Pointer)
576 TYPE_MARSHAL(SimpleStruct)
577 TYPE_MARSHAL(ConformantStruct)
578 TYPE_MARSHAL(ConformantVaryingStruct)
579 TYPE_MARSHAL(ComplexStruct)
580 TYPE_MARSHAL(FixedArray)
581 TYPE_MARSHAL(ConformantArray)
582 TYPE_MARSHAL(ConformantVaryingArray)
583 TYPE_MARSHAL(VaryingArray)
584 TYPE_MARSHAL(ComplexArray)
585 TYPE_MARSHAL(EncapsulatedUnion)
586 TYPE_MARSHAL(NonEncapsulatedUnion)
587 TYPE_MARSHAL(ByteCountPointer)
588 TYPE_MARSHAL(XmitOrRepAs)
589 TYPE_MARSHAL(UserMarshal)
590 TYPE_MARSHAL(InterfacePointer)
591 TYPE_MARSHAL(Range)
592
593 SIMPLE_TYPE_MARSHAL(ConformantString)
594 SIMPLE_TYPE_MARSHAL(NonConformantString)
595
596 #undef TYPE_MARSHAL
597 #undef SIMPLE_TYPE_MARSHAL
598
599 RPCRTAPI void RPC_ENTRY
600   NdrCorrelationInitialize( PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG flags );
601 RPCRTAPI void RPC_ENTRY
602   NdrCorrelationPass( PMIDL_STUB_MESSAGE pStubMsg );
603 RPCRTAPI void RPC_ENTRY
604   NdrCorrelationFree( PMIDL_STUB_MESSAGE pStubMsg );
605
606 RPCRTAPI void RPC_ENTRY
607   NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, LONG NumberParams );
608 RPCRTAPI void RPC_ENTRY
609   NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
610
611 #define USER_MARSHAL_FC_BYTE    1
612 #define USER_MARSHAL_FC_CHAR    2
613 #define USER_MARSHAL_FC_SMALL   3
614 #define USER_MARSHAL_FC_USMALL  4
615 #define USER_MARSHAL_FC_WCHAR   5
616 #define USER_MARSHAL_FC_SHORT   6
617 #define USER_MARSHAL_FC_USHORT  7
618 #define USER_MARSHAL_FC_LONG    8
619 #define USER_MARSHAL_FC_ULONG   9
620 #define USER_MARSHAL_FC_FLOAT   10
621 #define USER_MARSHAL_FC_HYPER   11
622 #define USER_MARSHAL_FC_DOUBLE  12
623
624 RPCRTAPI unsigned char* RPC_ENTRY
625   NdrUserMarshalSimpleTypeConvert( ULONG *pFlags, unsigned char *pBuffer, unsigned char FormatChar );
626
627 /* Note: this should return a CLIENT_CALL_RETURN, but calling convention for
628  * returning structures/unions is different between Windows and gcc on i386. */
629 LONG_PTR RPC_VAR_ENTRY
630   NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
631 LONG_PTR RPC_VAR_ENTRY
632   NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
633 LONG_PTR RPC_VAR_ENTRY
634   NdrAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
635 LONG_PTR RPC_VAR_ENTRY
636   NdrDcomAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
637
638 RPCRTAPI void RPC_ENTRY
639   NdrServerCall2( PRPC_MESSAGE pRpcMsg );
640 RPCRTAPI void RPC_ENTRY
641   NdrServerCall( PRPC_MESSAGE pRpcMsg );
642 RPCRTAPI void RPC_ENTRY
643   NdrAsyncServerCall( PRPC_MESSAGE pRpcMsg );
644
645 RPCRTAPI LONG RPC_ENTRY
646   NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
647 RPCRTAPI LONG RPC_ENTRY
648   NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
649 RPCRTAPI LONG RPC_ENTRY
650   NdrAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
651 RPCRTAPI LONG RPC_ENTRY
652   NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase );
653
654 RPCRTAPI void* RPC_ENTRY
655   NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, size_t Len ) __WINE_ALLOC_SIZE(2);
656
657 RPCRTAPI void RPC_ENTRY
658   NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr );
659
660 RPCRTAPI RPC_STATUS RPC_ENTRY
661   NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg, ULONG *pCommStatus,
662                             ULONG *pFaultStatus, RPC_STATUS Status_ );
663
664 RPCRTAPI void* RPC_ENTRY
665   NdrOleAllocate( size_t Size );
666 RPCRTAPI void RPC_ENTRY
667   NdrOleFree( void* NodeToFree );
668
669 RPCRTAPI void RPC_ENTRY
670   NdrClientInitialize( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
671                        PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum );
672 RPCRTAPI void RPC_ENTRY
673   NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
674                           PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum );
675 RPCRTAPI unsigned char* RPC_ENTRY
676   NdrServerInitialize( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc );
677 RPCRTAPI unsigned char* RPC_ENTRY
678   NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc );
679 RPCRTAPI unsigned char* RPC_ENTRY
680   NdrServerInitializeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc, PRPC_MESSAGE pRpcMsg );
681 RPCRTAPI void RPC_ENTRY
682   NdrServerInitializeMarshall( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg  );
683 RPCRTAPI void RPC_ENTRY
684   NdrServerMarshall( struct IRpcStubBuffer *pThis, struct IRpcChannelBuffer *pChannel, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
685 RPCRTAPI void RPC_ENTRY
686   NdrServerUnmarshall( struct IRpcChannelBuffer *pChannel, PRPC_MESSAGE pRpcMsg,
687                        PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc,
688                        PFORMAT_STRING pFormat, void *pParamList );
689 RPCRTAPI unsigned char* RPC_ENTRY
690   NdrGetBuffer( PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC_BINDING_HANDLE handle );
691 RPCRTAPI void RPC_ENTRY
692   NdrFreeBuffer( PMIDL_STUB_MESSAGE pStubMsg );
693 RPCRTAPI unsigned char* RPC_ENTRY
694   NdrSendReceive( PMIDL_STUB_MESSAGE stubmsg, unsigned char *buffer );
695
696 RPCRTAPI unsigned char * RPC_ENTRY
697   NdrNsGetBuffer( PMIDL_STUB_MESSAGE pStubMsg, ULONG BufferLength, RPC_BINDING_HANDLE Handle );
698 RPCRTAPI unsigned char * RPC_ENTRY
699   NdrNsSendReceive( PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pBufferEnd, RPC_BINDING_HANDLE *pAutoHandle );
700
701 RPCRTAPI RPC_STATUS RPC_ENTRY
702   NdrGetDcomProtocolVersion( PMIDL_STUB_MESSAGE pStubMsg, RPC_VERSION *pVersion );
703
704 RPCRTAPI PFULL_PTR_XLAT_TABLES RPC_ENTRY
705   NdrFullPointerXlatInit( ULONG NumberOfPointers, XLAT_SIDE XlatSide );
706 RPCRTAPI void RPC_ENTRY
707   NdrFullPointerXlatFree( PFULL_PTR_XLAT_TABLES pXlatTables );
708 RPCRTAPI int RPC_ENTRY
709   NdrFullPointerQueryPointer( PFULL_PTR_XLAT_TABLES pXlatTables, void *pPointer,
710                               unsigned char QueryType, ULONG *pRefId );
711 RPCRTAPI int RPC_ENTRY
712   NdrFullPointerQueryRefId( PFULL_PTR_XLAT_TABLES pXlatTables, ULONG RefId,
713                             unsigned char QueryType, void **ppPointer );
714 RPCRTAPI void RPC_ENTRY
715   NdrFullPointerInsertRefId( PFULL_PTR_XLAT_TABLES pXlatTables, ULONG RefId, void *pPointer );
716 RPCRTAPI int RPC_ENTRY
717   NdrFullPointerFree( PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer );
718
719 RPCRTAPI void RPC_ENTRY
720   NdrRpcSsEnableAllocate( PMIDL_STUB_MESSAGE pMessage );
721 RPCRTAPI void RPC_ENTRY
722   NdrRpcSsDisableAllocate( PMIDL_STUB_MESSAGE pMessage );
723 RPCRTAPI void RPC_ENTRY
724   NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage );
725 RPCRTAPI void * RPC_ENTRY
726   NdrRpcSmClientAllocate( size_t Size );
727 RPCRTAPI void RPC_ENTRY
728   NdrRpcSmClientFree( void *NodeToFree );
729 RPCRTAPI void * RPC_ENTRY
730   NdrRpcSsDefaultAllocate( size_t Size );
731 RPCRTAPI void RPC_ENTRY
732   NdrRpcSsDefaultFree( void *NodeToFree );
733
734 RPCRTAPI RPC_STATUS RPC_ENTRY
735   NdrGetUserMarshalInfo( ULONG *pFlags, ULONG InformationLevel, NDR_USER_MARSHAL_INFO *pMarshalInfo );
736
737 #ifdef __cplusplus
738 }
739 #endif
740 #endif /*__WINE_RPCNDR_H */