}
static int
-is_valid_blob (MonoImage *image, guint32 index, int notnull)
+is_valid_blob (MonoImage *image, guint32 blob_index, int notnull)
{
guint32 size;
- const char *p, *send;
+ const char *p, *blob_end;
- if (index >= image->heap_blob.size)
+ if (blob_index >= image->heap_blob.size)
return 0;
- p = mono_metadata_blob_heap (image, index);
- size = mono_metadata_decode_blob_size (p, &send);
- if (index + size + (send-p) > image->heap_blob.size)
+ p = mono_metadata_blob_heap (image, blob_index);
+ size = mono_metadata_decode_blob_size (p, &blob_end);
+ if (blob_index + size + (blob_end-p) > image->heap_blob.size)
return 0;
if (notnull && !size)
return 0;
}
static const char*
-is_valid_string (MonoImage *image, guint32 index, int notnull)
+is_valid_string (MonoImage *image, guint32 str_index, int notnull)
{
- const char *p, *send, *res;
+ const char *p, *blob_end, *res;
- if (index >= image->heap_strings.size)
+ if (str_index >= image->heap_strings.size)
return NULL;
- res = p = mono_metadata_string_heap (image, index);
- send = mono_metadata_string_heap (image, image->heap_strings.size - 1);
+ res = p = mono_metadata_string_heap (image, str_index);
+ blob_end = mono_metadata_string_heap (image, image->heap_strings.size - 1);
if (notnull && !*p)
return 0;
/*
* FIXME: should check it's a valid utf8 string, too.
*/
- while (p <= send) {
+ while (p <= blob_end) {
if (!*p)
return res;
++p;
};
static const FieldDesc
+monoevent_fields[] = {
+ {"klass", G_STRUCT_OFFSET (MonoReflectionEvent, klass)},
+ {"handle", G_STRUCT_OFFSET (MonoReflectionEvent, event)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monoproperty_fields[] = {
+ {"klass", G_STRUCT_OFFSET (MonoReflectionProperty, klass)},
+ {"prop", G_STRUCT_OFFSET (MonoReflectionProperty, property)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monofield_fields[] = {
+ {"klass", G_STRUCT_OFFSET (MonoReflectionField, klass)},
+ {"fhandle", G_STRUCT_OFFSET (MonoReflectionField, field)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monomethodinfo_fields[] = {
+ {"parent", G_STRUCT_OFFSET (MonoMethodInfo, parent)},
+ {"ret", G_STRUCT_OFFSET (MonoMethodInfo, ret)},
+ {"name", G_STRUCT_OFFSET (MonoMethodInfo, name)},
+ {"attrs", G_STRUCT_OFFSET (MonoMethodInfo, attrs)},
+ {"iattrs", G_STRUCT_OFFSET (MonoMethodInfo, implattrs)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monopropertyinfo_fields[] = {
+ {"parent", G_STRUCT_OFFSET (MonoPropertyInfo, parent)},
+ {"name", G_STRUCT_OFFSET (MonoPropertyInfo, name)},
+ {"get_method", G_STRUCT_OFFSET (MonoPropertyInfo, get)},
+ {"set_method", G_STRUCT_OFFSET (MonoPropertyInfo, set)},
+ {"attrs", G_STRUCT_OFFSET (MonoPropertyInfo, attrs)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monofieldinfo_fields[] = {
+ {"parent", G_STRUCT_OFFSET (MonoFieldInfo, parent)},
+ {"type", G_STRUCT_OFFSET (MonoFieldInfo, type)},
+ {"name", G_STRUCT_OFFSET (MonoFieldInfo, name)},
+ {"attrs", G_STRUCT_OFFSET (MonoFieldInfo, attrs)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monomethod_fields[] = {
+ {"mhandle", G_STRUCT_OFFSET (MonoReflectionMethod, method)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monocmethod_fields[] = {
+ {"mhandle", G_STRUCT_OFFSET (MonoReflectionMethod, method)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+pinfo_fields[] = {
+ {"ClassImpl", G_STRUCT_OFFSET (MonoReflectionParameter, ClassImpl)},
+ {"DefaultValueImpl", G_STRUCT_OFFSET (MonoReflectionParameter, DefaultValueImpl)},
+ {"MemberImpl", G_STRUCT_OFFSET (MonoReflectionParameter, MemberImpl)},
+ {"NameImpl", G_STRUCT_OFFSET (MonoReflectionParameter, NameImpl)},
+ {"PositionImpl", G_STRUCT_OFFSET (MonoReflectionParameter, PositionImpl)},
+ {"AttrsImpl", G_STRUCT_OFFSET (MonoReflectionParameter, AttrsImpl)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+reflection_classes_to_check [] = {
+ {"MonoEvent", monoevent_fields},
+ {"MonoProperty", monoproperty_fields},
+ {"MonoField", monofield_fields},
+ {"MonoMethodInfo", monomethodinfo_fields},
+ {"MonoPropertyInfo", monopropertyinfo_fields},
+ {"MonoFieldInfo", monofieldinfo_fields},
+ {"MonoMethod", monomethod_fields},
+ {"MonoCMethod", monocmethod_fields},
+ {"ParameterInfo", pinfo_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+enuminfo_fields[] = {
+ {"utype", G_STRUCT_OFFSET (MonoEnumInfo, utype)},
+ {"values", G_STRUCT_OFFSET (MonoEnumInfo, values)},
+ {"names", G_STRUCT_OFFSET (MonoEnumInfo, names)},
+ {NULL, 0}
+};
+
+static FieldDesc
delegate_fields[] = {
{"target_type", G_STRUCT_OFFSET (MonoDelegate, target_type)},
{"m_target", G_STRUCT_OFFSET (MonoDelegate, target)},
- {"method", G_STRUCT_OFFSET (MonoDelegate, method)},
+ {"method_name", G_STRUCT_OFFSET (MonoDelegate, method_name)},
{"method_ptr", G_STRUCT_OFFSET (MonoDelegate, method_ptr)},
+ {"delegate_trampoline", G_STRUCT_OFFSET (MonoDelegate, delegate_trampoline)},
+ {"method_info", G_STRUCT_OFFSET (MonoDelegate, method_info)},
+ {NULL, 0}
+};
+
+static FieldDesc
+multicast_delegate_fields[] = {
+ {"prev", G_STRUCT_OFFSET (MonoMulticastDelegate, prev)},
+ {NULL, 0}
+};
+
+static FieldDesc
+async_result_fields[] = {
+ {"async_state", G_STRUCT_OFFSET (MonoAsyncResult, async_state)},
+ {"handle", G_STRUCT_OFFSET (MonoAsyncResult, handle)},
+ {"async_delegate", G_STRUCT_OFFSET (MonoAsyncResult, async_delegate)},
+ {"data", G_STRUCT_OFFSET (MonoAsyncResult, data)},
+ {"sync_completed", G_STRUCT_OFFSET (MonoAsyncResult, sync_completed)},
+ {"completed", G_STRUCT_OFFSET (MonoAsyncResult, completed)},
+ {"endinvoke_called", G_STRUCT_OFFSET (MonoAsyncResult, endinvoke_called)},
{NULL, 0}
};
static const ClassDesc
system_classes_to_check [] = {
+ {"MonoEnumInfo", enuminfo_fields},
{"Delegate", delegate_fields},
+ {"MulticastDelegate", multicast_delegate_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+mono_method_message_fields[] = {
+ {"method", G_STRUCT_OFFSET (MonoMethodMessage, method)},
+ {"args", G_STRUCT_OFFSET (MonoMethodMessage, args)},
+ {"names", G_STRUCT_OFFSET (MonoMethodMessage, names)},
+ {"arg_types", G_STRUCT_OFFSET (MonoMethodMessage, arg_types)},
+ {"ctx", G_STRUCT_OFFSET (MonoMethodMessage, ctx)},
+ {"rval", G_STRUCT_OFFSET (MonoMethodMessage, rval)},
+ {"exc", G_STRUCT_OFFSET (MonoMethodMessage, exc)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+messaging_classes_to_check [] = {
+ {"AsyncResult", async_result_fields},
+ {"MonoMethodMessage", mono_method_message_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+transparent_proxy_fields[] = {
+ {"_rp", G_STRUCT_OFFSET (MonoTransparentProxy, rp)},
+ {NULL, 0}
+};
+
+static FieldDesc
+real_proxy_fields[] = {
+ {"class_to_proxy", G_STRUCT_OFFSET (MonoRealProxy, class_to_proxy)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+proxy_classes_to_check [] = {
+ {"TransparentProxy", transparent_proxy_fields},
+ {"RealProxy", real_proxy_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+wait_handle_fields[] = {
+ {"os_handle", G_STRUCT_OFFSET (MonoWaitHandle, handle)},
+ {"disposed", G_STRUCT_OFFSET (MonoWaitHandle, disposed)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+threading_classes_to_check [] = {
+ {"WaitHandle", wait_handle_fields},
{NULL, NULL}
};
static const NameSpaceDesc
namespaces_to_check[] = {
+ {"System.Runtime.Remoting.Proxies", proxy_classes_to_check},
+ {"System.Runtime.Remoting.Messaging", messaging_classes_to_check},
{"System.Reflection.Emit", emit_classes_to_check},
+ {"System.Reflection", reflection_classes_to_check},
+ {"System.Threading", threading_classes_to_check},
{"System", system_classes_to_check},
{NULL, NULL}
};