PEFile.h
上传用户:shouhua
上传日期:2014-12-06
资源大小:5685k
文件大小:1k
- // PEFile.h: interface for the CPEFile class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_PEFILE_H__BC746100_7BF3_11D4_8B4C_DF3F74FBAB11__INCLUDED_)
- #define AFX_PEFILE_H__BC746100_7BF3_11D4_8B4C_DF3F74FBAB11__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "pe.h"
- class CPEFile
- {
- // Public methods
- public:
- CPEFile(HWND hwnd = NULL);
- virtual ~CPEFile();
- bool LoadExecutable(char *filename);
- bool WriteInfos(char *filename);
- bool SaveExecutable(char *filename);
- bool SavePartialExecutable(char *filename, DWORD start, DWORD length);
- bool SaveHeaderOnly(char *filename);
- bool FixHeader();
- bool UpdatePEVars(bool fix_sections = false);
- bool RebuildImport(void **name_import);
- int FindSectionIndex(DWORD addr);
- DWORD RVA2Offset(DWORD addr);
- // Protected methods
- protected:
- // Protected datas
- public:
- HWND m_hwnd; // for messagebox (can be NULL)
- char m_filename[_MAX_PATH]; // name of executable
- unsigned char *m_buffer; // buffer of executable
- long m_size; // size of executable
- // pe infos
- unsigned int m_dosstub_size;
- PEHeader *m_pe_header;
- StdOptionalHeader *m_std_header;
- NTOptionalHeader *m_nt_header;
- ROMOptionalHeader *m_rom_header;
- DataDirectory *m_directories;
- Section *m_sections;
- };
- #endif // !defined(AFX_PEFILE_H__BC746100_7BF3_11D4_8B4C_DF3F74FBAB11__INCLUDED_)