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