该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
刚好之前有写过这东西 ... 放段代码 ...
void PeinfoWindow::ShowPeBaseInfo (wxString& FileName)
{
static PCHAR pMemory;
pMemory = _SharedCounter::pMemory;
/* IMAGE_DOS_HEADER Check */
if (*(PWORD)pMemory != IMAGE_DOS_SIGNATURE );
pTextCtrl->AppendText(wxString::Format(wxT("文件名:%s\r\n---------------------\
--------------------------------\r\nDOS头信息\r\n-----------------------\
------------------------------\r\n 初始化堆栈段: 0x%04x\r\n\
初始化堆栈指针: 0x%04x\r\n 入口IP: 0x%04x\r\n 入口ES: 0x%04x\r\n\
PE头偏移: 0x%08x\r\n-----------------------------------------------------\r\
\nPE头信息\r\n-----------------------------------------------------\r\n"),FileName,
*(USHORT*)(pMemory+14),*(USHORT*)(pMemory+16),*(USHORT*)(pMemory+20),*(USHORT*)(pMemory+22),
*(DWORD*)(pMemory+60)));
/* IMAGE_NT_HEADERS */
/* IMAGE_FILE_HEADER Check */
/* IMAGE_DOS_HEADER::e_lfanew Offset 60 (BYTES) */
pMemory += *(PWORD)(pMemory + 60);
pTextCtrl->WriteText(wxString::Format(wxT(" 平台:%s \r\n 节区数量: %d\r\n\
创建时间: 0x%08x\r\n SymTb地址: 0x%08x\r\n SymTb数量: 0x%08x\r\n\
IOH长度: 0x%04x\r\n 重定位: %s\r\n 可执行文件:%s\r\n 包含行信息:%s\r\n\
符号信息: %s\r\n 32位专用: %s\r\n 调试信息: %s\r\n 软盘运行: %s\r\n\
网络运行: %s\r\n 系统文件: %s\r\n DLL文件: %s\r\n 多核运行: %s\
\r\n-----------------------------------------------------\r\n\
IOH结构信息\r\n-----------------------\
------------------------------\r\n 镜像Type: %s"),
HardWareTable[*(USHORT*)(pMemory+4)],
*(USHORT*)(pMemory+6),*(DWORD*)(pMemory+8),
*(DWORD*)(pMemory+12),*(DWORD*)(pMemory+16),*(USHORT*)(pMemory+20),
GET_BIT(*(USHORT*)(pMemory+22),0)?wxT("无"):wxT("有"),
GET_BIT(*(USHORT*)(pMemory+22),1)?wxT("是"):wxT("否"),
GET_BIT(*(USHORT*)(pMemory+22),2)?wxT("否"):wxT("是"),
GET_BIT(*(USHORT*)(pMemory+22),3)?wxT("否"):wxT("是"),
GET_BIT(*(USHORT*)(pMemory+22),8)?wxT("是"):wxT("否"),
GET_BIT(*(USHORT*)(pMemory+22),9)?wxT("无"):wxT("有"),
GET_BIT(*(USHORT*)(pMemory+22),10)?wxT("无"):wxT("有"),
GET_BIT(*(USHORT*)(pMemory+22),11)?wxT("无"):wxT("有"),
GET_BIT(*(USHORT*)(pMemory+22),12)?wxT("是"):wxT("否"),
GET_BIT(*(USHORT*)(pMemory+22),13)?wxT("是"):wxT("否"),
GET_BIT(*(USHORT*)(pMemory+22),14)?wxT("否"):wxT("是"),
ImageType[*(USHORT*)(pMemory+24)]
));
/* IMAGE_OPTIONAL_HEADER Check */
pTextCtrl->WriteText(wxString::Format(wxT("\r\n MjLinkVer: 0x%02x\r\n\
MnLinkVer: 0x%02x\r\n 代码节总大小: 0x%08x\r\n\
初始化代码节总大小: 0x%08x\r\n 未初始化代码节总大小: 0x%08x\r\n\
入口RVA: 0x%08x\r\n 代码起始RVA: 0x%08x\r\n\
数据起始RVA: 0x%08x\r\n 建议装入地址: 0x%08x\r\n\
内存节对齐粒度: 0x%08x\r\n 文件节对齐粒度: 0x%08x\r\n\
系统主版本号: 0x%04x\r\n 系统副版本号: 0x%04x\r\n\
主版本下限: 0x%04x\r\n 副版本下限: 0x%04x\r\n\
主子系统版本下限: 0x%04x\r\n 副子系统版本下限: 0x%04x\r\n\
PE镜像尺寸: 0x%08x\r\n 节表+头大小: 0x%08x\r\n\
子系统: %s\r\n 初始栈大小: 0x%08x\r\n\
初始栈提交数: 0x%08x\r\n 初始堆大小: 0x%08x\r\n\
初始堆提交数: 0x%08x\r\n\-----------------------------------------------------------\
\r\n节区名称 节区大小 虚拟地址 RAW_SIZE RAW_OFFT 节区属性\r\n\
-----------------------------------------------------------\r\n"),
*(pMemory+0x1a),*(pMemory+0x1b),*(PDWORD)(pMemory+0x1c),*(PDWORD)(pMemory+0x20),
*(PDWORD)(pMemory+0x24),*(PDWORD)(pMemory+0x28),*(PDWORD)(pMemory+0x2C),
*(PDWORD)(pMemory+0x30),*(PDWORD)(pMemory+0x34),*(PDWORD)(pMemory+0x38),
*(PDWORD)(pMemory+0x3C),*(PWORD)(pMemory+0x40),*(PWORD)(pMemory+0x42),
*(PWORD)(pMemory+0x44),*(PWORD)(pMemory+0x46),*(PWORD)(pMemory+0x48),
*(PWORD)(pMemory+0x4A),*(PDWORD)(pMemory+0x50),*(PDWORD)(pMemory+0x54),
SubsystemList[*(PWORD)(pMemory+0x5C)],*(PDWORD)(pMemory+0x60),
*(PDWORD)(pMemory+0x64),*(PDWORD)(pMemory+0x68),*(PDWORD)(pMemory+0x6C)));