- Sync rpcrt4 with Wine-1.1.32. ReactOS-specific changes are:
[reactos.git] / reactos / dll / win32 / rpcrt4 / ndr_stubless.h
1 /*
2 * NDR -Oi,-Oif,-Oicf Interpreter
3 *
4 * Copyright 2007 Robert Shearman (for CodeWeavers)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "ndrtypes.h"
22
23 /* there can't be any alignment with the structures in this file */
24 #include "pshpack1.h"
25
26 typedef struct _NDR_PROC_HEADER
27 {
28 /* type of handle to use:
29 * RPC_FC_BIND_EXPLICIT = 0 - Explicit handle.
30 * Handle is passed as a parameter to the function.
31 * Indicates that explicit handle information follows the header,
32 * which actually describes the handle.
33 * RPC_FC_BIND_GENERIC = 31 - Implicit handle with custom binding routines
34 * (MIDL_STUB_DESC::IMPLICIT_HANDLE_INFO::pGenericBindingInfo)
35 * RPC_FC_BIND_PRIMITIVE = 32 - Implicit handle using handle_t created by
36 * calling application
37 * RPC_FC_AUTO_HANDLE = 33 - Automatic handle
38 * RPC_FC_CALLBACK_HANDLE = 34 - undocumented
39 */
40 unsigned char handle_type;
41
42 /* procedure flags:
43 * Oi_FULL_PTR_USED = 0x01 - A full pointer can have the value NULL and can
44 * change during the call from NULL to non-NULL and supports aliasing
45 * and cycles. Indicates that the NdrFullPointerXlatInit function
46 * should be called.
47 * Oi_RPCSS_ALLOC_USED = 0x02 - Use RpcSS allocate/free routines instead of
48 * normal allocate/free routines
49 * Oi_OBJECT_PROC = 0x04 - Indicates a procedure that is part of an OLE
50 * interface, rather than a DCE RPC interface.
51 * Oi_HAS_RPCFLAGS = 0x08 - Indicates that the rpc_flags element is
52 * present in the header.
53 * Oi_HAS_COMM_OR_FAULT = 0x20 - If Oi_OBJECT_PROC not present only then
54 * indicates that the procedure has the comm_status or fault_status
55 * MIDL attribute.
56 * Oi_OBJ_USE_V2_INTERPRETER = 0x20 - If Oi_OBJECT_PROC present only
57 * then indicates that the format string is in -Oif or -Oicf format
58 * Oi_USE_NEW_INIT_ROUTINES = 0x40 - Use NdrXInitializeNew instead of
59 * NdrXInitialize?
60 */
61 unsigned char Oi_flags;
62
63 /* the zero-based index of the procedure */
64 unsigned short proc_num;
65
66 /* total size of all parameters on the stack, including any "this"
67 * pointer and/or return value */
68 unsigned short stack_size;
69 } NDR_PROC_HEADER;
70
71 /* same as above struct except additional element rpc_flags */
72 typedef struct _NDR_PROC_HEADER_RPC
73 {
74 unsigned char handle_type;
75 unsigned char Oi_flags;
76
77 /*
78 * RPCF_Idempotent = 0x0001 - [idempotent] MIDL attribute
79 * RPCF_Broadcast = 0x0002 - [broadcast] MIDL attribute
80 * RPCF_Maybe = 0x0004 - [maybe] MIDL attribute
81 * Reserved = 0x0008 - 0x0080
82 * RPCF_Message = 0x0100 - [message] MIDL attribute
83 * Reserved = 0x0200 - 0x1000
84 * RPCF_InputSynchronous = 0x2000 - unknown
85 * RPCF_Asynchronous = 0x4000 - [async] MIDL attribute
86 * Reserved = 0x8000
87 */
88 unsigned int rpc_flags;
89 unsigned short proc_num;
90 unsigned short stack_size;
91
92 } NDR_PROC_HEADER_RPC;
93
94 typedef struct _NDR_PROC_PARTIAL_OIF_HEADER
95 {
96 /* the pre-computed client buffer size so that interpreter can skip all
97 * or some (if the flag RPC_FC_PROC_OI2F_CLTMUSTSIZE is specified) of the
98 * sizing pass */
99 unsigned short constant_client_buffer_size;
100
101 /* the pre-computed server buffer size so that interpreter can skip all
102 * or some (if the flag RPC_FC_PROC_OI2F_SRVMUSTSIZE is specified) of the
103 * sizing pass */
104 unsigned short constant_server_buffer_size;
105
106 INTERPRETER_OPT_FLAGS Oi2Flags;
107
108 /* number of params */
109 unsigned char number_of_params;
110 } NDR_PROC_PARTIAL_OIF_HEADER;
111
112 typedef struct _NDR_PARAM_OI_BASETYPE
113 {
114 /* parameter direction. One of:
115 * FC_IN_PARAM_BASETYPE = 0x4e - an in param
116 * FC_RETURN_PARAM_BASETYPE = 0x53 - a return param
117 */
118 unsigned char param_direction;
119
120 /* One of: FC_BYTE,FC_CHAR,FC_SMALL,FC_USMALL,FC_WCHAR,FC_SHORT,FC_USHORT,
121 * FC_LONG,FC_ULONG,FC_FLOAT,FC_HYPER,FC_DOUBLE,FC_ENUM16,FC_ENUM32,
122 * FC_ERROR_STATUS_T,FC_INT3264,FC_UINT3264 */
123 unsigned char type_format_char;
124 } NDR_PARAM_OI_BASETYPE;
125
126 typedef struct _NDR_PARAM_OI_OTHER
127 {
128 /* One of:
129 * FC_IN_PARAM = 0x4d - An in param
130 * FC_IN_OUT_PARAM = 0x50 - An in/out param
131 * FC_OUT_PARAM = 0x51 - An out param
132 * FC_RETURN_PARAM = 0x52 - A return value
133 * FC_IN_PARAM_NO_FREE_INST = 0x4f - A param for which no freeing is done
134 */
135 unsigned char param_direction;
136
137 /* Size of param on stack in NUMBERS OF INTS */
138 unsigned char stack_size;
139
140 /* offset in the type format string table */
141 unsigned short type_offset;
142 } NDR_PARAM_OI_OTHER;
143
144 typedef struct _NDR_PARAM_OIF_BASETYPE
145 {
146 PARAM_ATTRIBUTES param_attributes;
147
148 /* the offset on the calling stack where the parameter is located */
149 unsigned short stack_offset;
150
151 /* see NDR_PARAM_OI_BASETYPE::type_format_char */
152 unsigned char type_format_char;
153
154 /* always FC_PAD */
155 unsigned char unused;
156 } NDR_PARAM_OIF_BASETYPE;
157
158 typedef struct _NDR_PARAM_OIF_OTHER
159 {
160 PARAM_ATTRIBUTES param_attributes;
161
162 /* see NDR_PARAM_OIF_BASETYPE::stack_offset */
163 unsigned short stack_offset;
164
165 /* offset into the provided type format string where the type for this
166 * parameter starts */
167 unsigned short type_offset;
168 } NDR_PARAM_OIF_OTHER;
169
170 /* explicit handle description for FC_BIND_PRIMITIVE type */
171 typedef struct _NDR_EHD_PRIMITIVE
172 {
173 /* FC_BIND_PRIMITIVE */
174 unsigned char handle_type;
175
176 /* is the handle passed in via a pointer? */
177 unsigned char flag;
178
179 /* offset from the beginning of the stack to the handle in bytes */
180 unsigned short offset;
181 } NDR_EHD_PRIMITIVE;
182
183 /* explicit handle description for FC_BIND_GENERIC type */
184 typedef struct _NDR_EHD_GENERIC
185 {
186 /* FC_BIND_GENERIC */
187 unsigned char handle_type;
188
189 /* upper 4bits is a flag indicating whether the handle is passed in
190 * via a pointer. lower 4bits is the size of the user defined generic
191 * handle type. the size must be less than or equal to the machine
192 * register size */
193 unsigned char flag_and_size;
194
195 /* offset from the beginning of the stack to the handle in bytes */
196 unsigned short offset;
197
198 /* the index into the aGenericBindingRoutinesPairs field of MIDL_STUB_DESC
199 * giving the bind and unbind routines for the handle */
200 unsigned char binding_routine_pair_index;
201
202 /* FC_PAD */
203 unsigned char unused;
204 } NDR_EHD_GENERIC;
205
206 /* explicit handle description for FC_BIND_CONTEXT type */
207 typedef struct _NDR_EHD_CONTEXT
208 {
209 /* FC_BIND_CONTEXT */
210 unsigned char handle_type;
211
212 /* Any of the following flags:
213 * NDR_CONTEXT_HANDLE_CANNOT_BE_NULL = 0x01
214 * NDR_CONTEXT_HANDLE_SERIALIZE = 0x02
215 * NDR_CONTEXT_HANDLE_NO_SERIALIZE = 0x04
216 * NDR_STRICT_CONTEXT_HANDLE = 0x08
217 * HANDLE_PARAM_IS_OUT = 0x20
218 * HANDLE_PARAM_IS_RETURN = 0x21
219 * HANDLE_PARAM_IS_IN = 0x40
220 * HANDLE_PARAM_IS_VIA_PTR = 0x80
221 */
222 unsigned char flags;
223
224 /* offset from the beginning of the stack to the handle in bytes */
225 unsigned short offset;
226
227 /* zero-based index on rundown routine in apfnNdrRundownRoutines field
228 * of MIDL_STUB_DESC */
229 unsigned char context_rundown_routine_index;
230
231 /* varies depending on NDR version used.
232 * V1: zero-based index into parameters
233 * V2: zero-based index into handles that are parameters */
234 unsigned char param_num;
235 } NDR_EHD_CONTEXT;
236
237 #include "poppack.h"
238
239 void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg,
240 PFORMAT_STRING pFormat, int phase, unsigned char *args,
241 unsigned short stack_size, unsigned char *pRetVal, BOOL object_proc,
242 BOOL ignore_retval);
243 RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply);