1 #ifndef _MONONET_METADATA_IMAGE_H_
2 #define _MONONET_METADATA_IMAGE_H_
8 typedef struct _MonoImage MonoImage;
13 const char *hash_value;
14 const guint8* public_key;
18 guint16 major, minor, build, revision;
24 MonoAssemblyName aname;
37 guint32 rows, row_size;
41 * Tables contain up to 9 columns and the possible sizes of the
42 * fields in the documentation are 1, 2 and 4 bytes. So we
43 * can encode in 2 bits the size.
45 * A 32 bit value can encode the resulting size
47 * The top eight bits encode the number of columns in the table.
48 * we only need 4, but 8 is aligned no shift required.
50 guint32 size_bitfield;
56 /* if f is NULL the image was loaded from raw data */
59 gboolean raw_data_allocated;
61 const char *assembly_name;
62 const char *module_name;
69 gboolean idx_string_wide, idx_guid_wide, idx_blob_wide;
71 MonoStreamHeader heap_strings;
72 MonoStreamHeader heap_us;
73 MonoStreamHeader heap_blob;
74 MonoStreamHeader heap_guid;
75 MonoStreamHeader heap_tables;
77 const char *tables_base;
79 MonoTableInfo tables [64];
82 * references is initialized only by using the mono_assembly_open
83 * function, and not by using the lowlevel mono_image_open.
85 * It is NULL terminated.
87 MonoAssembly **references;
92 * The Assembly this image was loaded from.
94 MonoAssembly *assembly;
97 * Indexed by method tokens and typedef tokens.
99 GHashTable *method_cache;
100 GHashTable *class_cache;
102 /* indexed by a generic type instantiation */
103 GHashTable *generics_cache;
104 /* indexed by typespec tokens. */
105 GHashTable *typespec_cache;
107 * Indexes namespaces to hash tables that map class name to typedef token.
109 GHashTable *name_cache;
112 * Indexed by ((rank << 24) | (typedef & 0xffffff)), which limits us to a
113 * maximal rank of 255
115 GHashTable *array_cache;
118 * indexed by MonoMethodSignature
120 GHashTable *delegate_begin_invoke_cache;
121 GHashTable *delegate_end_invoke_cache;
122 GHashTable *delegate_invoke_cache;
125 * indexed by MonoMethod pointers
127 GHashTable *runtime_invoke_cache;
128 GHashTable *managed_wrapper_cache;
129 GHashTable *native_wrapper_cache;
130 GHashTable *remoting_invoke_cache;
131 GHashTable *synchronized_cache;
133 void *reflection_info;
136 * user_info is a public field and is not touched by the
144 MONO_IMAGE_ERROR_ERRNO,
145 MONO_IMAGE_MISSING_ASSEMBLYREF,
146 MONO_IMAGE_IMAGE_INVALID
147 } MonoImageOpenStatus;
149 void mono_images_init (void);
151 MonoImage *mono_image_open (const char *fname,
152 MonoImageOpenStatus *status);
153 MonoImage *mono_image_open_from_data (char *data, guint32 data_len, gboolean need_copy,
154 MonoImageOpenStatus *status);
155 MonoImage *mono_image_loaded (const char *name);
156 MonoImage *mono_image_loaded_by_guid (const char *guid);
157 void mono_image_init (MonoImage *image);
158 void mono_image_close (MonoImage *image);
159 const char *mono_image_strerror (MonoImageOpenStatus status);
161 int mono_image_ensure_section (MonoImage *image,
162 const char *section);
163 int mono_image_ensure_section_idx (MonoImage *image,
166 guint32 mono_image_get_entry_point (MonoImage *image);
167 const char *mono_image_get_resource (MonoImage *image, guint32 offset, guint32 *size);
168 MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx);
170 /* This actually returns a MonoPEResourceDataEntry *, but declaring it
171 * causes an include file loop.
173 gpointer mono_image_lookup_resource (MonoImage *image, guint32 res_id,
174 guint32 lang_id, gunichar2 *name);
176 const char* mono_image_get_public_key (MonoImage *image, guint32 *size);
177 const char* mono_image_get_strong_name (MonoImage *image, guint32 *size);
178 guint32 mono_image_strong_name_position (MonoImage *image, guint32 *size);
179 void mono_image_add_to_name_cache (MonoImage *image,
181 const char *name, guint32 idx);