4 pidl uses slightly different types to midl by default. The following
5 defines in your MS IDL may make things easier to use the same IDL on
8 #define unistr [string] wchar_t *
15 Let's look at the mutliple ways you can encode an array.
20 A conformant array is one with that ends in [*] or []. The strange
21 things about conformant arrays are:
23 * they can only appear as the last element of a structure
25 * the array size appears before the structure itself on the wire.
33 [size_is(count)] long s[*];
38 [size_is] [abc] [count] [foo] [s...]
40 the first [size_is] field is the allocation size of the array, and
41 occurs before the array elements and even before the structure
44 Note that size_is() can refer to a constant, but that doesn't change
45 the wire representation. It does not make the array a fixed array.
47 midl.exe would write the above array as the following C header:
56 pidl takes a different approach, and writes it like this:
70 A varying array looks like this:
76 [size_is(count)] long *s;
79 This will look like this on the wire:
81 [abc] [count] [foo] [PTR_s] [count] [s...]
87 A fixed array looks like this:
93 The NDR representation looks just like 10 separate long
94 declarations. The array size is not encoded on the wire.
96 pidl also supports "inline" arrays, which are not part of the IDL/NDR
97 standard. These are declared like this:
106 This appears like this:
108 [foo] [count] [bar] [s...]
110 Fixed arrays are an extension added to support some of the strange
111 embedded structures in security descriptors and spoolss.
113 Supported MIDL-compatible properties (attributes is the MIDL term)
114 ------------------------------------
128 PIDL Specific properties
136 Unsupported MIDL properties
137 ---------------------------
210 The [public] property on a structure or union is a pidl extension that
211 forces the generated pull/push functions to be non-static. This allows
212 you to declare types that can be used between modules. If you don't
213 specify [public] then pull/push functions for other than top-level
214 functions are declared static.
219 The [relative] property can be supplied on a pointer. When it is used
220 it declares the pointer as a spoolss style "relative" pointer, which
221 means it appears on the wire as an offset within the current
222 encapsulating structure. This is not part of normal IDL/NDR, but it is
223 a very useful extension as it avoids the manual encoding of many
230 The [noprint] property is a pidl extension that allows you to specify
231 that pidl should not generate a ndr_print_*() function for that
232 structure or union. This is used when you wish to define your own
233 print function that prints a structure in a nicer manner. A good
234 example is the use of [noprint] on dom_sid, which allows the
235 pretty-printing of SIDs.
240 The [value(expression)] property is a pidl extension that allows you
241 to specify the value of a field when it is put on the wire. This
242 allows fields that always have a well-known value to be automatically
243 filled in, thus making the API more programmer friendly. The
244 expression can be any C expression, although if you refer to variables
245 in the current structure you will need to dereference them with
246 r->. See samr_Name as a good example.
249 [nodiscriminant] property
250 -------------------------
252 The [nodiscriminant] property on a union means that the usual uint16
253 discriminent field at the start of the union on the wire is
254 omitted. This is not normally allowed in IDL/NDR, but is used for some
261 We need to write an IDL validator, so we know that we are writing
262 valid IDL. Right now the compiler sails on regardless in many cases
263 even if the IDL is invalid (for example, I don't check that conformant
264 arrays are always the last element in any structure). There are dozens
265 of rules that should be checked.