📄 portableexecutable.h
字号:
// PortableExecutable.h: interface for the CPortableExecutable class.
//
//////////////////////////////////////////////////////////////////////
#ifndef portableexe_h
#define portableexe_h
#include "stdafx.h"
#include "Headers.h"
#include "Section.h"
#include "DataDirectory.h"
#include "DOSStub.h"
#include "DD_Debug.h"
#include "DD_Export.h"
#include "DD_Import.h"
#include "DD_Copyright.h"
#include "DD_Resource.h"
namespace PE {
class CPortableExecutable
{
public: // Definitions
typedef std::list<CSection>::iterator sctIterator;
typedef std::list<CSection>::const_iterator sctCIterator;
typedef std::list<CSection> sctList;
public:
DWORD GetNumSections(void);
CSection * GetSectionByIndex(DWORD dwIndex);
DWORD CalcCheckSum(void);
CSection * GetSectionByName(LPSTR pName);
PE_ERROR AddSection(CSection *pSection);
PE_ERROR FixSectionSizes(void);
PE_ERROR FixSectionOffsets(void);
PE_ERROR Realign(void);
CSection * GetLastSectionInFile();
CSection * GetFirstSectionInFile(void);
CSection * GetFirstSectionInMemory(void);
CSection * GetLastSectionInMemory(void);
PE_ERROR FixImageSize(void);
PE_ERROR InsertSection(CSection *pToAdd, CSection *pNext);
PE_ERROR RemoveSection(CSection *pSection);
LPBYTE GetDataAtVA(DWORD dwVA);
LPBYTE GetDataAtRVA(DWORD dwRVA);
CSection * GetSectionByFO(DWORD dwFO);
CSection * GetSectionByVA(DWORD dwVA);
CSection * GetSectionByRVA(DWORD dwRVA);
DWORD RVA2VA(DWORD dwRVA);
DWORD VA2RVA(DWORD dwVA);
DWORD FO2VA(DWORD dwFO);
DWORD FO2RVA(DWORD dwFO);
DWORD VA2FO(DWORD dwVA);
DWORD RVA2FO(DWORD dwRVA);
PE_ERROR Write(LPSTR pszFileName, BOOL flSetChecksum = FALSE);
PE_ERROR Load(LPSTR pszFileName);
PE_ERROR LoadByHandle(HANDLE hFile);
PE_ERROR SetNewStub(LPBYTE pbStub, DWORD cbStub);
CPortableExecutable();
virtual ~CPortableExecutable();
// Public objects
CHeaders m_Headers;
CDOSStub m_DOSStub;
// Data directory classes
CDD_Debug m_ddDebug;
CDD_Export m_ddExport;
CDD_Import m_ddImport;
CDD_Copyright m_ddCopyright;
CDD_Resource m_ddResource;
// Strings and stuff
char FileName[256];
DWORD FileSize;
protected:
DWORD GetCheckSum(LPWORD pwData, DWORD dwSize, DWORD dwSum = 0);
void Cleanup();
// Protected variables
sctList m_lstSections;
BOOL m_flIsLoaded;
};
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -