//根据PE文件信息,计算各块大小和ULONG GetFileLen(LPVOID pBaseaddr,LPVOID pReadBuf){ LPBYTE pBase=(LPBYTE)pBaseaddr; PIMAGE_DOS_HEADER pDosHeader=(PIMAGE_DOS_HEADER)pReadBuf; ULONG uSize=PIMAGE_OPTIONAL_HEADER((pBase+pDosHeader
//根据PE文件信息,计算各块大小和
ULONG GetFileLen(LPVOID pBaseaddr,LPVOID pReadBuf)
{
LPBYTE pBase=(LPBYTE)pBaseaddr;
PIMAGE_DOS_HEADER pDosHeader=(PIMAGE_DOS_HEADER)pReadBuf;
ULONG uSize=PIMAGE_OPTIONAL_HEADER((pBase+pDosHeader->e_lfanew+4+20))->SizeOfHeaders;
PIMAGE_SECTION_HEADER pSec = (PIMAGE_SECTION_HEADER)(pBase+pDosHeader->e_lfanew + sizeof(IMAGE_NT_HEADERS));
for(int i=0;i<PIMAGE_FILE_HEADER(pBase+pDosHeader->e_lfanew+4)->NumberOfSections;++i)
{
uSize+=pSec[i].SizeOfRawData;
}
return uSize;
}
【感谢龙石为本站提供数据共享交换平台 http://www.longshidata.com/pages/exchange.html】