mirror of
https://github.com/hasherezade/bearparser
synced 2026-06-08 14:32:38 +00:00
[REFACT] Added func. get/set characteristics in SectHdrsWrapper
This commit is contained in:
@@ -302,7 +302,7 @@ bool PEFile::moveDataDirEntry(pe::dir_entry id, offset_t newOffset, Executable::
|
||||
}
|
||||
|
||||
|
||||
SectionHdrWrapper* PEFile::addNewSection(QString name, bufsize_t size, DWORD characteristics)
|
||||
SectionHdrWrapper* PEFile::addNewSection(QString name, bufsize_t size)
|
||||
{
|
||||
ExeNodeWrapper* sec = dynamic_cast<ExeNodeWrapper*>(getWrapper(PEFile::WR_SECTIONS));
|
||||
if (sec == NULL || sec->canAddEntry() == false) {
|
||||
@@ -344,7 +344,6 @@ SectionHdrWrapper* PEFile::addNewSection(QString name, bufsize_t size, DWORD cha
|
||||
secHdr.VirtualAddress = static_cast<DWORD>(roundedVirtualEnd);
|
||||
secHdr.SizeOfRawData = size;
|
||||
secHdr.Misc.VirtualSize = size;
|
||||
secHdr.Characteristics = characteristics;
|
||||
|
||||
SectionHdrWrapper wr(this, &secHdr);
|
||||
SectionHdrWrapper* secHdrWr = dynamic_cast<SectionHdrWrapper*>(sec->addEntry(&wr));
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public:
|
||||
bool moveDataDirEntry(pe::dir_entry id, offset_t newOffset, Executable::addr_type addType = Executable::RAW); //throws CustomException
|
||||
|
||||
SectionHdrWrapper* getLastSection();
|
||||
SectionHdrWrapper* addNewSection(QString name, bufsize_t size, DWORD characteristics = 0xE0000000);
|
||||
SectionHdrWrapper* addNewSection(QString name, bufsize_t size);
|
||||
SectionHdrWrapper* extendLastSection(bufsize_t addedSize);
|
||||
|
||||
|
||||
|
||||
@@ -47,8 +47,24 @@ public:
|
||||
offset_t getContentEndOffset(Executable::addr_type aType, bool roundup); //always useMapped startOFfset
|
||||
|
||||
bufsize_t getContentSize(Executable::addr_type aType, bool roundup);
|
||||
|
||||
protected:
|
||||
|
||||
DWORD getCharacteristics()
|
||||
{
|
||||
if (header == NULL) return 0;
|
||||
return header->Characteristics;
|
||||
}
|
||||
|
||||
//modifications:
|
||||
bool setCharacteristics(DWORD newCharacteristics)
|
||||
{
|
||||
if (header == NULL) return false;
|
||||
//TODO: validate newCharacteristics
|
||||
|
||||
header->Characteristics = newCharacteristics;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
SectionHdrWrapper(PEFile *pe, pe::IMAGE_SECTION_HEADER *v_header) //standalone entry
|
||||
: PENodeWrapper(pe), sectNum(INVALID_ENTRYNUM), name(NULL), header(v_header)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user