public TypedReference GetNextArg(RuntimeTypeHandle rth)
{
if (sigPtr != IntPtr.Zero)
{
// This is an ordinary ArgIterator capable of determining
// types from a signature. Just do a regular GetNextArg.
return GetNextArg();
}
else
{
// Prevent abuse of this API with a default ArgIterator (it
// doesn't require permission to create a zero-inited value
// type). Check that ArgPtr isn't zero or this API will allow a
// malicious caller to increment the pointer to an arbitrary
// location in memory and read the contents.
if (ArgPtr == IntPtr.Zero)
throw new ArgumentNullException();
TypedReference result = new TypedReference ();
// reference to TypedReference is banned, so have to pass result as pointer
unsafe
{
InternalGetNextArg(&result, rth);
}
return result;
}
}