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 )
24 #ifndef __WINE_RPCNDR_H
25 #define __WINE_RPCNDR_H
29 /* stupid #if can't handle casts... this __stupidity
30 is just a workaround for that limitation */
32 #define __NDR_CHAR_REP_MASK 0x000fL
33 #define __NDR_INT_REP_MASK 0x00f0L
34 #define __NDR_FLOAT_REP_MASK 0xff00L
36 #define __NDR_IEEE_FLOAT 0x0000L
37 #define __NDR_VAX_FLOAT 0x0100L
38 #define __NDR_IBM_FLOAT 0x0300L
40 #define __NDR_ASCII_CHAR 0x0000L
41 #define __NDR_EBCDIC_CHAR 0x0001L
43 #define __NDR_LITTLE_ENDIAN 0x0010L
44 #define __NDR_BIG_ENDIAN 0x0000L
46 /* Mac's are special */
47 #if defined(__RPC_MAC__)
48 #define __NDR_LOCAL_DATA_REPRESENTATION \
49 (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_BIG_ENDIAN)
51 #define __NDR_LOCAL_DATA_REPRESENTATION \
52 (__NDR_IEEE_FLOAT | __NDR_ASCII_CHAR | __NDR_LITTLE_ENDIAN)
55 #define __NDR_LOCAL_ENDIAN \
56 (__NDR_LOCAL_DATA_REPRESENTATION & __NDR_INT_REP_MASK)
58 /* for convenience, define NDR_LOCAL_IS_BIG_ENDIAN iff it is */
59 #if __NDR_LOCAL_ENDIAN == __NDR_BIG_ENDIAN
60 #define NDR_LOCAL_IS_BIG_ENDIAN
61 #elif __NDR_LOCAL_ENDIAN == __NDR_LITTLE_ENDIAN
62 #undef NDR_LOCAL_IS_BIG_ENDIAN
64 #error alien NDR_LOCAL_ENDIAN - Greg botched the defines again, please report
67 /* finally, do the casts like Microsoft */
69 #define NDR_CHAR_REP_MASK ((unsigned long) __NDR_CHAR_REP_MASK)
70 #define NDR_INT_REP_MASK ((unsigned long) __NDR_INT_REP_MASK)
71 #define NDR_FLOAT_REP_MASK ((unsigned long) __NDR_FLOAT_REP_MASK)
72 #define NDR_IEEE_FLOAT ((unsigned long) __NDR_IEEE_FLOAT)
73 #define NDR_VAX_FLOAT ((unsigned long) __NDR_VAX_FLOAT)
74 #define NDR_IBM_FLOAT ((unsigned long) __NDR_IBM_FLOAT)
75 #define NDR_ASCII_CHAR ((unsigned long) __NDR_ASCII_CHAR)
76 #define NDR_EBCDIC_CHAR ((unsigned long) __NDR_EBCDIC_CHAR)
77 #define NDR_LITTLE_ENDIAN ((unsigned long) __NDR_LITTLE_ENDIAN)
78 #define NDR_BIG_ENDIAN ((unsigned long) __NDR_BIG_ENDIAN)
79 #define NDR_LOCAL_DATA_REPRESENTATION ((unsigned long) __NDR_LOCAL_DATA_REPRESENTATION)
80 #define NDR_LOCAL_ENDIAN ((unsigned long) __NDR_LOCAL_ENDIAN)
83 #define TARGET_IS_NT50_OR_LATER 1
84 #define TARGET_IS_NT40_OR_LATER 1
85 #define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
87 typedef unsigned char byte
;
89 #define MIDL_uhyper unsigned __int64
90 /* 'boolean' tend to conflict, let's call it _wine_boolean */
91 typedef unsigned char _wine_boolean
;
92 /* typedef _wine_boolean boolean; */
94 #define __RPC_CALLEE WINAPI
95 #define RPC_VAR_ENTRY WINAPIV
97 #define MIDL_ascii_strlen(s) strlen(s)
98 #define MIDL_ascii_strcpy(d,s) strcpy(d,s)
99 #define MIDL_memset(d,v,n) memset(d,v,n)
101 #define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8)
102 #define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \
103 (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24)
111 #define NDRSContextValue(hContext) (&(hContext)->userContext)
112 #define cbNDRContext 20
114 typedef void (__RPC_USER
*NDR_RUNDOWN
)(void *context
);
115 typedef void (__RPC_USER
*NDR_NOTIFY_ROUTINE
)(void);
116 typedef void (__RPC_USER
*NDR_NOTIFY2_ROUTINE
)(_wine_boolean flag
);
118 #define DECLSPEC_UUID(x)
119 #define MIDL_INTERFACE(x) struct
121 struct _MIDL_STUB_MESSAGE
;
122 struct _MIDL_STUB_DESC
;
123 struct _FULL_PTR_XLAT_TABLES
;
125 typedef void (__RPC_USER
*EXPR_EVAL
)(struct _MIDL_STUB_MESSAGE
*);
126 typedef const unsigned char *PFORMAT_STRING
;
131 unsigned long *BufferConformanceMark
;
132 unsigned long *BufferVarianceMark
;
133 unsigned long *MaxCountArray
;
134 unsigned long *OffsetArray
;
135 unsigned long *ActualCountArray
;
136 } ARRAY_INFO
, *PARRAY_INFO
;
138 typedef struct _NDR_PIPE_DESC
*PNDR_PIPE_DESC
;
139 typedef struct _NDR_PIPE_MESSAGE
*PNDR_PIPE_MESSAGE
;
140 typedef struct _NDR_ASYNC_MESSAGE
*PNDR_ASYNC_MESSAGE
;
141 typedef struct _NDR_CORRELATION_INFO
*PNDR_CORRELATION_INFO
;
143 #include <pshpack4.h>
144 typedef struct _MIDL_STUB_MESSAGE
147 unsigned char *Buffer
;
148 unsigned char *BufferStart
;
149 unsigned char *BufferEnd
;
150 unsigned char *BufferMark
;
151 unsigned long BufferLength
;
152 unsigned long MemorySize
;
153 unsigned char *Memory
;
156 unsigned char *AllocAllNodesMemory
;
157 unsigned char *AllocAllNodesMemoryEnd
;
158 int IgnoreEmbeddedPointers
;
159 unsigned char *PointerBufferMark
;
160 unsigned char fBufferValid
;
161 unsigned char Unused
;
163 unsigned long Offset
;
164 unsigned long ActualCount
;
165 void * (__RPC_API
*pfnAllocate
)(size_t);
166 void (__RPC_API
*pfnFree
)(void *);
167 unsigned char *StackTop
;
168 unsigned char *pPresentedType
;
169 unsigned char *pTransmitType
;
170 handle_t SavedHandle
;
171 const struct _MIDL_STUB_DESC
*StubDesc
;
172 struct _FULL_PTR_XLAT_TABLES
*FullPtrXlatTables
;
173 unsigned long FullPtrRefId
;
174 unsigned long ulUnused1
;
176 int fDontCallFreeInst
:1;
179 int fHasExtensions
:1;
180 int fHasNewCorrDesc
:1;
182 unsigned long dwDestContext
;
184 NDR_SCONTEXT
*SavedContextHandles
;
186 struct IRpcChannelBuffer
*pRpcChannelBuffer
;
187 PARRAY_INFO pArrayInfo
;
188 unsigned long *SizePtrCountArray
;
189 unsigned long *SizePtrOffsetArray
;
190 unsigned long *SizePtrLengthArray
;
192 unsigned long dwStubPhase
;
193 PNDR_PIPE_DESC pPipeDesc
;
194 PNDR_ASYNC_MESSAGE pAsyncMsg
;
195 PNDR_CORRELATION_INFO pCorrInfo
;
196 unsigned char *pCorrMemory
;
198 ULONG_PTR w2kReserved
[5];
199 } MIDL_STUB_MESSAGE
, *PMIDL_STUB_MESSAGE
;
202 typedef struct _GENERIC_BINDING_ROUTINE_PAIR GENERIC_BINDING_ROUTINE_PAIR
, *PGENERIC_BINDING_ROUTINE_PAIR
;
204 typedef struct __GENERIC_BINDING_INFO GENERIC_BINDING_INFO
, *PGENERIC_BINDING_INFO
;
206 typedef struct _XMIT_ROUTINE_QUINTUPLE XMIT_ROUTINE_QUINTUPLE
, *PXMIT_ROUTINE_QUINTUPLE
;
208 typedef unsigned long (__RPC_USER
*USER_MARSHAL_SIZING_ROUTINE
)(unsigned long *, unsigned long, void *);
209 typedef unsigned char * (__RPC_USER
*USER_MARSHAL_MARSHALLING_ROUTINE
)(unsigned long *, unsigned char *, void *);
210 typedef unsigned char * (__RPC_USER
*USER_MARSHAL_UNMARSHALLING_ROUTINE
)(unsigned long *, unsigned char *, void *);
211 typedef void (__RPC_USER
*USER_MARSHAL_FREEING_ROUTINE
)(unsigned long *, void *);
213 typedef struct _USER_MARSHAL_ROUTINE_QUADRUPLE
215 USER_MARSHAL_SIZING_ROUTINE pfnBufferSize
;
216 USER_MARSHAL_MARSHALLING_ROUTINE pfnMarshall
;
217 USER_MARSHAL_UNMARSHALLING_ROUTINE pfnUnmarshall
;
218 USER_MARSHAL_FREEING_ROUTINE pfnFree
;
219 } USER_MARSHAL_ROUTINE_QUADRUPLE
;
221 typedef struct _MALLOC_FREE_STRUCT MALLOC_FREE_STRUCT
;
223 typedef struct _COMM_FAULT_OFFSETS COMM_FAULT_OFFSETS
;
225 typedef struct _MIDL_STUB_DESC
227 void *RpcInterfaceInformation
;
228 void * (__RPC_API
*pfnAllocate
)(size_t);
229 void (__RPC_API
*pfnFree
)(void *);
231 handle_t
*pAutoHandle
;
232 handle_t
*pPrimitiveHandle
;
233 PGENERIC_BINDING_INFO pGenericBindingInfo
;
234 } IMPLICIT_HANDLE_INFO
;
235 const NDR_RUNDOWN
*apfnNdrRundownRoutines
;
236 const GENERIC_BINDING_ROUTINE_PAIR
*aGenericBindingRoutinePairs
;
237 const EXPR_EVAL
*apfnExprEval
;
238 const XMIT_ROUTINE_QUINTUPLE
*aXmitQuintuple
;
239 const unsigned char *pFormatTypes
;
241 unsigned long Version
;
242 MALLOC_FREE_STRUCT
*pMallocFreeStruct
;
244 const COMM_FAULT_OFFSETS
*CommFaultOffsets
;
245 const USER_MARSHAL_ROUTINE_QUADRUPLE
*aUserMarshalQuadruple
;
246 const NDR_NOTIFY_ROUTINE
*NotifyRoutineTable
;
252 typedef const MIDL_STUB_DESC
*PMIDL_STUB_DESC
;
254 typedef struct _MIDL_FORMAT_STRING
257 #if defined(__GNUC__)
258 unsigned char Format
[0];
260 unsigned char Format
[1];
262 } MIDL_FORMAT_STRING
;
264 typedef void (__RPC_API
*STUB_THUNK
)( PMIDL_STUB_MESSAGE
);
266 typedef long (__RPC_API
*SERVER_ROUTINE
)();
268 typedef struct _MIDL_SERVER_INFO_
270 PMIDL_STUB_DESC pStubDesc
;
271 const SERVER_ROUTINE
*DispatchTable
;
272 PFORMAT_STRING ProcString
;
273 const unsigned short *FmtStringOffset
;
274 const STUB_THUNK
*ThunkTable
;
275 PFORMAT_STRING LocalFormatTypes
;
276 PFORMAT_STRING LocalProcString
;
277 const unsigned short *LocalFmtStringOffset
;
278 } MIDL_SERVER_INFO
, *PMIDL_SERVER_INFO
;
280 typedef struct _MIDL_STUBLESS_PROXY_INFO
282 PMIDL_STUB_DESC pStubDesc
;
283 PFORMAT_STRING ProcFormatString
;
284 const unsigned short *FormatStringOffset
;
285 PFORMAT_STRING LocalFormatTypes
;
286 PFORMAT_STRING LocalProcStrings
;
287 const unsigned short *LocalFmtStringOffset
;
288 } MIDL_STUBLESS_PROXY_INFO
, *PMIDL_STUBLESS_PROXY_INFO
;
290 typedef union _CLIENT_CALL_RETURN
294 } CLIENT_CALL_RETURN
;
300 STUB_CALL_SERVER_NO_HRESULT
311 struct IRpcStubBuffer
;
313 RPCRTAPI
void RPC_ENTRY
314 NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg
, unsigned char* pMemory
, unsigned char FormatChar
);
315 RPCRTAPI
void RPC_ENTRY
316 NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
, unsigned char* pMemory
, unsigned char FormatChar
);
318 /* while MS declares each prototype separately, I prefer to use macros for this kind of thing instead */
319 #define SIMPLE_TYPE_MARSHAL(type) \
320 RPCRTAPI unsigned char* RPC_ENTRY \
321 Ndr##type##Marshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
322 RPCRTAPI unsigned char* RPC_ENTRY \
323 Ndr##type##Unmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc ); \
324 RPCRTAPI void RPC_ENTRY \
325 Ndr##type##BufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ); \
326 RPCRTAPI unsigned long RPC_ENTRY \
327 Ndr##type##MemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat );
329 #define TYPE_MARSHAL(type) \
330 SIMPLE_TYPE_MARSHAL(type) \
331 RPCRTAPI void RPC_ENTRY \
332 Ndr##type##Free( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat );
334 TYPE_MARSHAL(Pointer
)
335 TYPE_MARSHAL(SimpleStruct
)
336 TYPE_MARSHAL(ConformantStruct
)
337 TYPE_MARSHAL(ConformantVaryingStruct
)
338 TYPE_MARSHAL(ComplexStruct
)
339 TYPE_MARSHAL(FixedArray
)
340 TYPE_MARSHAL(ConformantArray
)
341 TYPE_MARSHAL(ConformantVaryingArray
)
342 TYPE_MARSHAL(VaryingArray
)
343 TYPE_MARSHAL(ComplexArray
)
344 TYPE_MARSHAL(EncapsulatedUnion
)
345 TYPE_MARSHAL(NonEncapsulatedUnion
)
346 TYPE_MARSHAL(ByteCountPointer
)
347 TYPE_MARSHAL(XmitOrRepAs
)
348 TYPE_MARSHAL(UserMarshal
)
349 TYPE_MARSHAL(InterfacePointer
)
351 SIMPLE_TYPE_MARSHAL(ConformantString
)
352 SIMPLE_TYPE_MARSHAL(NonConformantString
)
355 #undef SIMPLE_TYPE_MARSHAL
357 RPCRTAPI
void RPC_ENTRY
358 NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg
, PFORMAT_STRING pFormat
, long NumberParams
);
359 RPCRTAPI
void RPC_ENTRY
360 NdrConvert( PMIDL_STUB_MESSAGE pStubMsg
, PFORMAT_STRING pFormat
);
362 LONG_PTR
/* CLIENT_CALL_RETURN */ RPC_VAR_ENTRY
363 NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor
, PFORMAT_STRING pFormat
, ... );
364 LONG_PTR
/* CLIENT_CALL_RETURN */ RPC_VAR_ENTRY
365 NdrClientCall( PMIDL_STUB_DESC pStubDescriptor
, PFORMAT_STRING pFormat
, ... );
367 RPCRTAPI
void RPC_ENTRY
368 NdrServerCall2( PRPC_MESSAGE pRpcMsg
);
369 RPCRTAPI
void RPC_ENTRY
370 NdrServerCall( PRPC_MESSAGE pRpcMsg
);
372 RPCRTAPI
long RPC_ENTRY
373 NdrStubCall2( struct IRpcStubBuffer
* pThis
, struct IRpcChannelBuffer
* pChannel
, PRPC_MESSAGE pRpcMsg
, LPDWORD pdwStubPhase
);
374 RPCRTAPI
long RPC_ENTRY
375 NdrStubCall( struct IRpcStubBuffer
* pThis
, struct IRpcChannelBuffer
* pChannel
, PRPC_MESSAGE pRpcMsg
, LPDWORD pdwStubPhase
);
377 RPCRTAPI
void* RPC_ENTRY
378 NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg
, size_t Len
);
380 RPCRTAPI
void RPC_ENTRY
381 NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg
, PFORMAT_STRING pFormat
, void *ArgAddr
);
383 RPCRTAPI
void* RPC_ENTRY
384 NdrOleAllocate( size_t Size
);
385 RPCRTAPI
void RPC_ENTRY
386 NdrOleFree( void* NodeToFree
);
388 RPCRTAPI
void RPC_ENTRY
389 NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage
, PMIDL_STUB_MESSAGE pStubMsg
,
390 PMIDL_STUB_DESC pStubDesc
, unsigned int ProcNum
);
391 RPCRTAPI
unsigned char* RPC_ENTRY
392 NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg
, PMIDL_STUB_MESSAGE pStubMsg
, PMIDL_STUB_DESC pStubDesc
);
393 RPCRTAPI
unsigned char* RPC_ENTRY
394 NdrGetBuffer( MIDL_STUB_MESSAGE
*stubmsg
, unsigned long buflen
, RPC_BINDING_HANDLE handle
);
395 RPCRTAPI
void RPC_ENTRY
396 NdrFreeBuffer( MIDL_STUB_MESSAGE
*pStubMsg
);
397 RPCRTAPI
unsigned char* RPC_ENTRY
398 NdrSendReceive( MIDL_STUB_MESSAGE
*stubmsg
, unsigned char *buffer
);
400 #endif /*__WINE_RPCNDR_H */