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