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