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