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;
95 uint64_t* ptr = (uint64_t*) p;
96 if ((*ptr) & ORDINAL_FLAG64)
return true;
99 uint32_t* ptr = (uint32_t*) p;
100 if ((*ptr) & ORDINAL_FLAG32)
return true;
111 if (!dataPtr)
return NULL;
112 char *name = (
char*) dataPtr->Name;
123 void *entryPtr = this->
getPtr();
124 if (entryPtr == NULL)
return NULL;
134 return (
void*) &dataPtr->Hint;
142 if (fieldId ==
HINT)
return sizeof (WORD);
151 case THUNK:
return "Thunk";
153 case HINT :
return "Hint";
192 if (
m_PE == NULL)
return NULL;
196 offset_t importRva =
static_cast<offset_t>(d[pe::DIR_IMPORT].VirtualAddress);
197 if (importRva == 0)
return NULL;
204 if (dirPtr == NULL)
return NULL;
206 offset_t entryOffset = descAddr + (this->
entryNum *
sizeof(IMAGE_IMPORT_DESCRIPTOR));
209 if (!content)
return NULL;
210 return (
void*) content;
215 return sizeof(IMAGE_IMPORT_DESCRIPTOR);
221 if (!name)
return "";
227 void *ptr = this->
getPtr();
228 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*) ptr;
229 if (!desc)
return false;
231 if (desc->TimeDateStamp == (-1))
return true;
237 void *ptr = this->
getPtr();
238 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*) ptr;
239 if (!desc)
return NULL;
243 case TIMESTAMP:
return (
void*) &desc->TimeDateStamp;
244 case FORWARDER:
return (
void*) &desc->ForwarderChain;
245 case NAME:
return (
void*) &desc->Name;
246 case FIRST_THUNK:
return (
void*) &desc->FirstThunk;
257 case NAME:
return "NameRVA";
276 IMAGE_IMPORT_DESCRIPTOR* desc = (IMAGE_IMPORT_DESCRIPTOR*)
getPtr();
291 size_t limit = (size_t) upperLimit < HARD_LIMIT ? upperLimit : HARD_LIMIT;
294 if (upperLimit < HARD_LIMIT) {
307 if (pe == NULL)
return NULL;
318 uint32_t importRva = d[pe::DIR_IMPORT].VirtualAddress;
319 if (importRva == 0)
return NULL;
325 if (dirPtr == NULL)
return NULL;
326 return (IMAGE_IMPORT_DESCRIPTOR*) dirPtr;
332 if (!imp || !imp->
getPtr()) {
347 if (!thunk && !oThunk) {
358 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)