⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htxexhead.cc

📁 功能较全面的反汇编器:反汇编器ht-2.0.15.tar.gz
💻 CC
📖 第 1 页 / 共 2 页
字号:
	s->add_staticmask("disk number        "STATICTAG_EDIT_BYTE("00000012"), ofs, true);	s->add_staticmask("disks total        "STATICTAG_EDIT_BYTE("00000013"), ofs, true);	s->add_staticmask("save game ID       "STATICTAG_EDIT_DWORD_BE("00000014"), ofs, true);	return cs;}static const char *mkkey(String &res, const char *prfx, FileOfs ofs, int size){	res.assign(prfx);	for (int j=0; j < size; j++) {		String str2;		str2.assignFormat(STATICTAG_EDIT_BYTE("%08qx"), ofs+j);		res.append(str2);	}	return res.contentChar();}static ht_sub *add_fileheader(File *file, const char *desc, ht_xex_shared_data &xex_shared){	ht_collapsable_sub *cs;	ht_group_sub *gs = new ht_group_sub();	ht_mask_sub *s = new ht_mask_sub();	gs->init(file);	s->init(file, 2);	cs = new ht_collapsable_sub();	cs->init(file, gs, true, desc, true);	gs->insertsub(s);	FileOfs ofs = xex_shared.header.file_header_offset;	String str;	s->add_staticmask("file header size     "STATICTAG_EDIT_DWORD_BE("00000000"), ofs, true);	s->add_staticmask("image size           "STATICTAG_EDIT_DWORD_BE("00000004"), ofs, true);		s->add_staticmask("key                  "STATICTAG_REF("0000000100000001", "08", "show raw"), ofs, true);	s->add_staticmask("length?              "STATICTAG_EDIT_DWORD_BE("00000108"), ofs, true);	s->add_staticmask("image flags          "STATICTAG_EDIT_DWORD_BE("0000010c"), ofs, true);	s->add_staticmask("load address         "STATICTAG_EDIT_DWORD_BE("00000110"), ofs, true);	s->add_staticmask(mkkey(str, "hash?                ", 0x114, 20) , ofs, true);	s->add_staticmask("unknown              "STATICTAG_EDIT_DWORD_BE("00000128"), ofs, true);	s->add_staticmask(mkkey(str, "hash?                ", 0x12c, 20), ofs, true);	s->add_staticmask(mkkey(str, "unknown              ", 0x140, 16), ofs, true);	s->add_staticmask(mkkey(str, "crypted loader key   ", 0x150, 16), ofs, true);	s->add_staticmask("unknown              "STATICTAG_EDIT_DWORD_BE("00000160"), ofs, true);	s->add_staticmask(mkkey(str, "hash?                ", 0x164, 20) , ofs, true);	s->add_staticmask("game region          "STATICTAG_EDIT_DWORD_BE("00000178"), ofs, true);	s->add_staticmask("media type mask      "STATICTAG_EDIT_DWORD_BE("0000017c")"   "STATICTAG_FLAGS("0000017c", ATOM_XEX_MEDIA_FLAGS_STR), ofs, true);	s->add_staticmask("", ofs, true);	s->add_staticmask("page table entries   "STATICTAG_EDIT_DWORD_BE("00000180"), ofs, true);	s = new ht_mask_sub();	ht_collapsable_sub *cs2 = new ht_collapsable_sub();	s->init(file, 3);	cs2->init(file, s, true, "--- page table ---", true);	gs->insertsub(cs2);	ofs += 0x184;	for (int i=0; i < xex_shared.file_header.pages; i++) {		s->add_staticmask("flags?               "STATICTAG_EDIT_DWORD_BE("00000000"), ofs, true);		s->add_staticmask(mkkey(str, "hash?                ", 0x4, 20) , ofs, true);		ofs += 24;	}	return cs;}static ht_view *htxexheader_init(Bounds *b, File *file, ht_format_group *group){	ht_xex_shared_data &xex_shared = *(ht_xex_shared_data *)group->get_shared_data();	ht_xex_header_viewer *v = new ht_xex_header_viewer();	v->init(b, DESC_XEX_HEADER, VC_EDIT | VC_SEARCH, file, group);	ht_mask_sub *s;	ht_group_sub *gs;	ht_collapsable_sub *cs;	registerAtom(ATOM_XEX_MEDIA_FLAGS, xex_media_flags);		s = new ht_mask_sub();	s->init(file, 0);	char info[128];	ht_snprintf(info, sizeof info, "* XEX header");	s->add_mask(info);	v->insertsub(s);	const bool xex_bigendian = true;		s = new ht_mask_sub();	s->init(file, 1);		/* image header */	s->add_staticmask_ptable(xeximageheader, 0x0, xex_bigendian);	cs = new ht_collapsable_sub();	cs->init(file, s, true, "image header", true);	v->insertsub(cs);	/* file header */	v->insertsub(add_fileheader(file, "file header", xex_shared));		gs = new ht_group_sub();	gs->init(file);	FileOfs ofs = sizeof xex_shared.header;	for (uint i=0; i < xex_shared.header.number_of_sections; i++) {		//STATICTAG_DESC_BYTE_LE("00000001", ATOM_XEX_INFO_CLASS_MAGICS_STR)		switch (xex_shared.info_table_cooked[i].type) {		case XEX_HEADER_FIELD_MODULES:			gs->insertsub(add_resmap(file, "modules", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_LOADERINFO:			gs->insertsub(add_loaderinfo(file, "loader information", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_FILENAME:			gs->insertsub(add_filename(file, "file name", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_LOADBASE:			gs->insertsub(add_single(file, "original base address", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_ENTRY:			gs->insertsub(add_single(file, "entry point", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_BASE:			gs->insertsub(add_single(file, "image base address", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_IMPORT:			gs->insertsub(add_import(file, "imports", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_IDS:			gs->insertsub(add_ids(file, "IDs", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_ORIG_FILENAME:			gs->insertsub(add_filename(file, "original file name", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_RESMAP2:			gs->insertsub(add_resmap(file, "resource map2?", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_STACK_SIZE:			gs->insertsub(add_single(file, "default stack size", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_CACHE_INFO:			gs->insertsub(add_single(file, "cache info", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_MEDIAINFO:			gs->insertsub(add_fileinfo(file, "file information", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_LAN_KEY:			gs->insertsub(add_single(file, "lan key", xex_shared, i, ofs));			break;		case XEX_HEADER_FIELD_IMPORT_UNK:		case XEX_HEADER_FIELD_UNK0:		default: 			gs->insertsub(add_resmap(file, "UNKNOWN", xex_shared, i, ofs));		}		ofs += 8;	}	cs=new ht_collapsable_sub();	cs->init(file, gs, true, "general info table", true);	v->insertsub(cs);	return v;}format_viewer_if htxexheader_if = {	htxexheader_init,	0};/* *	CLASS ht_xex_header_viewer */void ht_xex_header_viewer::init(Bounds *b, const char *desc, int caps, File *file, ht_format_group *group){	ht_uformat_viewer::init(b, desc, caps, file, group);	VIEW_DEBUG_NAME("ht_xex_header_viewer");}static ht_format_viewer *find_hex_viewer(ht_group *group){	// FIXME: God forgive us...	ht_group *vr_group=group;	while (strcmp(vr_group->desc, VIEWERGROUP_NAME)) vr_group=vr_group->group;	ht_view *c=vr_group->getfirstchild();	while (c) {		if (c->desc && (strcmp(c->desc, DESC_HEX)==0)) {			return (ht_format_viewer*)c;		}		c=c->next;	}	return NULL;}bool ht_xex_header_viewer::ref_sel(LINE_ID *id){	ht_xex_shared_data *xex_shared=(ht_xex_shared_data *)format_group->get_shared_data();	ht_format_viewer *hexv = find_hex_viewer(group);	if (!hexv) return false;	switch (id->id1) {	case 0: {		uint32 ofs = xex_shared->info_table_cooked[id->id2].start;		uint32 size = xex_shared->info_table_cooked[id->id2].size;		vstate_save();		hexv->goto_offset(ofs, false);		hexv->pselect_set(ofs, ofs+size);		app->focus(hexv);		return true;	}	case 1:		switch (id->id2) {		case 0: {			vstate_save();			uint32 ofs = xex_shared->header.file_header_offset;			hexv->goto_offset(ofs, false);			hexv->pselect_set(ofs, ofs+xex_shared->file_header.hdr_size);			app->focus(hexv);			return true;		}		case 1: {						vstate_save();			uint32 ofs = xex_shared->header.file_header_offset + 8;			hexv->goto_offset(ofs, false);			hexv->pselect_set(ofs, ofs+256);			app->focus(hexv);			return true;		}		}	}	return false;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -