11std::map<DWORD, QString> SectionHdrWrapper::s_secHdrCharact;
44 if (s_secHdrCharact.size() == 0) {
47 std::vector<DWORD>
chSet;
48 std::map<DWORD, QString>::iterator
iter;
49 for (
iter = s_secHdrCharact.begin();
iter != s_secHdrCharact.end(); ++
iter) {
59 if (s_secHdrCharact.size() == 0) {
63 if (s_secHdrCharact.find(
charact) == s_secHdrCharact.end())
return "";
64 return s_secHdrCharact[
charact];
84 return (
void*) this->header;
92 return (
void*) this->header;
98 if (!header)
return false;
127 if (!this->
name)
return "";
134 if (!sec)
return NULL;
138 case NAME:
return (
void*) &
sec->Name;
139 case VSIZE:
return (
void*) &
sec->Misc.VirtualSize;
140 case VPTR:
return (
void*) &
sec->VirtualAddress;
141 case RSIZE:
return (
void*) &
sec->SizeOfRawData;
142 case RPTR:
return(
void*) &
sec->PointerToRawData;
144 case RELOC_PTR:
return (
void*) &
sec->PointerToRelocations;
145 case RELOC_NUM:
return (
void*) &
sec->NumberOfRelocations;
149 case CHARACT:
return (
void*) &
sec->Characteristics;
158 case NAME:
return "Name";
159 case VSIZE:
return "Virtual Size";
160 case VPTR:
return "Virtual Addr.";
161 case RSIZE:
return "Raw size";
162 case RPTR:
return "Raw Addr.";
163 case CHARACT:
return "Characteristics";
199 offset =
static_cast<offset_t>(this->header->PointerToRawData);
201 offset =
static_cast<offset_t>(this->header->VirtualAddress);
240 if (this->header ==
NULL)
return 0;
244 size =
static_cast<bufsize_t>(this->header->SizeOfRawData);
246 size =
static_cast<bufsize_t>(this->header->Misc.VirtualSize);
345 if (!this->header || !
m_PE)
return 0;
404void SectHdrsWrapper::clear()
411bool SectHdrsWrapper::loadNextEntry(
size_t entryNum)
436 if (rSec.find(
endRaw) != rSec.end()) {
444 if (vSec.find(
endRVA) != vSec.end()) {
464 for (
size_t i = 0;
i < count;
i++) {
466 if (sec ==
NULL)
continue;
476 if (this->
m_PE ==
NULL)
return false;
479 if (this->loadNextEntry(
i) ==
false)
break;
505 if (!secCount)
return 0;
531 size_t size = this->
entries.size();
532 std::map<offset_t, SectionHdrWrapper*> *
secMap =
NULL;
541 std::map<offset_t, SectionHdrWrapper*>::iterator
found =
secMap->lower_bound(offset);
542 std::map<offset_t, SectionHdrWrapper*>::iterator
itr;
547 printf(
"found [%llX] key: %llX sec: %llX %llX\n",
548 static_cast<unsigned long long>(offset),
549 static_cast<unsigned long long>(
itr->first),
550 static_cast<unsigned long long>(
sec->getContentOffset(
addrType)),
551 static_cast<unsigned long long>(
sec->getContentEndOffset(
addrType,
false))
570 std::map<offset_t, SectionHdrWrapper*> *
secMap =
NULL;
579 std::map<offset_t, SectionHdrWrapper*>::iterator
itr;
584 printf(
"[%llX] %s %llX %llX\n",
585 static_cast<unsigned long long>(
secEnd),
586 sec->getName().toStdString().c_str(),
587 static_cast<unsigned long long>(
sec->getContentOffset(
aType)),
588 static_cast<unsigned long long>(
sec->getContentEndOffset(
aType,
true))
INT_TYPE _getNumValue(void *ptr)
const offset_t INVALID_ADDR
virtual bufsize_t getContentSize()=0
bool isAreaEmpty(offset_t rawOffset, bufsize_t size)
virtual bufsize_t getContentSize()
ExeNodeWrapper * getLastEntry()
virtual ExeNodeWrapper * getEntryAt(size_t fieldId)
virtual bufsize_t geEntrySize()
std::vector< ExeNodeWrapper * > entries
virtual offset_t getNextEntryOffset()
virtual size_t getEntriesCount()
virtual ExeNodeWrapper * addEntry(ExeNodeWrapper *entry)
BYTE * getContentAt(offset_t offset, bufsize_t size, bool allowExceptions=false)
virtual offset_t getRawSize() const
virtual bufsize_t getImageSize()
virtual bufsize_t getMappedSize(Executable::addr_type aType)
SectionHdrWrapper * _getSecHdr(size_t index) const
offset_t secHdrsOffset() const
bool setHdrSectionsNum(size_t newNum)
size_t hdrSectionsNum() const
virtual bufsize_t getAlignment(Executable::addr_type aType) const
size_t _getSectionsCount(bool useMapped=true) const
void printSectionsMapping(Executable::addr_type aType)
ExeNodeWrapper * addEntry(ExeNodeWrapper *entry)
virtual bufsize_t getSize()
virtual QString getFieldName(size_t fieldId)
SectionHdrWrapper * getSecHdrAtOffset(offset_t offset, Executable::addr_type addrType, bool roundup, bool verbose=false)
virtual void reloadMapping()
static size_t SECT_COUNT_MAX
static size_t SECT_INVALID_INDEX
virtual size_t getFieldsCount()
static std::vector< DWORD > splitCharacteristics(DWORD characteristics)
bufsize_t getMappedVirtualSize()
virtual QString getName()
virtual QString getFieldName(size_t fieldId)
offset_t getContentDeclaredOffset(Executable::addr_type aType)
static void initSecCharacter(std::map< DWORD, QString > &secHdrCharact)
virtual void * getFieldPtr(size_t fieldId, size_t subField=FIELD_NONE)
bufsize_t getContentDeclaredSize(Executable::addr_type aType)
virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField=FIELD_NONE)
static QString translateCharacteristics(DWORD charact)
offset_t getContentEndOffset(Executable::addr_type aType, bool roundup)
offset_t getContentOffset(Executable::addr_type aType, bool useMapped=true)
static QString getSecHdrAccessRightsDesc(DWORD characteristics)
bufsize_t getMappedRawSize()
static const size_t SECNAME_LEN
virtual WrappedValue::data_type containsDataType(size_t fieldId, size_t subField=FIELD_NONE)
virtual bufsize_t getSize()
bool append(dbg_level lvl, const char *format,...)
bufsize_t roundupToUnit(bufsize_t size, bufsize_t unit)
size_t unitsCount(uint64_t value, uint64_t unit, bool roundup=true)