00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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;
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
00069
00070
00071 class ht_pef: public ht_format_group {
00072 protected:
00073 bool loc_enum;
00074
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
00091