00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "htnewexe.h"
00022 #include "htle.h"
00023 #include "htlepage.h"
00024 #include "httag.h"
00025 #include "htstring.h"
00026 #include "formats.h"
00027 #include "snprintf.h"
00028
00029 #include "lestruct.h"
00030
00031 #include <stdlib.h>
00032
00033 static ht_mask_ptable lepagemap[]=
00034 {
00035 {"page high", STATICTAG_EDIT_WORD_LE("00000000")},
00036 {"page low", STATICTAG_EDIT_BYTE("00000002")},
00037 {"flags", STATICTAG_EDIT_BYTE("00000003")},
00038 {0, 0}
00039 };
00040
00041 static ht_view *htlepagemaps_init(bounds *b, ht_streamfile *file, ht_format_group *group)
00042 {
00043 ht_le_shared_data *le_shared=(ht_le_shared_data *)group->get_shared_data();
00044
00045 int h=le_shared->hdr_ofs;
00046 ht_uformat_viewer *v=new ht_uformat_viewer();
00047 v->init(b, DESC_LE_PAGEMAP, VC_EDIT | VC_SEARCH, file, group);
00048
00049 ht_mask_sub *m=new ht_mask_sub();
00050 m->init(file, 0);
00051
00052 char t[64];
00053 ht_snprintf(t, sizeof t, "* LE page maps at offset %08x", h+le_shared->hdr.pagemap);
00054 m->add_mask(t);
00055
00056 v->insertsub(m);
00057
00058
00059 bool le_bigendian = false;
00060
00061 for (dword i=0; i<le_shared->hdr.pagecnt; i++) {
00062 m=new ht_mask_sub();
00063 m->init(file, i);
00064
00065 ht_snprintf(t, sizeof t, "--- page %d at %08x ---", i+1, le_shared->pagemap.offset[i]);
00066 m->add_staticmask_ptable(lepagemap, h+le_shared->hdr.pagemap+i*4, le_bigendian);
00067 ht_collapsable_sub *cs=new ht_collapsable_sub();
00068 cs->init(file, m, 1, t, 1);
00069 v->insertsub(cs);
00070 }
00071
00072 le_shared->v_pagemaps=v;
00073 return v;
00074 }
00075
00076 format_viewer_if htlepagemaps_if = {
00077 htlepagemaps_init,
00078 0
00079 };