* RegistryKeyTest.cs: Modified GetValueNamesTest and GetSubKeyNamesTest
[mono.git] / mono / metadata / cil-coff.h
index 58600c3e2cf25c70e10072ca9a9295f316430aa2..098057f6fc36d310729c1a893764c69357b28b9e 100644 (file)
 #define METHOD_HEADER_SECTION_FAT_FORMAT  0x40
 #define METHOD_HEADER_SECTION_MORE_SECTS  0x80
 
+/* 128 bytes */
 typedef struct {
-       char msdos_header [128];
+       char    msdos_sig [2];
+       guint16 nlast_page;
+       guint16 npages;
+       char    msdos_header [54];
+       guint32 pe_offset;
+       char    msdos_header2 [64];
 } MonoMSDOSHeader;
 
+/* 20 bytes */
 typedef struct {
        guint16  coff_machine;
        guint16  coff_sections;
@@ -44,6 +51,7 @@ typedef struct {
 #define COFF_ATTRIBUTE_EXECUTABLE_IMAGE 0x0002
 #define COFF_ATTRIBUTE_LIBRARY_IMAGE    0x2000
 
+/* 28 bytes */
 typedef struct {
        guint16 pe_magic;
        guchar  pe_major;
@@ -56,6 +64,7 @@ typedef struct {
        guint32 pe_rva_data_base;
 } MonoPEHeader;
 
+/* 68 bytes */
 typedef struct {
        guint32 pe_image_base;          /* must be 0x400000 */
        guint32 pe_section_align;       /* must be 8192 */
@@ -80,11 +89,80 @@ typedef struct {
        guint32 pe_data_dir_count;
 } MonoPEHeaderNT;
 
+typedef struct {
+       guint32 rde_data_offset;
+       guint32 rde_size;
+       guint32 rde_codepage;
+       guint32 rde_reserved;
+} MonoPEResourceDataEntry;
+
+#define MONO_PE_RESOURCE_ID_CURSOR     0x01
+#define MONO_PE_RESOURCE_ID_BITMAP     0x02
+#define MONO_PE_RESOURCE_ID_ICON       0x03
+#define MONO_PE_RESOURCE_ID_MENU       0x04
+#define MONO_PE_RESOURCE_ID_DIALOG     0x05
+#define MONO_PE_RESOURCE_ID_STRING     0x06
+#define MONO_PE_RESOURCE_ID_FONTDIR    0x07
+#define MONO_PE_RESOURCE_ID_FONT       0x08
+#define MONO_PE_RESOURCE_ID_ACCEL      0x09
+#define MONO_PE_RESOURCE_ID_RCDATA     0x0a
+#define MONO_PE_RESOURCE_ID_MESSAGETABLE       0x0b
+#define MONO_PE_RESOURCE_ID_GROUP_CURSOR       0x0c
+#define MONO_PE_RESOURCE_ID_GROUP_ICON 0x0d
+#define MONO_PE_RESOURCE_ID_VERSION    0x10
+#define MONO_PE_RESOURCE_ID_DLGINCLUDE 0x11
+#define MONO_PE_RESOURCE_ID_PLUGPLAY   0x13
+#define MONO_PE_RESOURCE_ID_VXD                0x14
+#define MONO_PE_RESOURCE_ID_ANICURSOR  0x15
+#define MONO_PE_RESOURCE_ID_ANIICON    0x16
+#define MONO_PE_RESOURCE_ID_HTML       0x17
+
+typedef struct {
+       /* If the MSB is set, then the other 31 bits store the RVA of
+        * the unicode string containing the name.  Otherwise, the
+        * other 31 bits contain the ID of this entry.
+        */
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+       guint32 name_offset:31;
+       guint32 name_is_string:1;
+#else
+       guint32 name_is_string:1;
+       guint32 name_offset:31;
+#endif
+       
+       /* If the MSB is set, then the other 31 bits store the RVA of
+        * another subdirectory.  Otherwise, the other 31 bits store
+        * the RVA of the resource data entry leaf node.
+        */
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+       guint32 dir_offset:31;
+       guint32 is_dir:1;
+#else
+       guint32 is_dir:1;
+       guint32 dir_offset:31;
+#endif
+} MonoPEResourceDirEntry;
+
+typedef struct 
+{
+       guint32 res_characteristics;
+       guint32 res_date_stamp;
+       guint16 res_major;
+       guint16 res_minor;
+       guint16 res_named_entries;
+       guint16 res_id_entries;
+       /* Directory entries follow on here.  The array is
+        * res_named_entries + res_id_entries long, containing all
+        * named entries first.
+        */
+} MonoPEResourceDir;
+
 typedef struct {
        guint32 rva;
        guint32 size;
 } MonoPEDirEntry;
 
+/* 128 bytes */
 typedef struct {
        MonoPEDirEntry pe_export_table;
        MonoPEDirEntry pe_import_table;
@@ -104,6 +182,7 @@ typedef struct {
        MonoPEDirEntry pe_reserved;
 } MonoPEDatadir;
 
+/* 248 bytes */
 typedef struct {
        char            pesig [4];
        MonoCOFFHeader  coff;
@@ -145,6 +224,7 @@ typedef struct {
 
 #define CLI_FLAGS_ILONLY         0x01
 #define CLI_FLAGS_32BITREQUIRED  0x02
+#define CLI_FLAGS_STRONGNAMESIGNED 0x8
 #define CLI_FLAGS_TRACKDEBUGDATA 0x00010000
        guint32        ch_flags;
 
@@ -177,6 +257,5 @@ typedef struct {
 } MonoCLIImageInfo;
 
 guint32       mono_cli_rva_image_map (MonoCLIImageInfo *iinfo, guint32 rva);
-char         *mono_cli_rva_map       (MonoCLIImageInfo *iinfo, guint32 rva);
 
 #endif /* __MONO_CIL_COFF_H__ */