Reimplement NdrSimpleTypeUnmarshall using similar macros to
NdrBaseTypeUnmarshalling without buffer checks, due to
NdrSimpleTypeUnmarshall not doing any safety checks.
This is needed because a context binding handle could be released on
unmarshall, but it still needs to stay valid until the binding handle is
no longer being used.
Re-use the previously unused RPCRT4_ExportBinding function as
RPCRT4_AddRefBinding and rename RPCRT4_DestroyBinding to
RPCRT4_ReleaseBinding to show that it's purpose is to release a
reference count and destroy if necessary, not always destroy.
Structures containing enum fields without the v1_enum attribute must be
treated as complex because of the range check and memory/wire size
differences. This includes a test which didn't pass before and now
passes on Wine and Windows.
count is the total count passed into rpcrt4_conn_np_write. If WriteFile
does a partial write it would end up writing too much subsequent times
through the loop. All tests pass as before.
NdrBaseTypeUnmarshall expects a pointer to a pointer to a base type.
pRetVal contains a pointer to a base type, so we need to pass the
address of pRetVal into call_unmarshaller here.
Don't call memory sizing rountines to compute the size of a type, since
memory sizing routines have side effects like checking there is enough
space in the buffer for the type and incrementing the buffer pointer.
Instead, create a function which returns the necessary size of the
limited set of types we can encounter and remove call_memory_sizer which
is no longer needed.
When using native compiler exceptions, the previous method of doing
this, __EXCEPT(NULL), would expand to __except(
(NULL)(GetExceptionInformation())) which doesn't compile as NULL isn't a
function.
So add a new macro, __EXCEPT_ALL, which works correctly both when using
native compiler exceptions and without and which makes the meaning of
code in which it is used clearer.
When using native compiler exceptions, it isn't valid to use
GetExceptionCode and GetExceptionInformation anywhere other than in the
filter or handler blocks since it would be very hard for the compiler to
work out where to retrieve the exception information from on the stack.
Therefore, remove the WINE_EXCEPTION_FILTER and WINE_FINALLY_FUNC macros
which enabled GetExceptionCode, GetExceptionInformation and
AbnormalTermination to be used inside of the functions they declared and
fix up all callers to access the information directly.
We're never going to implement the undocumented ones and we're moving
more and more towards the architecture of the more recent versions of
native rpcrt4.