push f2fb4b43e6a5ad960b5745b9c70e0a8fefaca935
[wine/hacks.git] / dlls / rpcrt4 / ndr_stubless.h
blob02850d196cf99560ee6a3ecdb2ad5c8969c11fe2
1 /*
2 * NDR -Oi,-Oif,-Oicf Interpreter
4 * Copyright 2007 Robert Shearman (for CodeWeavers)
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.
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.
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
21 #include "ndrtypes.h"
23 /* there can't be any alignment with the structures in this file */
24 #include "pshpack1.h"
26 /* From http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/parameter_descriptors.asp */
27 typedef struct _NDR_PROC_HEADER
29 /* type of handle to use:
30 * RPC_FC_BIND_EXPLICIT = 0 - Explicit handle.
31 * Handle is passed as a parameter to the function.
32 * Indicates that explicit handle information follows the header,
33 * which actually describes the handle.
34 * RPC_FC_BIND_GENERIC = 31 - Implicit handle with custom binding routines
35 * (MIDL_STUB_DESC::IMPLICIT_HANDLE_INFO::pGenericBindingInfo)
36 * RPC_FC_BIND_PRIMITIVE = 32 - Implicit handle using handle_t created by
37 * calling application
38 * RPC_FC_AUTO_HANDLE = 33 - Automatic handle
39 * RPC_FC_CALLBACK_HANDLE = 34 - undocmented
41 unsigned char handle_type;
43 /* procedure flags:
44 * Oi_FULL_PTR_USED = 0x01 - A full pointer can have the value NULL and can
45 * change during the call from NULL to non-NULL and supports aliasing
46 * and cycles. Indicates that the NdrFullPointerXlatInit function
47 * should be called.
48 * Oi_RPCSS_ALLOC_USED = 0x02 - Use RpcSS allocate/free routines instead of
49 * normal allocate/free routines
50 * Oi_OBJECT_PROC = 0x04 - Indicates a procedure that is part of an OLE
51 * interface, rather than a DCE RPC interface.
52 * Oi_HAS_RPCFLAGS = 0x08 - Indicates that the rpc_flags element is
53 * present in the header.
54 * Oi_HAS_COMM_OR_FAULT = 0x20 - If Oi_OBJECT_PROC not present only then
55 * indicates that the procedure has the comm_status or fault_status
56 * MIDL attribute.
57 * Oi_OBJ_USE_V2_INTERPRETER = 0x20 - If Oi_OBJECT_PROC present only
58 * then indicates that the format string is in -Oif or -Oicf format
59 * Oi_USE_NEW_INIT_ROUTINES = 0x40 - Use NdrXInitializeNew instead of
60 * NdrXInitialize?
62 unsigned char Oi_flags;
64 /* the zero-based index of the procedure */
65 unsigned short proc_num;
67 /* total size of all parameters on the stack, including any "this"
68 * pointer and/or return value */
69 unsigned short stack_size;
70 } NDR_PROC_HEADER;
72 /* same as above struct except additional element rpc_flags */
73 typedef struct _NDR_PROC_HEADER_RPC
75 unsigned char handle_type;
76 unsigned char Oi_flags;
79 * RPCF_Idempotent = 0x0001 - [idempotent] MIDL attribute
80 * RPCF_Broadcast = 0x0002 - [broadcast] MIDL attribute
81 * RPCF_Maybe = 0x0004 - [maybe] MIDL attribute
82 * Reserved = 0x0008 - 0x0080
83 * RPCF_Message = 0x0100 - [message] MIDL attribute
84 * Reserved = 0x0200 - 0x1000
85 * RPCF_InputSynchronous = 0x2000 - unknown
86 * RPCF_Asynchronous = 0x4000 - [async] MIDL attribute
87 * Reserved = 0x8000
89 unsigned long rpc_flags;
90 unsigned short proc_num;
91 unsigned short stack_size;
93 } NDR_PROC_HEADER_RPC;
95 typedef struct _NDR_PROC_PARTIAL_OIF_HEADER
97 /* the pre-computed client buffer size so that interpreter can skip all
98 * or some (if the flag RPC_FC_PROC_OI2F_CLTMUSTSIZE is specified) of the
99 * sizing pass */
100 unsigned short constant_client_buffer_size;
102 /* the pre-computed server buffer size so that interpreter can skip all
103 * or some (if the flag RPC_FC_PROC_OI2F_SRVMUSTSIZE is specified) of the
104 * sizing pass */
105 unsigned short constant_server_buffer_size;
107 INTERPRETER_OPT_FLAGS Oi2Flags;
109 /* number of params */
110 unsigned char number_of_params;
111 } NDR_PROC_PARTIAL_OIF_HEADER;
113 typedef struct _NDR_PARAM_OI_BASETYPE
115 /* parameter direction. One of:
116 * FC_IN_PARAM_BASETYPE = 0x4e - an in param
117 * FC_RETURN_PARAM_BASETYPE = 0x53 - a return param
119 unsigned char param_direction;
121 /* One of: FC_BYTE,FC_CHAR,FC_SMALL,FC_USMALL,FC_WCHAR,FC_SHORT,FC_USHORT,
122 * FC_LONG,FC_ULONG,FC_FLOAT,FC_HYPER,FC_DOUBLE,FC_ENUM16,FC_ENUM32,
123 * FC_ERROR_STATUS_T,FC_INT3264,FC_UINT3264 */
124 unsigned char type_format_char;
125 } NDR_PARAM_OI_BASETYPE;
127 typedef struct _NDR_PARAM_OI_OTHER
129 /* One of:
130 * FC_IN_PARAM = 0x4d - An in param
131 * FC_IN_OUT_PARAM = 0x50 - An in/out param
132 * FC_OUT_PARAM = 0x51 - An out param
133 * FC_RETURN_PARAM = 0x52 - A return value
134 * FC_IN_PARAM_NO_FREE_INST = 0x4f - A param for which no freeing is done
136 unsigned char param_direction;
138 /* Size of param on stack in NUMBERS OF INTS */
139 unsigned char stack_size;
141 /* offset in the type format string table */
142 unsigned short type_offset;
143 } NDR_PARAM_OI_OTHER;
145 typedef struct _NDR_PARAM_OIF_BASETYPE
147 PARAM_ATTRIBUTES param_attributes;
149 /* the offset on the calling stack where the parameter is located */
150 unsigned short stack_offset;
152 /* see NDR_PARAM_OI_BASETYPE::type_format_char */
153 unsigned char type_format_char;
155 /* always FC_PAD */
156 unsigned char unused;
157 } NDR_PARAM_OIF_BASETYPE;
159 typedef struct _NDR_PARAM_OIF_OTHER
161 PARAM_ATTRIBUTES param_attributes;
163 /* see NDR_PARAM_OIF_BASETYPE::stack_offset */
164 unsigned short stack_offset;
166 /* offset into the provided type format string where the type for this
167 * parameter starts */
168 unsigned short type_offset;
169 } NDR_PARAM_OIF_OTHER;
171 /* explicit handle description for FC_BIND_PRIMITIVE type */
172 typedef struct _NDR_EHD_PRIMITIVE
174 /* FC_BIND_PRIMITIVE */
175 unsigned char handle_type;
177 /* is the handle passed in via a pointer? */
178 unsigned char flag;
180 /* offset from the beginning of the stack to the handle in bytes */
181 unsigned short offset;
182 } NDR_EHD_PRIMITIVE;
184 /* explicit handle description for FC_BIND_GENERIC type */
185 typedef struct _NDR_EHD_GENERIC
187 /* FC_BIND_GENERIC */
188 unsigned char handle_type;
190 /* upper 4bits is a flag indicating whether the handle is passed in
191 * via a pointer. lower 4bits is the size of the user defined generic
192 * handle type. the size must be less than or equal to the machine
193 * register size */
194 unsigned char flag_and_size;
196 /* offset from the beginning of the stack to the handle in bytes */
197 unsigned short offset;
199 /* the index into the aGenericBindingRoutinesPairs field of MIDL_STUB_DESC
200 * giving the bind and unbind routines for the handle */
201 unsigned char binding_routine_pair_index;
203 /* FC_PAD */
204 unsigned char unused;
205 } NDR_EHD_GENERIC;
207 /* explicit handle description for FC_BIND_CONTEXT type */
208 typedef struct _NDR_EHD_CONTEXT
210 /* FC_BIND_CONTEXT */
211 unsigned char handle_type;
213 /* Any of the following flags:
214 * NDR_CONTEXT_HANDLE_CANNOT_BE_NULL = 0x01
215 * NDR_CONTEXT_HANDLE_SERIALIZE = 0x02
216 * NDR_CONTEXT_HANDLE_NO_SERIALIZE = 0x04
217 * NDR_STRICT_CONTEXT_HANDLE = 0x08
218 * HANDLE_PARAM_IS_OUT = 0x20
219 * HANDLE_PARAM_IS_RETURN = 0x21
220 * HANDLE_PARAM_IS_IN = 0x40
221 * HANDLE_PARAM_IS_VIA_PTR = 0x80
223 unsigned char flags;
225 /* offset from the beginning of the stack to the handle in bytes */
226 unsigned short offset;
228 /* zero-based index on rundown routine in apfnNdrRundownRoutines field
229 * of MIDL_STUB_DESC */
230 unsigned char context_rundown_routine_index;
232 /* varies depending on NDR version used.
233 * V1: zero-based index into parameters
234 * V2: zero-based index into handles that are parameters */
235 unsigned char param_num;
236 } NDR_EHD_CONTEXT;
238 #include "poppack.h"