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

htpef.h

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      htpef.h
00004  *
00005  *      Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de)
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 __HTPEF_H__
00022 #define __HTPEF_H__
00023 
00024 #include "pefstruc.h"
00025 #include "htpefimp.h"
00026 #include "formats.h"
00027 #include "htendian.h"
00028 #include "htformat.h"
00029 
00030 #define DESC_PEF                "pef"
00031 #define DESC_PEF_HEADER         "pef/header"
00032 #define DESC_PEF_IMPORTS        "pef/imports"
00033 #define DESC_PEF_IMAGE          "pef/image"
00034 
00035 #define ATOM_PEF_ARCH                           0x50454600
00036 #define ATOM_PEF_ARCH_STR                        "50454600"
00037 
00038 #define ATOM_PEF_SECTION_KIND                   0x50454601
00039 #define ATOM_PEF_SECTION_KIND_STR                "50454601"
00040 
00041 #define ATOM_PEF_SHARE_KIND                     0x50454602
00042 #define ATOM_PEF_SHARE_KIND_STR                  "50454602"
00043 
00044 extern format_viewer_if htpef_if;
00045 
00046 struct pef_section_headers {
00047         UINT count;
00048         PEF_SECTION_HEADER *sheaders;
00049 };
00050 
00051 struct ht_pef_shared_data {
00052         FILEOFS header_ofs;
00053         PEF_CONTAINER_HEADER contHeader;
00054         endianess byte_order;
00055         pef_section_headers sheaders;
00056         PEF_ARCH arch;
00057         FILEOFS loader_info_header_ofs;         // 0 if not loader_info_header
00058         PEF_LOADER_INFO_HEADER loader_info_header;
00059         
00060         ht_pef_import imports;
00061         
00062         ht_format_viewer *v_header;
00063         ht_view *v_imports;
00064         ht_format_viewer *v_image;
00065 };
00066 
00067 /*
00068  *      ht_pef
00069  */
00070 
00071 class ht_pef: public ht_format_group {
00072 protected:
00073         bool loc_enum;
00074         /* new */
00075 public:
00076                         void init(bounds *b, ht_streamfile *file, format_viewer_if **ifs, ht_format_group *format_group, FILEOFS header_ofs);
00077         virtual void done();
00078 };
00079 
00080 bool pef_phys_and_mem_section(PEF_SECTION_HEADER *s);
00081 bool pef_valid_section(PEF_SECTION_HEADER *s);
00082 
00083 bool pef_addr_to_section(pef_section_headers *section_headers, PEFAddress addr, int *section);
00084 bool pef_addr_to_ofs(pef_section_headers *section_headers, PEFAddress addr, dword *ofs);
00085 bool pef_addr_is_valid(pef_section_headers *section_headers, PEFAddress addr);
00086 
00087 bool pef_ofs_to_addr(pef_section_headers *section_headers, dword ofs, PEFAddress *addr);
00088 bool pef_ofs_to_section(pef_section_headers *section_headers, dword ofs, dword *section);
00089 
00090 #endif /* !__HTPEF_H__ */
00091 

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