Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

htxbe.h

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      htxbe.h
00004  *
00005  *      Copyright (C) 2003 Stefan Esser
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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  *      ht_xbe
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         /* overwritten */
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 /* !__HTXBE_H__ */

Generated on Fri May 7 21:15:38 2004 by doxygen 1.3.5