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