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.
Currently, stdole2.tlb isn't generated correctly and causes "<failed>"
to appear instead of "FontEvents" in the IFontEventsDisp typedef when
viewed with oleview.
The problem is that the typedef should just generate a VT_USERDEFINED
record, but ends up generating a VT_PTR -> VT_USERDEFINED. So remove
the extra writing of VT_PTR entries.
Fix the skipped pointers checks in encode_type and encode_type to
specifically detect VT_UNKNOWN and VT_DISPATCH types which don't need
one level of pointers, whereas interfaces encoded as VT_USERDEFINED
do.
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.
This allows widl to catch type redefinitions and report an error, like MIDL.
However, this does a better job than MIDL since it also reports the location
of the originial definition, like GCC.
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.