20 if (!isOk)
return NULL;
22 return (IMAGE_IMPORT_BY_NAME*) ptr;
34 if (is32) thunkRva = (int32_t)(thunkRva);
35 if (thunkRva == 0 || thunkRva == (-1))
return 0;
40 offset_t fieldRVA = thunkRva + offset;
55 if (!is64) thunkRva = (int32_t)(thunkRva);
56 if (thunkRva == 0 || thunkRva == -1)
return NULL;
72 if (!thunkPtr)
return 0;
75 uint64_t* ptr = (uint64_t*) thunkPtr;
77 if (ordinal & ORDINAL_FLAG64) ordinal ^= ORDINAL_FLAG64;
80 uint32_t* ptr = (uint32_t*) thunkPtr;
82 if (uint32_t(ordinal) & ORDINAL_FLAG32) ordinal ^= ORDINAL_FLAG32;
97 uint64_t* ptr = (uint64_t*) p;
98 if ((*ptr) & ORDINAL_FLAG64)
return true;
101 uint32_t* ptr = (uint32_t*) p;
102 if ((*ptr) & ORDINAL_FLAG32)
return true;
113 if (!dataPtr)
return NULL;
114 char *name = (
char*) dataPtr->Name;
126 void *entryPtr = this->
getPtr();
127 if (entryPtr == NULL)
return NULL;
129 IMAGE_THUNK_DATA32* en32 = is64 ? NULL : (IMAGE_THUNK_DATA32*) entryPtr;
130 IMAGE_THUNK_DATA64* en64 = is64 ? (IMAGE_THUNK_DATA64*) entryPtr : NULL;
140 return (
void*) &dataPtr->Hint;
148 if (fieldId ==
HINT)
return sizeof (WORD);
157 case THUNK:
return "Thunk";
159 case HINT :
return "Hint";
198 if (
m_PE == NULL)
return NULL;
202 offset_t importRva =
static_cast<offset_t>(d[pe::DIR_IMPORT].VirtualAddress);
203 if (importRva == 0)
return NULL;
210 if (dirPtr == NULL)
return NULL;
212 offset_t entryOffset = descAddr + (this->
entryNum *
sizeof(IMAGE_IMPORT_DESCRIPTOR));
215 if (!content)
return NULL;
216 return (
void*) content;
221 return sizeof(IMAGE_IMPORT_DESCRIPTOR);
227 if (!name)
return "";
233 void *ptr = this->
getPtr();
234 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*) ptr;
235 if (!desc)
return false;
237 if (desc->TimeDateStamp == (-1))
return true;
243 void *ptr = this->
getPtr();
244 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*) ptr;
245 if (!desc)
return NULL;
249 case TIMESTAMP:
return (
void*) &desc->TimeDateStamp;
250 case FORWARDER:
return (
void*) &desc->ForwarderChain;
251 case NAME:
return (
void*) &desc->Name;
252 case FIRST_THUNK:
return (
void*) &desc->FirstThunk;
263 case NAME:
return "NameRVA";
282 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*)
getPtr();
297 size_t limit = (size_t) upperLimit < HARD_LIMIT ? upperLimit : HARD_LIMIT;
300 if (upperLimit < HARD_LIMIT) {
313 if (pe == NULL)
return NULL;
324 uint32_t importRva = d[pe::DIR_IMPORT].VirtualAddress;
325 if (importRva == 0)
return NULL;
331 if (dirPtr == NULL)
return NULL;
332 return (IMAGE_IMPORT_DESCRIPTOR*) dirPtr;
338 if (!imp || !imp->
getPtr()) {
353 if (!thunk && !oThunk) {
364 return static_cast<bufsize_t>(fields) *
sizeof(IMAGE_IMPORT_DESCRIPTOR);
const offset_t INVALID_ADDR
bufsize_t getMaxSizeFromPtr(BYTE *ptr)
virtual uint64_t getNumValue(size_t fieldId, size_t subField, bool *isOk)
std::vector< ExeNodeWrapper * > entries
ExeNodeWrapper * parentNode
virtual exe_bits getBitMode()
virtual offset_t toRaw(offset_t offset, addr_type addrType, bool allowExceptions=false)
BYTE * getContentAt(offset_t offset, bufsize_t size, bool allowExceptions=false)
virtual offset_t getRawSize() const
virtual size_t getFieldsCount()
static bufsize_t NameLenLimit
void addMapping(ExeNodeWrapper *func)
bufsize_t getThunkValSize()
IMAGE_DATA_DIRECTORY * getDataDirectory()
virtual bufsize_t getSize()
virtual bool loadNextEntry(size_t cntr)
IMAGE_IMPORT_DESCRIPTOR * firstDescriptor()
friend class ImportEntryWrapper
virtual QString getName()
virtual QString getFieldName(size_t fieldId)
bool loadNextEntry(size_t entryNum)
virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField=FIELD_NONE)
virtual void * getFieldPtr(size_t fieldId, size_t subField=FIELD_NONE)
virtual bufsize_t getSize()
virtual void * getFieldPtr(size_t fieldId, size_t subField=FIELD_NONE)
virtual bufsize_t getSize()
virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField=FIELD_NONE)
virtual QString getFieldName(size_t fieldId)
void * getValuePtr(ImportEntryWrapper::FieldID fId)
offset_t getFieldRVA(ImportEntryWrapper::FieldID fId)
virtual IMAGE_IMPORT_BY_NAME * getImportByNamePtr()
virtual bufsize_t getFieldSize(size_t fieldId, size_t subField=FIELD_NONE)
IMAGE_DATA_DIRECTORY * getDataDirectory()
bool isStrLonger(const char *inp, size_t maxLen)