1 #ifndef _MONONET_METADATA_IMAGE_H_
2 #define _MONONET_METADATA_IMAGE_H_
8 typedef struct _MonoImage MonoImage;
13 const char *hash_value;
16 guint16 major, minor, build, revision;
22 MonoAssemblyName aname;
35 guint32 rows, row_size;
39 * Tables contain up to 9 columns and the possible sizes of the
40 * fields in the documentation are 1, 2 and 4 bytes. So we
41 * can encode in 2 bits the size.
43 * A 32 bit value can encode the resulting size
45 * The top eight bits encode the number of columns in the table.
46 * we only need 4, but 8 is aligned no shift required.
48 guint32 size_bitfield;
55 const char *assembly_name;
56 const char *module_name;
62 gboolean idx_string_wide, idx_guid_wide, idx_blob_wide;
64 MonoStreamHeader heap_strings;
65 MonoStreamHeader heap_us;
66 MonoStreamHeader heap_blob;
67 MonoStreamHeader heap_guid;
68 MonoStreamHeader heap_tables;
70 const char *tables_base;
72 MonoTableInfo tables [64];
75 * references is initialized only by using the mono_assembly_open
76 * function, and not by using the lowlevel mono_image_open.
78 * It is NULL terminated.
80 MonoAssembly **references;
85 * The Assembly this image was loaded from.
87 MonoAssembly *assembly;
90 * Indexed by method tokens and typedef tokens.
92 GHashTable *method_cache;
93 GHashTable *class_cache;
95 * Indexes namespaces to hash tables that map class name to typedef token.
97 GHashTable *name_cache;
100 * Indexed by ((rank << 24) | (typedef & 0xffffff)), which limits us to a
101 * maximal rank of 255
103 GHashTable *array_cache;
106 * indexed by MonoMethodSignature
108 GHashTable *delegate_begin_invoke_cache;
109 GHashTable *delegate_end_invoke_cache;
110 GHashTable *delegate_invoke_cache;
113 * indexed by MonoMethod pointers
115 GHashTable *runtime_invoke_cache;
116 GHashTable *managed_wrapper_cache;
117 GHashTable *native_wrapper_cache;
118 GHashTable *remoting_invoke_cache;
119 GHashTable *synchronized_cache;
121 void *reflection_info;
124 * user_info is a public field and is not touched by the
132 MONO_IMAGE_ERROR_ERRNO,
133 MONO_IMAGE_MISSING_ASSEMBLYREF,
134 MONO_IMAGE_IMAGE_INVALID
135 } MonoImageOpenStatus;
137 MonoImage *mono_image_open (const char *fname,
138 MonoImageOpenStatus *status);
139 MonoImage *mono_image_loaded (const char *name);
140 MonoImage *mono_image_loaded_by_guid (const char *guid);
141 void mono_image_close (MonoImage *image);
142 const char *mono_image_strerror (MonoImageOpenStatus status);
144 int mono_image_ensure_section (MonoImage *image,
145 const char *section);
146 int mono_image_ensure_section_idx (MonoImage *image,
149 guint32 mono_image_get_entry_point (MonoImage *image);
150 const char *mono_image_get_resource (MonoImage *image, guint32 offset, guint32 *size);
152 void mono_image_load_references (MonoImage *image, MonoImageOpenStatus *status);
154 /* This actually returns a MonoPEResourceDataEntry *, but declaring it
155 * causes an include file loop.
157 gpointer mono_image_lookup_resource (MonoImage *image, guint32 res_id,
158 guint32 lang_id, gunichar2 *name);
160 const char* mono_image_get_public_key (MonoImage *image, guint32 *size);
161 const char* mono_image_get_strong_name (MonoImage *image, guint32 *size);
162 guint32 mono_image_strong_name_position (MonoImage *image, guint32 *size);
163 void mono_image_add_to_name_cache (MonoImage *image,
165 const char *name, guint32 index);