212 lines
5.2 KiB
C++
212 lines
5.2 KiB
C++
#ifndef _IMAGE_IMAGESECTIONHEADER_HPP_
|
|
#define _IMAGE_IMAGESECTIONHEADER_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
#ifndef _COMMON_PUREVIEWOFFILE_HPP_
|
|
#include <common/pview.hpp>
|
|
#endif
|
|
|
|
class ImageSectionHeader : private _IMAGE_SECTION_HEADER
|
|
{
|
|
public:
|
|
ImageSectionHeader(void);
|
|
ImageSectionHeader(const ImageSectionHeader &someImageSectionHeader);
|
|
~ImageSectionHeader();
|
|
ImageSectionHeader &operator=(const ImageSectionHeader &someImageSectionHeader);
|
|
WORD operator==(const ImageSectionHeader &someImageSectionHeader);
|
|
WORD operator<<(PureViewOfFile &pureView);
|
|
String name(void)const;
|
|
DWORD physicalAddress(void)const;
|
|
void physicalAddress(DWORD physicalAddress);
|
|
DWORD virtualSize(void)const;
|
|
void virtualSize(DWORD virtualSize);
|
|
DWORD virtualAddress(void)const;
|
|
void virtualAddress(DWORD virtualAddress);
|
|
DWORD sizeofRawData(void)const;
|
|
void sizeofRawData(DWORD sizeofRawData);
|
|
DWORD pointerRawData(void)const;
|
|
void pointerRawData(WORD pointerRawData);
|
|
DWORD pointerRelocations(void)const;
|
|
void pointerRelocations(DWORD pointerRelocations);
|
|
DWORD pointerLineNumbers(void)const;
|
|
void pointerLineNumbers(DWORD pointerLineNumbers);
|
|
WORD relocationsCount(void)const;
|
|
void relocationsCount(WORD relocationsCount);
|
|
WORD lineNumbersCount(void)const;
|
|
void lineNumbersCount(WORD lineNumbersCount);
|
|
DWORD characteristics(void)const;
|
|
void characteristics(DWORD characteristics);
|
|
private:
|
|
};
|
|
|
|
inline
|
|
ImageSectionHeader::ImageSectionHeader(void)
|
|
{
|
|
::memset((char*)&((_IMAGE_SECTION_HEADER&)*this),0,sizeof(_IMAGE_SECTION_HEADER));
|
|
}
|
|
|
|
inline
|
|
ImageSectionHeader::ImageSectionHeader(const ImageSectionHeader &someImageSectionHeader)
|
|
{
|
|
*this=someImageSectionHeader;
|
|
}
|
|
|
|
inline
|
|
ImageSectionHeader::~ImageSectionHeader()
|
|
{
|
|
}
|
|
|
|
inline
|
|
ImageSectionHeader &ImageSectionHeader::operator=(const ImageSectionHeader &someImageSectionHeader)
|
|
{
|
|
::memcpy((char*)&((_IMAGE_SECTION_HEADER&)*this),(char*)&((_IMAGE_SECTION_HEADER&)someImageSectionHeader),sizeof(_IMAGE_SECTION_HEADER));
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
WORD ImageSectionHeader::operator==(const ImageSectionHeader &someImageSectionHeader)
|
|
{
|
|
return ::memcmp((char*)&((_IMAGE_SECTION_HEADER&)*this),(char*)&((_IMAGE_SECTION_HEADER&)someImageSectionHeader),sizeof(_IMAGE_SECTION_HEADER));
|
|
}
|
|
|
|
inline
|
|
WORD ImageSectionHeader::operator<<(PureViewOfFile &pureView)
|
|
{
|
|
return sizeof(_IMAGE_SECTION_HEADER)==pureView.read((char*)&((_IMAGE_SECTION_HEADER&)*this),sizeof(_IMAGE_SECTION_HEADER));
|
|
}
|
|
|
|
inline
|
|
String ImageSectionHeader::name(void)const
|
|
{
|
|
String sectionName;
|
|
|
|
sectionName.reserve(sizeof(_IMAGE_SECTION_HEADER::Name)+1);
|
|
::memcpy(sectionName,_IMAGE_SECTION_HEADER::Name,sizeof(_IMAGE_SECTION_HEADER::Name));
|
|
return sectionName;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::physicalAddress(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::Misc.PhysicalAddress;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::physicalAddress(DWORD physicalAddress)
|
|
{
|
|
_IMAGE_SECTION_HEADER::Misc.PhysicalAddress=physicalAddress;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::virtualSize(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::Misc.VirtualSize;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::virtualSize(DWORD virtualSize)
|
|
{
|
|
_IMAGE_SECTION_HEADER::Misc.VirtualSize=virtualSize;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::virtualAddress(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::VirtualAddress;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::virtualAddress(DWORD virtualAddress)
|
|
{
|
|
_IMAGE_SECTION_HEADER::VirtualAddress=virtualAddress;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::sizeofRawData(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::SizeOfRawData;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::sizeofRawData(DWORD sizeofRawData)
|
|
{
|
|
_IMAGE_SECTION_HEADER::SizeOfRawData=sizeofRawData;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::pointerRawData(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::PointerToRawData;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::pointerRawData(WORD pointerRawData)
|
|
{
|
|
_IMAGE_SECTION_HEADER::PointerToRawData=pointerRawData;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::pointerRelocations(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::PointerToRelocations;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::pointerRelocations(DWORD pointerRelocations)
|
|
{
|
|
_IMAGE_SECTION_HEADER::PointerToRelocations=pointerRelocations;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::pointerLineNumbers(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::PointerToLinenumbers;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::pointerLineNumbers(DWORD pointerLineNumbers)
|
|
{
|
|
_IMAGE_SECTION_HEADER::PointerToLinenumbers=pointerLineNumbers;
|
|
}
|
|
|
|
inline
|
|
WORD ImageSectionHeader::relocationsCount(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::NumberOfRelocations;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::relocationsCount(WORD relocationsCount)
|
|
{
|
|
_IMAGE_SECTION_HEADER::NumberOfRelocations=relocationsCount;
|
|
}
|
|
|
|
inline
|
|
WORD ImageSectionHeader::lineNumbersCount(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::NumberOfLinenumbers;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::lineNumbersCount(WORD lineNumbersCount)
|
|
{
|
|
_IMAGE_SECTION_HEADER::NumberOfLinenumbers=lineNumbersCount;
|
|
}
|
|
|
|
inline
|
|
DWORD ImageSectionHeader::characteristics(void)const
|
|
{
|
|
return _IMAGE_SECTION_HEADER::Characteristics;
|
|
}
|
|
|
|
inline
|
|
void ImageSectionHeader::characteristics(DWORD characteristics)
|
|
{
|
|
_IMAGE_SECTION_HEADER::Characteristics=characteristics;
|
|
}
|
|
#endif
|