Detecting strings is a bit harder than just looking for the string
attribute, so make sure to use the function which has the purpose of
doing just that.
Fixes compilation of generated server/proxy code when a parameter has
both the [out] and [string] attributes.
Only make the structure complex if there is an interface pointer, not
if there is a pointer to a union or complex struct since these are
handled perfectly well by the pointer marshalling code.
Fix the detection of structures with ref-pointers or pointers in 64-bit code.
The non-complex variants depend on the wire size of the
structure/array matching the buffer size, but this no longer applies
when pointers are 8 bytes instead of 4.
The optimisation in write_remoting_arg for sizing, marshalling,
unmarshalling and freeing ref pointers to base types directly was
broken in d458a599eb and caused
unnecessary calls to pointer marshalling functions.
The same was true for a similar optimisation for simple structures
where their size can be pre-calculated, freeing omitted and the
NdrSimpleStructMarshall/Unmarshall functions called directly instead
of calling NdrPointerMarshall/Unmarshall first.
Fix this by looking at the type of the referrent instead of the type
of the pointer, making sure to not classify user types as simple
structures.
Additionally remove some dead code that would never be executed
because the code is in an RPC_FC_RP case, inside a !is_ptr if block
(and RPC_FC_RP is a pointer type).
Replace code to calculate the size of RPC_FC_STRUCT types with
fields_memsize since the memory size of these types will always be
equal to the buffer size.
Remove dead code in get_required_buffer_size.
Descend through as many pointer types as necessary to find the
fundamental type and determine whether it needs a top-level parameter
conformance/variance expression to be written.
Add support for writing top-level parameter conformance/variance
expressions for non-encapsulated unions.
The 8 bytes are for the variance and offset and are added just before
the array, as seen in the marshalling code in rpcrt4. No offset needs
to be added for non-varying structures since the buffer mark is set
after the conformance in marshalled or unmarshalled.
Do so by calculating the alignment of members when iterating through
the structures and adding it onto the buffer and memory offsets.
Only call type_memsize once elsewhere in the embedded pointer
processing functions since the return value will be the same from the
second call.
The conformance needs to be added on to the offset in the buffer so
set this before calling each the writer of each class of pointer
description in write_pointer_description.
Pass the passed in offsets to buffer and memory to
write_pointer_description_offsets in
write_varying_array_pointer_descriptions.