Some more RPC definitions.
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #ifndef __WINE_RPCNDR_H
20 #define __WINE_RPCNDR_H
21
22 #ifndef __RPCNDR_H_VERSION__
23 /* FIXME: I'm not sure what version though */
24 #define __RPCNDR_H_VERSION__
25 #endif
26
27 #define TARGET_IS_NT40_OR_LATER 1
28 #define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
29
30 typedef unsigned char byte;
31 typedef __int64 hyper;
32 typedef __uint64 MIDL_uhyper;
33 /* 'boolean' tend to conflict, let's call it _wine_boolean */
34 typedef unsigned char _wine_boolean;
35 /* typedef _wine_boolean boolean; */
36
37 #define __RPC_CALLEE WINAPI
38 #define RPC_VAR_ENTRY WINAPIV
39
40 typedef struct
41 {
42   void *pad[2];
43   void *userContext;
44 } *NDR_SCONTEXT;
45
46 #define NDRSContextValue(hContext) (&(hContext)->userContext)
47 #define cbNDRContext 20
48
49 typedef void (__RPC_USER *NDR_RUNDOWN)(void *context);
50 typedef void (__RPC_USER *NDR_NOTIFY_ROUTINE)(void);
51 typedef void (__RPC_USER *NDR_NOTIFY2_ROUTINE)(_wine_boolean flag);
52
53 #define DECLSPEC_UUID(x)
54 #define MIDL_INTERFACE(x)   struct
55
56 struct _MIDL_STUB_MESSAGE;
57 struct _MIDL_STUB_DESC;
58 struct _FULL_PTR_XLAT_TABLES;
59
60 typedef void (__RPC_USER *EXPR_EVAL)(struct _MIDL_STUB_MESSAGE *);
61 typedef const unsigned char *PFORMAT_STRING;
62
63 typedef struct
64 {
65   long Dimension;
66   unsigned long *BufferConformanceMark;
67   unsigned long *BufferVarianceMark;
68   unsigned long *MaxCountArray;
69   unsigned long *OffsetArray;
70   unsigned long *ActualCountArray;
71 } ARRAY_INFO, *PARRAY_INFO;
72
73 typedef struct _NDR_PIPE_DESC *PNDR_PIPE_DESC;
74 typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE;
75 typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
76 typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO;
77
78 #include "pshpack4.h"
79 typedef struct _MIDL_STUB_MESSAGE
80 {
81   PRPC_MESSAGE RpcMsg;
82   unsigned char *Buffer;
83   unsigned char *BufferStart;
84   unsigned char *BufferEnd;
85   unsigned char *BufferMark;
86   unsigned long BufferLength;
87   unsigned long MemorySize;
88   unsigned char *Memory;
89   int IsClient;
90   int ReuseBuffer;
91   unsigned char *AllocAllNodesMemory;
92   unsigned char *AllocAllNodesMemoryEnd;
93   int IgnoreEmbeddedPointers;
94   unsigned char *PointerBufferMark;
95   unsigned char fBufferValid;
96   unsigned char uFlags;
97   ULONG_PTR MaxCount;
98   unsigned long Offset;
99   unsigned long ActualCount;
100   void * (__RPC_API *pfnAllocate)(size_t);
101   void (__RPC_API *pfnFree)(void *);
102   unsigned char *StackTop;
103   unsigned char *pPresentedType;
104   unsigned char *pTransmitType;
105   handle_t SavedHandle;
106   const struct _MIDL_STUB_DESC *StubDesc;
107   struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
108   unsigned long FullPtrRefId;
109   unsigned long ulUnused1;
110   int fInDontFree:1;
111   int fDontCallFreeInst:1;
112   int fInOnlyParam:1;
113   int fHasReturn:1;
114   int fHasExtensions:1;
115   int fHasNewCorrDesc:1;
116   int fUnused:10;
117   unsigned long dwDestContext;
118   void *pvDestContext;
119   NDR_SCONTEXT *SavedContextHandles;
120   long ParamNumber;
121   struct IRpcChannelBuffer *pRpcChannelBuffer;
122   PARRAY_INFO pArrayInfo;
123   unsigned long *SizePtrCountArray;
124   unsigned long *SizePtrOffsetArray;
125   unsigned long *SizePtrLengthArray;
126   void *pArgQueue;
127   unsigned long dwStubPhase;
128   PNDR_PIPE_DESC pPipeDesc;
129   PNDR_ASYNC_MESSAGE pAsyncMsg;
130   PNDR_CORRELATION_INFO pCorrInfo;
131   unsigned char *pCorrMemory;
132   void *pMemoryList;
133   ULONG_PTR w2kReserved[5];
134 } MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
135 #include "poppack.h"
136
137 typedef struct _GENERIC_BINDING_ROUTINE_PAIR GENERIC_BINDING_ROUTINE_PAIR, *PGENERIC_BINDING_ROUTINE_PAIR;
138
139 typedef struct __GENERIC_BINDING_INFO GENERIC_BINDING_INFO, *PGENERIC_BINDING_INFO;
140
141 typedef struct _XMIT_ROUTINE_QUINTUPLE XMIT_ROUTINE_QUINTUPLE, *PXMIT_ROUTINE_QUINTUPLE;
142
143 typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE USER_MARSHAL_ROUTINE_QUADRUPLE;
144
145 typedef struct _MALLOC_FREE_STRUCT MALLOC_FREE_STRUCT;
146
147 typedef struct _COMM_FAULT_OFFSETS COMM_FAULT_OFFSETS;
148
149 typedef struct _MIDL_STUB_DESC
150 {
151   void *RpcInterfaceInformation;
152   void * (__RPC_API *pfnAllocate)(size_t);
153   void (__RPC_API *pfnFree)(void *);
154   union {
155     handle_t *pAutoHandle;
156     handle_t *pPrimitiveHandle;
157     PGENERIC_BINDING_INFO pGenericBindingInfo;
158   } IMPLICIT_HANDLE_INFO;
159   const NDR_RUNDOWN *apfnNdrRundownRoutines;
160   const GENERIC_BINDING_ROUTINE_PAIR *aGenericBindingRoutinePairs;
161   const EXPR_EVAL *apfnExprEval;
162   const XMIT_ROUTINE_QUINTUPLE *aXmitQuintuple;
163   const unsigned char *pFormatTypes;
164   int fCheckBounds;
165   unsigned long Version;
166   MALLOC_FREE_STRUCT *pMallocFreeStruct;
167   long MIDLVersion;
168   const COMM_FAULT_OFFSETS *CommFaultOffsets;
169   const USER_MARSHAL_ROUTINE_QUADRUPLE *aUserMarshalQuadruple;
170   const NDR_NOTIFY_ROUTINE *NotifyRoutineTable;
171   ULONG_PTR mFlags;
172   ULONG_PTR Reserved3;
173   ULONG_PTR Reserved4;
174   ULONG_PTR Reserved5;
175 } MIDL_STUB_DESC;
176 typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;
177
178 typedef struct _MIDL_FORMAT_STRING
179 {
180   short Pad;
181 #if defined(__GNUC__)
182   unsigned char Format[0];
183 #else
184   unsigned char Format[1];
185 #endif
186 } MIDL_FORMAT_STRING;
187
188 typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
189
190 typedef long (__RPC_API *SERVER_ROUTINE)();
191
192 typedef struct _MIDL_SERVER_INFO_
193 {
194   PMIDL_STUB_DESC pStubDesc;
195   const SERVER_ROUTINE *DispatchTable;
196   PFORMAT_STRING ProcString;
197   const unsigned short *FmtStringOffset;
198   const STUB_THUNK *ThunkTable;
199   PFORMAT_STRING LocalFormatTypes;
200   PFORMAT_STRING LocalProcString;
201   const unsigned short *LocalFmtStringOffset;
202 } MIDL_SERVER_INFO, *PMIDL_SERVER_INFO;
203
204 typedef struct _MIDL_STUBLESS_PROXY_INFO
205 {
206   PMIDL_STUB_DESC pStubDesc;
207   PFORMAT_STRING ProcFormatString;
208   const unsigned short *FormatStringOffset;
209   PFORMAT_STRING LocalFormatTypes;
210   PFORMAT_STRING LocalProcStrings;
211   const unsigned short *LocalFmtStringOffset;
212 } MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;
213
214 typedef union _CLIENT_CALL_RETURN
215 {
216   void *Pointer;
217   LONG_PTR Simple;
218 } CLIENT_CALL_RETURN;
219
220 typedef enum {
221   STUB_UNMARSHAL,
222   STUB_CALL_SERVER,
223   STUB_MARSHAL,
224   STUB_CALL_SERVER_NO_HRESULT
225 } STUB_PHASE;
226
227 typedef enum {
228   PROXY_CALCSIZE,
229   PROXY_GETBUFFER,
230   PROXY_MARSHAL,
231   PROXY_SENDRECEIVE,
232   PROXY_UNMARSHAL
233 } PROXY_PHASE;
234
235 struct IRpcStubBuffer;
236
237 RPCRTAPI void RPC_ENTRY
238   NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
239 RPCRTAPI void RPC_ENTRY
240   NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
241
242 /* while MS declares each prototype separately, I prefer to use macros for this kind of thing instead */
243 #define TYPE_MARSHAL(type) \
244 RPCRTAPI unsigned char* RPC_ENTRY \
245   Ndr##type##Marshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
246 RPCRTAPI unsigned char* RPC_ENTRY \
247   Ndr##type##Unmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc ); \
248 RPCRTAPI void RPC_ENTRY \
249   Ndr##type##BufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
250 RPCRTAPI unsigned long RPC_ENTRY \
251   Ndr##type##MemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat ); \
252 RPCRTAPI void RPC_ENTRY \
253   Ndr##type##Free( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
254
255 TYPE_MARSHAL(Pointer)
256 TYPE_MARSHAL(SimpleStruct)
257 TYPE_MARSHAL(ConformantStruct)
258 TYPE_MARSHAL(ConformantVaryingStruct)
259 TYPE_MARSHAL(ComplexStruct)
260 TYPE_MARSHAL(FixedArray)
261 TYPE_MARSHAL(ConformantArray)
262 TYPE_MARSHAL(ConformantVaryingArray)
263 TYPE_MARSHAL(VaryingArray)
264 TYPE_MARSHAL(ComplexArray)
265 TYPE_MARSHAL(EncapsulatedUnion)
266 TYPE_MARSHAL(NonEncapsulatedUnion)
267 TYPE_MARSHAL(ByteCountPointer)
268 TYPE_MARSHAL(XmitOrRepAs)
269 TYPE_MARSHAL(UserMarshal)
270 TYPE_MARSHAL(InterfacePointer)
271
272 #undef TYPE_MARSHAL
273
274 RPCRTAPI void RPC_ENTRY
275   NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, long NumberParams );
276 RPCRTAPI void RPC_ENTRY
277   NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
278
279 CLIENT_CALL_RETURN RPC_VAR_ENTRY
280   NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
281 CLIENT_CALL_RETURN RPC_VAR_ENTRY
282   NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
283
284 RPCRTAPI void RPC_ENTRY
285   NdrServerCall2( PRPC_MESSAGE pRpcMsg );
286 RPCRTAPI void RPC_ENTRY
287   NdrServerCall( PRPC_MESSAGE pRpcMsg );
288
289 RPCRTAPI long RPC_ENTRY
290   NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, LPDWORD pdwStubPhase );
291 RPCRTAPI long RPC_ENTRY
292   NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, LPDWORD pdwStubPhase );
293
294 RPCRTAPI void* RPC_ENTRY
295   NdrOleAllocate( size_t Size );
296 RPCRTAPI void RPC_ENTRY
297   NdrOleFree( void* NodeToFree );
298
299 #endif /*__WINE_RPCNDR_H */