2010-05-13 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / metadata / image.h
bloba42be33a3e4eaa981dab58f76627e2533816ac62
1 #ifndef _MONONET_METADATA_IMAGE_H_
2 #define _MONONET_METADATA_IMAGE_H_
4 #include <stdio.h>
5 #include <mono/utils/mono-publib.h>
7 MONO_BEGIN_DECLS
9 typedef struct _MonoImage MonoImage;
10 typedef struct _MonoAssembly MonoAssembly;
11 typedef struct _MonoAssemblyName MonoAssemblyName;
12 typedef struct _MonoTableInfo MonoTableInfo;
14 typedef enum {
15 MONO_IMAGE_OK,
16 MONO_IMAGE_ERROR_ERRNO,
17 MONO_IMAGE_MISSING_ASSEMBLYREF,
18 MONO_IMAGE_IMAGE_INVALID
19 } MonoImageOpenStatus;
21 void mono_images_init (void);
22 void mono_images_cleanup (void);
24 MonoImage *mono_image_open (const char *fname,
25 MonoImageOpenStatus *status);
26 MonoImage *mono_image_open_full (const char *fname,
27 MonoImageOpenStatus *status, mono_bool refonly);
28 MonoImage *mono_pe_file_open (const char *fname,
29 MonoImageOpenStatus *status);
30 MonoImage *mono_image_open_from_data (char *data, uint32_t data_len, mono_bool need_copy,
31 MonoImageOpenStatus *status);
32 MonoImage *mono_image_open_from_data_full (char *data, uint32_t data_len, mono_bool need_copy,
33 MonoImageOpenStatus *status, mono_bool refonly);
34 MonoImage *mono_image_open_from_data_with_name (char *data, uint32_t data_len, mono_bool need_copy,
35 MonoImageOpenStatus *status, mono_bool refonly, const char *name);
36 void mono_image_fixup_vtable (MonoImage *image);
37 MonoImage *mono_image_loaded (const char *name);
38 MonoImage *mono_image_loaded_full (const char *name, mono_bool refonly);
39 MonoImage *mono_image_loaded_by_guid (const char *guid);
40 MonoImage *mono_image_loaded_by_guid_full (const char *guid, mono_bool refonly);
41 void mono_image_init (MonoImage *image);
42 void mono_image_close (MonoImage *image);
43 void mono_image_addref (MonoImage *image);
44 const char *mono_image_strerror (MonoImageOpenStatus status);
46 int mono_image_ensure_section (MonoImage *image,
47 const char *section);
48 int mono_image_ensure_section_idx (MonoImage *image,
49 int section);
51 uint32_t mono_image_get_entry_point (MonoImage *image);
52 const char *mono_image_get_resource (MonoImage *image, uint32_t offset, uint32_t *size);
53 MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx);
55 MonoImage* mono_image_load_module (MonoImage *image, int idx);
57 const char* mono_image_get_name (MonoImage *image);
58 const char* mono_image_get_filename (MonoImage *image);
59 const char * mono_image_get_guid (MonoImage *image);
60 MonoAssembly* mono_image_get_assembly (MonoImage *image);
61 mono_bool mono_image_is_dynamic (MonoImage *image);
62 char* mono_image_rva_map (MonoImage *image, uint32_t rva);
64 const MonoTableInfo *mono_image_get_table_info (MonoImage *image, int table_id);
65 int mono_image_get_table_rows (MonoImage *image, int table_id);
66 int mono_table_info_get_rows (const MonoTableInfo *table);
68 /* This actually returns a MonoPEResourceDataEntry *, but declaring it
69 * causes an include file loop.
71 void* mono_image_lookup_resource (MonoImage *image, uint32_t res_id,
72 uint32_t lang_id, mono_unichar2 *name);
74 const char* mono_image_get_public_key (MonoImage *image, uint32_t *size);
75 const char* mono_image_get_strong_name (MonoImage *image, uint32_t *size);
76 uint32_t mono_image_strong_name_position (MonoImage *image, uint32_t *size);
77 void mono_image_add_to_name_cache (MonoImage *image,
78 const char *nspace, const char *name, uint32_t idx);
79 mono_bool mono_image_has_authenticode_entry (MonoImage *image);
81 MONO_END_DECLS
83 #endif