Avoid warnings.
[wine/multimedia.git] / include / rpcndr.h
blob56a104389fe7722be207caf66503e7587b4743d1
1 /*
2 * Copyright (C) 2000 Francois Gouget
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.
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.
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
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
24 #ifndef __WINE_RPCNDR_H
25 #define __WINE_RPCNDR_H
27 #include "basetsd.h"
28 #include "rpcdcep.h"
30 /* stupid #if can't handle casts... this __stupidity
31 is just a workaround for that limitation */
33 #define __NDR_CHAR_REP_MASK 0x000fL
34 #define __NDR_INT_REP_MASK 0x00f0L
35 #define __NDR_FLOAT_REP_MASK 0xff00L
37 #define __NDR_IEEE_FLOAT 0x0000L
38 #define __NDR_VAX_FLOAT 0x0100L
39 #define __NDR_IBM_FLOAT 0x0300L
41 #define __NDR_ASCII_CHAR 0x0000L
42 #define __NDR_EBCDIC_CHAR 0x0001L
44 #define __NDR_LITTLE_ENDIAN 0x0010L
45 #define __NDR_BIG_ENDIAN 0x0000L
47 /* Mac's are special */
48 #if defined(__RPC_MAC__)
49 #define __NDR_LOCAL_DATA_REPRESENTATION \
50 (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_BIG_ENDIAN)
51 #else
52 #define __NDR_LOCAL_DATA_REPRESENTATION \
53 (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_LITTLE_ENDIAN)
54 #endif
56 #define __NDR_LOCAL_ENDIAN \
57 (__NDR_LOCAL_DATA_REPRESENTATION & __NDR_INT_REP_MASK)
59 /* for convenience, define NDR_LOCAL_IS_BIG_ENDIAN iff it is */
60 #if __NDR_LOCAL_ENDIAN == __NDR_BIG_ENDIAN
61 #define NDR_LOCAL_IS_BIG_ENDIAN
62 #elif __NDR_LOCAL_ENDIAN == __NDR_LITTLE_ENDIAN
63 #undef NDR_LOCAL_IS_BIG_ENDIAN
64 #else
65 #error alien NDR_LOCAL_ENDIAN - Greg botched the defines again, please report
66 #endif
68 /* finally, do the casts like Microsoft */
70 #define NDR_CHAR_REP_MASK ((unsigned long) __NDR_CHAR_REP_MASK)
71 #define NDR_INT_REP_MASK ((unsigned long) __NDR_INT_REP_MASK)
72 #define NDR_FLOAT_REP_MASK ((unsigned long) __NDR_FLOAT_REP_MASK)
73 #define NDR_IEEE_FLOAT ((unsigned long) __NDR_IEEE_FLOAT)
74 #define NDR_VAX_FLOAT ((unsigned long) __NDR_VAX_FLOAT)
75 #define NDR_IBM_FLOAT ((unsigned long) __NDR_IBM_FLOAT)
76 #define NDR_ASCII_CHAR ((unsigned long) __NDR_ASCII_CHAR)
77 #define NDR_EBCDIC_CHAR ((unsigned long) __NDR_EBCDIC_CHAR)
78 #define NDR_LITTLE_ENDIAN ((unsigned long) __NDR_LITTLE_ENDIAN)
79 #define NDR_BIG_ENDIAN ((unsigned long) __NDR_BIG_ENDIAN)
80 #define NDR_LOCAL_DATA_REPRESENTATION ((unsigned long) __NDR_LOCAL_DATA_REPRESENTATION)
81 #define NDR_LOCAL_ENDIAN ((unsigned long) __NDR_LOCAL_ENDIAN)
84 #define TARGET_IS_NT50_OR_LATER 1
85 #define TARGET_IS_NT40_OR_LATER 1
86 #define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
88 typedef unsigned char byte;
89 #define hyper __int64
90 #define MIDL_uhyper unsigned __int64
91 /* 'boolean' tend to conflict, let's call it _wine_boolean */
92 typedef unsigned char _wine_boolean;
93 /* typedef _wine_boolean boolean; */
95 #define __RPC_CALLEE WINAPI
96 #define RPC_VAR_ENTRY WINAPIV
98 #define MIDL_ascii_strlen(s) strlen(s)
99 #define MIDL_ascii_strcpy(d,s) strcpy(d,s)
100 #define MIDL_memset(d,v,n) memset(d,v,n)
102 #define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8)
103 #define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \
104 (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24)
106 typedef struct
108 void *pad[2];
109 void *userContext;
110 } *NDR_SCONTEXT;
112 #define NDRSContextValue(hContext) (&(hContext)->userContext)
113 #define cbNDRContext 20
115 typedef void (__RPC_USER *NDR_RUNDOWN)(void *context);
116 typedef void (__RPC_USER *NDR_NOTIFY_ROUTINE)(void);
117 typedef void (__RPC_USER *NDR_NOTIFY2_ROUTINE)(_wine_boolean flag);
119 #define DECLSPEC_UUID(x)
120 #define MIDL_INTERFACE(x) struct
122 struct _MIDL_STUB_MESSAGE;
123 struct _MIDL_STUB_DESC;
124 struct _FULL_PTR_XLAT_TABLES;
126 typedef void (__RPC_USER *EXPR_EVAL)(struct _MIDL_STUB_MESSAGE *);
127 typedef const unsigned char *PFORMAT_STRING;
129 typedef struct
131 long Dimension;
132 unsigned long *BufferConformanceMark;
133 unsigned long *BufferVarianceMark;
134 unsigned long *MaxCountArray;
135 unsigned long *OffsetArray;
136 unsigned long *ActualCountArray;
137 } ARRAY_INFO, *PARRAY_INFO;
139 typedef struct _NDR_PIPE_DESC *PNDR_PIPE_DESC;
140 typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE;
141 typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
142 typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO;
144 #include "pshpack4.h"
145 typedef struct _MIDL_STUB_MESSAGE
147 PRPC_MESSAGE RpcMsg;
148 unsigned char *Buffer;
149 unsigned char *BufferStart;
150 unsigned char *BufferEnd;
151 unsigned char *BufferMark;
152 unsigned long BufferLength;
153 unsigned long MemorySize;
154 unsigned char *Memory;
155 int IsClient;
156 int ReuseBuffer;
157 unsigned char *AllocAllNodesMemory;
158 unsigned char *AllocAllNodesMemoryEnd;
159 int IgnoreEmbeddedPointers;
160 unsigned char *PointerBufferMark;
161 unsigned char fBufferValid;
162 unsigned char Unused;
163 ULONG_PTR MaxCount;
164 unsigned long Offset;
165 unsigned long ActualCount;
166 void * (__RPC_API *pfnAllocate)(size_t);
167 void (__RPC_API *pfnFree)(void *);
168 unsigned char *StackTop;
169 unsigned char *pPresentedType;
170 unsigned char *pTransmitType;
171 handle_t SavedHandle;
172 const struct _MIDL_STUB_DESC *StubDesc;
173 struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
174 unsigned long FullPtrRefId;
175 unsigned long ulUnused1;
176 int fInDontFree:1;
177 int fDontCallFreeInst:1;
178 int fInOnlyParam:1;
179 int fHasReturn:1;
180 int fHasExtensions:1;
181 int fHasNewCorrDesc:1;
182 int fUnused:10;
183 unsigned long dwDestContext;
184 void *pvDestContext;
185 NDR_SCONTEXT *SavedContextHandles;
186 long ParamNumber;
187 struct IRpcChannelBuffer *pRpcChannelBuffer;
188 PARRAY_INFO pArrayInfo;
189 unsigned long *SizePtrCountArray;
190 unsigned long *SizePtrOffsetArray;
191 unsigned long *SizePtrLengthArray;
192 void *pArgQueue;
193 unsigned long dwStubPhase;
194 PNDR_PIPE_DESC pPipeDesc;
195 PNDR_ASYNC_MESSAGE pAsyncMsg;
196 PNDR_CORRELATION_INFO pCorrInfo;
197 unsigned char *pCorrMemory;
198 void *pMemoryList;
199 ULONG_PTR w2kReserved[5];
200 } MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
201 #include "poppack.h"
203 typedef struct _GENERIC_BINDING_ROUTINE_PAIR GENERIC_BINDING_ROUTINE_PAIR, *PGENERIC_BINDING_ROUTINE_PAIR;
205 typedef struct __GENERIC_BINDING_INFO GENERIC_BINDING_INFO, *PGENERIC_BINDING_INFO;
207 typedef struct _XMIT_ROUTINE_QUINTUPLE XMIT_ROUTINE_QUINTUPLE, *PXMIT_ROUTINE_QUINTUPLE;
209 typedef unsigned long (__RPC_USER *USER_MARSHAL_SIZING_ROUTINE)(unsigned long *, unsigned long, void *);
210 typedef unsigned char * (__RPC_USER *USER_MARSHAL_MARSHALLING_ROUTINE)(unsigned long *, unsigned char *, void *);
211 typedef unsigned char * (__RPC_USER *USER_MARSHAL_UNMARSHALLING_ROUTINE)(unsigned long *, unsigned char *, void *);
212 typedef void (__RPC_USER *USER_MARSHAL_FREEING_ROUTINE)(unsigned long *, void *);
214 typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE
216 USER_MARSHAL_SIZING_ROUTINE pfnBufferSize;
217 USER_MARSHAL_MARSHALLING_ROUTINE pfnMarshall;
218 USER_MARSHAL_UNMARSHALLING_ROUTINE pfnUnmarshall;
219 USER_MARSHAL_FREEING_ROUTINE pfnFree;
220 } USER_MARSHAL_ROUTINE_QUADRUPLE;
222 typedef struct _MALLOC_FREE_STRUCT MALLOC_FREE_STRUCT;
224 typedef struct _COMM_FAULT_OFFSETS COMM_FAULT_OFFSETS;
226 typedef struct _MIDL_STUB_DESC
228 void *RpcInterfaceInformation;
229 void * (__RPC_API *pfnAllocate)(size_t);
230 void (__RPC_API *pfnFree)(void *);
231 union {
232 handle_t *pAutoHandle;
233 handle_t *pPrimitiveHandle;
234 PGENERIC_BINDING_INFO pGenericBindingInfo;
235 } IMPLICIT_HANDLE_INFO;
236 const NDR_RUNDOWN *apfnNdrRundownRoutines;
237 const GENERIC_BINDING_ROUTINE_PAIR *aGenericBindingRoutinePairs;
238 const EXPR_EVAL *apfnExprEval;
239 const XMIT_ROUTINE_QUINTUPLE *aXmitQuintuple;
240 const unsigned char *pFormatTypes;
241 int fCheckBounds;
242 unsigned long Version;
243 MALLOC_FREE_STRUCT *pMallocFreeStruct;
244 long MIDLVersion;
245 const COMM_FAULT_OFFSETS *CommFaultOffsets;
246 const USER_MARSHAL_ROUTINE_QUADRUPLE *aUserMarshalQuadruple;
247 const NDR_NOTIFY_ROUTINE *NotifyRoutineTable;
248 ULONG_PTR mFlags;
249 ULONG_PTR Reserved3;
250 ULONG_PTR Reserved4;
251 ULONG_PTR Reserved5;
252 } MIDL_STUB_DESC;
253 typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;
255 typedef struct _MIDL_FORMAT_STRING
257 short Pad;
258 #if defined(__GNUC__)
259 unsigned char Format[0];
260 #else
261 unsigned char Format[1];
262 #endif
263 } MIDL_FORMAT_STRING;
265 typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
267 typedef long (__RPC_API *SERVER_ROUTINE)();
269 typedef struct _MIDL_SERVER_INFO_
271 PMIDL_STUB_DESC pStubDesc;
272 const SERVER_ROUTINE *DispatchTable;
273 PFORMAT_STRING ProcString;
274 const unsigned short *FmtStringOffset;
275 const STUB_THUNK *ThunkTable;
276 PFORMAT_STRING LocalFormatTypes;
277 PFORMAT_STRING LocalProcString;
278 const unsigned short *LocalFmtStringOffset;
279 } MIDL_SERVER_INFO, *PMIDL_SERVER_INFO;
281 typedef struct _MIDL_STUBLESS_PROXY_INFO
283 PMIDL_STUB_DESC pStubDesc;
284 PFORMAT_STRING ProcFormatString;
285 const unsigned short *FormatStringOffset;
286 PFORMAT_STRING LocalFormatTypes;
287 PFORMAT_STRING LocalProcStrings;
288 const unsigned short *LocalFmtStringOffset;
289 } MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;
291 typedef union _CLIENT_CALL_RETURN
293 void *Pointer;
294 LONG_PTR Simple;
295 } CLIENT_CALL_RETURN;
297 typedef enum {
298 STUB_UNMARSHAL,
299 STUB_CALL_SERVER,
300 STUB_MARSHAL,
301 STUB_CALL_SERVER_NO_HRESULT
302 } STUB_PHASE;
304 typedef enum {
305 PROXY_CALCSIZE,
306 PROXY_GETBUFFER,
307 PROXY_MARSHAL,
308 PROXY_SENDRECEIVE,
309 PROXY_UNMARSHAL
310 } PROXY_PHASE;
312 struct IRpcStubBuffer;
314 RPCRTAPI void RPC_ENTRY
315 NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
316 RPCRTAPI void RPC_ENTRY
317 NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar );
319 /* while MS declares each prototype separately, I prefer to use macros for this kind of thing instead */
320 #define SIMPLE_TYPE_MARSHAL(type) \
321 RPCRTAPI unsigned char* RPC_ENTRY \
322 Ndr##type##Marshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
323 RPCRTAPI unsigned char* RPC_ENTRY \
324 Ndr##type##Unmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc ); \
325 RPCRTAPI void RPC_ENTRY \
326 Ndr##type##BufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
327 RPCRTAPI unsigned long RPC_ENTRY \
328 Ndr##type##MemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
330 #define TYPE_MARSHAL(type) \
331 SIMPLE_TYPE_MARSHAL(type) \
332 RPCRTAPI void RPC_ENTRY \
333 Ndr##type##Free( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
335 TYPE_MARSHAL(Pointer)
336 TYPE_MARSHAL(SimpleStruct)
337 TYPE_MARSHAL(ConformantStruct)
338 TYPE_MARSHAL(ConformantVaryingStruct)
339 TYPE_MARSHAL(ComplexStruct)
340 TYPE_MARSHAL(FixedArray)
341 TYPE_MARSHAL(ConformantArray)
342 TYPE_MARSHAL(ConformantVaryingArray)
343 TYPE_MARSHAL(VaryingArray)
344 TYPE_MARSHAL(ComplexArray)
345 TYPE_MARSHAL(EncapsulatedUnion)
346 TYPE_MARSHAL(NonEncapsulatedUnion)
347 TYPE_MARSHAL(ByteCountPointer)
348 TYPE_MARSHAL(XmitOrRepAs)
349 TYPE_MARSHAL(UserMarshal)
350 TYPE_MARSHAL(InterfacePointer)
352 SIMPLE_TYPE_MARSHAL(ConformantString)
353 SIMPLE_TYPE_MARSHAL(NonConformantString)
355 #undef TYPE_MARSHAL
356 #undef SIMPLE_TYPE_MARSHAL
358 RPCRTAPI void RPC_ENTRY
359 NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, long NumberParams );
360 RPCRTAPI void RPC_ENTRY
361 NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
363 LONG_PTR /* CLIENT_CALL_RETURN */ RPC_VAR_ENTRY
364 NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
365 LONG_PTR /* CLIENT_CALL_RETURN */ RPC_VAR_ENTRY
366 NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
368 RPCRTAPI void RPC_ENTRY
369 NdrServerCall2( PRPC_MESSAGE pRpcMsg );
370 RPCRTAPI void RPC_ENTRY
371 NdrServerCall( PRPC_MESSAGE pRpcMsg );
373 RPCRTAPI long RPC_ENTRY
374 NdrStubCall2( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, LPDWORD pdwStubPhase );
375 RPCRTAPI long RPC_ENTRY
376 NdrStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, LPDWORD pdwStubPhase );
378 RPCRTAPI void* RPC_ENTRY
379 NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, size_t Len );
381 RPCRTAPI void RPC_ENTRY
382 NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr );
384 RPCRTAPI void* RPC_ENTRY
385 NdrOleAllocate( size_t Size );
386 RPCRTAPI void RPC_ENTRY
387 NdrOleFree( void* NodeToFree );
389 RPCRTAPI void RPC_ENTRY
390 NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE pStubMsg,
391 PMIDL_STUB_DESC pStubDesc, unsigned int ProcNum );
392 RPCRTAPI unsigned char* RPC_ENTRY
393 NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg, PMIDL_STUB_DESC pStubDesc );
394 RPCRTAPI unsigned char* RPC_ENTRY
395 NdrGetBuffer( MIDL_STUB_MESSAGE *stubmsg, unsigned long buflen, RPC_BINDING_HANDLE handle );
396 RPCRTAPI void RPC_ENTRY
397 NdrFreeBuffer( MIDL_STUB_MESSAGE *pStubMsg );
398 RPCRTAPI unsigned char* RPC_ENTRY
399 NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char *buffer );
401 #endif /*__WINE_RPCNDR_H */