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;
73 if (!thunkPtr)
return 0;
76 uint64_t* ptr = (uint64_t*) thunkPtr;
78 if (ordinal & ORDINAL_FLAG64) ordinal ^= ORDINAL_FLAG64;
81 uint32_t* ptr = (uint32_t*) thunkPtr;
83 if (uint32_t(ordinal) & ORDINAL_FLAG32) ordinal ^= ORDINAL_FLAG32;
98 uint64_t* ptr = (uint64_t*) p;
99 if ((*ptr) & ORDINAL_FLAG64)
return true;
102 uint32_t* ptr = (uint32_t*) p;
103 if ((*ptr) & ORDINAL_FLAG32)
return true;
114 if (!dataPtr)
return NULL;
115 char *name = (
char*) dataPtr->Name;
127 void *entryPtr = this->
getPtr();
128 if (entryPtr == NULL)
return NULL;
130 IMAGE_THUNK_DATA32* en32 = is64 ? NULL : (IMAGE_THUNK_DATA32*) entryPtr;
131 IMAGE_THUNK_DATA64* en64 = is64 ? (IMAGE_THUNK_DATA64*) entryPtr : NULL;
141 return (
void*) &dataPtr->Hint;
149 if (fieldId ==
HINT)
return sizeof (WORD);
158 case THUNK:
return "Thunk";
160 case HINT :
return "Hint";
199 if (
m_PE == NULL)
return NULL;
203 offset_t importRva =
static_cast<offset_t>(d[pe::DIR_IMPORT].VirtualAddress);
204 if (importRva == 0)
return NULL;
211 if (dirPtr == NULL)
return NULL;
213 offset_t entryOffset = descAddr + (this->
entryNum *
sizeof(IMAGE_IMPORT_DESCRIPTOR));
216 if (!content)
return NULL;
217 return (
void*) content;
222 return sizeof(IMAGE_IMPORT_DESCRIPTOR);
228 if (!name)
return "";
234 void *ptr = this->
getPtr();
235 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*) ptr;
236 if (!desc)
return false;
238 if (desc->TimeDateStamp == (-1))
return true;
244 void *ptr = this->
getPtr();
245 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*) ptr;
246 if (!desc)
return NULL;
250 case TIMESTAMP:
return (
void*) &desc->TimeDateStamp;
251 case FORWARDER:
return (
void*) &desc->ForwarderChain;
252 case NAME:
return (
void*) &desc->Name;
253 case FIRST_THUNK:
return (
void*) &desc->FirstThunk;
264 case NAME:
return "NameRVA";
283 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*)
getPtr();
298 int32_t limit = (uint32_t) upperLimit < HARD_LIMIT ? upperLimit : HARD_LIMIT;
301 if (upperLimit < HARD_LIMIT) {
314 if (pe == NULL)
return NULL;
325 uint32_t importRva = d[pe::DIR_IMPORT].VirtualAddress;
326 if (importRva == 0)
return NULL;
332 if (dirPtr == NULL)
return NULL;
333 return (IMAGE_IMPORT_DESCRIPTOR*) dirPtr;
339 if (!imp || !imp->
getPtr()) {
354 if (!thunk && !oThunk) {
365 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)