00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __HTXBE_H__
00022 #define __HTXBE_H__
00023
00024 #include "formats.h"
00025 #include "xbestruct.h"
00026 #include "htxbeimp.h"
00027
00028 #define DESC_XBE "xbe - XBOX executable"
00029 #define DESC_XBE_HEADER "xbe/header"
00030 #define DESC_XBE_IMAGE "xbe/image"
00031 #define DESC_XBE_IMPORTS "xbe/imports"
00032
00033
00034 #define ATOM_XBE_INIT_FLAGS 0x58420000
00035 #define ATOM_XBE_INIT_FLAGS_STR "58420000"
00036
00037 #define ATOM_XBE_SECTION_FLAGS 0x58420001
00038 #define ATOM_XBE_SECTION_FLAGS_STR "58420001"
00039
00040 #define ATOM_XBE_MEDIA_FLAGS 0x58420002
00041 #define ATOM_XBE_MEDIA_FLAGS_STR "58420002"
00042
00043 #define ATOM_XBE_REGION 0x58420003
00044 #define ATOM_XBE_REGION_STR "58420003"
00045
00046 #define ATOM_XBE_LIBRARY_FLAGS 0x58420004
00047 #define ATOM_XBE_LIBRARY_FLAGS_STR "58420004"
00048
00049
00050 extern format_viewer_if htxbe_if;
00051
00052 struct xbe_section_headers {
00053 dword number_of_sections;
00054 dword base_address;
00055 XBE_SECTION_HEADER *sections;
00056 };
00057
00058 struct ht_xbe_shared_data {
00059 XBE_IMAGE_HEADER header;
00060 XBE_CERTIFICATE certificate;
00061 XBE_LIBRARY_VERSION *libraries;
00062
00063 char *headerspace;
00064 xbe_section_headers sections;
00065
00066 ht_xbe_import imports;
00067
00068
00069 ht_format_viewer *v_header;
00070 ht_view *v_exports;
00071 ht_view *v_imports;
00072 ht_view *v_dimports;
00073 ht_view *v_resources;
00074 ht_view *v_il;
00075 ht_format_viewer *v_image;
00076 };
00077
00078
00079
00080
00081 class ht_xbe: public ht_format_group {
00082 protected:
00083 bool loc_enum;
00084 public:
00085 void init(bounds *b, ht_streamfile *file, format_viewer_if **ifs, ht_format_group *format_group, FILEOFS header_ofs);
00086 virtual void done();
00087
00088 virtual void loc_enum_start();
00089 virtual bool loc_enum_next(ht_format_loc *loc);
00090 };
00091
00092 bool xbe_rva_to_section(xbe_section_headers *section_headers, RVA rva, int *section);
00093 bool xbe_rva_to_ofs(xbe_section_headers *section_headers, RVA rva, FILEOFS *ofs);
00094 bool xbe_rva_is_valid(xbe_section_headers *section_headers, RVA rva);
00095 bool xbe_rva_is_physical(xbe_section_headers *section_headers, RVA rva);
00096
00097 bool xbe_ofs_to_rva(xbe_section_headers *section_headers, FILEOFS ofs, RVA *rva);
00098 bool xbe_ofs_to_section(xbe_section_headers *section_headers, FILEOFS ofs, int *section);
00099 bool xbe_ofs_to_rva_and_section(xbe_section_headers *section_headers, FILEOFS ofs, RVA *rva, int *section);
00100
00101 bool xbe_section_name_to_section(xbe_section_headers *section_headers, const char *name, int *section);
00102
00103 #endif