00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "htmz.h"
00022 #include "htmzhead.h"
00023 #include "httag.h"
00024 #include "formats.h"
00025 #include "snprintf.h"
00026
00027 static ht_mask_ptable mzheader[]=
00028 {
00029 {"magic", STATICTAG_EDIT_WORD_LE("00000000")},
00030 {"bytes on last page of file", STATICTAG_EDIT_WORD_LE("00000002")},
00031 {"pages in file", STATICTAG_EDIT_WORD_LE("00000004")},
00032 {"number of relocations", STATICTAG_EDIT_WORD_LE("00000006")},
00033 {"size of header in paragraphs", STATICTAG_EDIT_WORD_LE("00000008")},
00034 {"minimum extra paragraphs needed", STATICTAG_EDIT_WORD_LE("0000000a")},
00035 {"maximum extra paragraphs needed", STATICTAG_EDIT_WORD_LE("0000000c")},
00036 {"initial SS value", STATICTAG_EDIT_WORD_LE("0000000e")},
00037 {"initial SP value", STATICTAG_EDIT_WORD_LE("00000010")},
00038 {"checksum", STATICTAG_EDIT_WORD_LE("00000012")},
00039 {"initial IP value", STATICTAG_EDIT_WORD_LE("00000014")},
00040 {"initial CS value", STATICTAG_EDIT_WORD_LE("00000016")},
00041 {"offset of relocation table", STATICTAG_EDIT_WORD_LE("00000018")},
00042 {"overlay number", STATICTAG_EDIT_WORD_LE("0000001a")},
00043 {"reserved", STATICTAG_EDIT_BYTE("0000001c")" "STATICTAG_EDIT_BYTE("0000001d")" "STATICTAG_EDIT_BYTE("0000001e")" "STATICTAG_EDIT_BYTE("0000001f")" "STATICTAG_EDIT_BYTE("00000020")" "STATICTAG_EDIT_BYTE("00000021")" "STATICTAG_EDIT_BYTE("00000022")" "STATICTAG_EDIT_BYTE("00000023")},
00044 {"reserved", STATICTAG_EDIT_BYTE("00000024")" "STATICTAG_EDIT_BYTE("00000025")" "STATICTAG_EDIT_BYTE("00000026")" "STATICTAG_EDIT_BYTE("00000027")" "STATICTAG_EDIT_BYTE("00000028")" "STATICTAG_EDIT_BYTE("00000029")" "STATICTAG_EDIT_BYTE("0000002a")" "STATICTAG_EDIT_BYTE("0000002b")},
00045 {"reserved", STATICTAG_EDIT_BYTE("0000002c")" "STATICTAG_EDIT_BYTE("0000002d")" "STATICTAG_EDIT_BYTE("0000002e")" "STATICTAG_EDIT_BYTE("0000002f")" "STATICTAG_EDIT_BYTE("00000030")" "STATICTAG_EDIT_BYTE("00000031")" "STATICTAG_EDIT_BYTE("00000032")" "STATICTAG_EDIT_BYTE("00000033")},
00046 {"reserved", STATICTAG_EDIT_BYTE("00000034")" "STATICTAG_EDIT_BYTE("00000035")" "STATICTAG_EDIT_BYTE("00000036")" "STATICTAG_EDIT_BYTE("00000037")" "STATICTAG_EDIT_BYTE("00000038")" "STATICTAG_EDIT_BYTE("00000039")" "STATICTAG_EDIT_BYTE("0000003a")" "STATICTAG_EDIT_BYTE("0000003b")},
00047 {"file offset of new executable header",STATICTAG_EDIT_DWORD_LE("0000003c")},
00048 {0, 0}
00049 };
00050
00051 static ht_view *htmzheader_init(bounds *b, ht_streamfile *file, ht_format_group *group)
00052 {
00053 ht_uformat_viewer *v=new ht_uformat_viewer();
00054 v->init(b, DESC_MZ_HEADER, VC_EDIT | VC_SEARCH, file, group);
00055 ht_mask_sub *m=new ht_mask_sub();
00056 m->init(file, 0);
00057 char info[128];
00058 ht_snprintf(info, sizeof info, "* MZ header at offset %08x (paragraph=16 bytes, page=512 bytes)", 0);
00059 m->add_mask(info);
00060 m->add_staticmask_ptable(mzheader, 0, false);
00061 v->insertsub(m);
00062 return v;
00063 }
00064
00065 format_viewer_if htmzheader_if = {
00066 htmzheader_init,
00067 0
00068 };