Esempio n. 1
0
static void
process_image (MonoImage *image, gboolean all) {
	int i;
	const MonoTableInfo *t;
	MonoClass *klass;
	MonoMethod *entry;
	guint32 eptoken;

	if (verbose)
		g_print ("#processing image: %s\n", mono_image_get_name (image));
	eptoken =  mono_image_get_entry_point (image);
	if (eptoken) {
		entry = mono_get_method (image, eptoken, NULL);
		add_types_from_method (entry);
	}
	/* we always add the <Module> type */
	klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | 1);
	handle_type (klass, all? TYPE_ALL: TYPE_BASIC);
	if (all) {
		t = mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
		for (i = 1; i < mono_table_info_get_rows (t); ++i) {
			klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | (i + 1));
			handle_type (klass, all? TYPE_ALL: TYPE_BASIC);
		}
	}
}
Esempio n. 2
0
void CPipeServer::EnumClassesInImage()
{
	int i;
	void *image=(void *)ReadQword();
	void *tdef=mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
	int tdefcount=mono_table_info_get_rows(tdef);


	WriteDword(tdefcount);

	for (i = 0; i < tdefcount; i++)
	{		
		void *c = mono_class_get(image, MONO_TOKEN_TYPE_DEF | i+1);
		char *name=mono_class_get_name(c);

		WriteQword((UINT_PTR)c);

		WriteWord(strlen(name));
		Write(name, strlen(name));	

		name=mono_class_get_namespace(c);
		WriteWord(strlen(name));
		Write(name, strlen(name));	



	}
}
Esempio n. 3
0
MonoMethod*
mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image)
{
	MonoClass *klass;
	const MonoTableInfo *methods;
	MonoMethod *method;
	int i;

	/* Handle short names for system classes */
	if (!desc->name_space && image == mono_defaults.corlib) {
		klass = find_system_class (desc->klass);
		if (klass)
			return mono_method_desc_search_in_class (desc, klass);
	}

	if (desc->name_space && desc->klass) {
		klass = mono_class_try_load_from_name (image, desc->name_space, desc->klass);
		if (!klass)
			return NULL;
		return mono_method_desc_search_in_class (desc, klass);
	}

	/* FIXME: Is this call necessary?  We don't use its result. */
	mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
	methods = mono_image_get_table_info (image, MONO_TABLE_METHOD);
	for (i = 0; i < mono_table_info_get_rows (methods); ++i) {
		MonoError error;
		guint32 token = mono_metadata_decode_row_col (methods, i, MONO_METHOD_NAME);
		const char *n = mono_metadata_string_heap (image, token);

		if (strcmp (n, desc->name))
			continue;
		method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
		if (!method) {
			mono_error_cleanup (&error);
			continue;
		}
		if (mono_method_desc_full_match (desc, method))
			return method;
	}
	return NULL;
}