62 return (IMAGE_RESOURCE_DIRECTORY*) ptr;
65IMAGE_RESOURCE_DIRECTORY* ResourceDirWrapper::resourceDir()
70 return (IMAGE_RESOURCE_DIRECTORY*) ptr;
79 IMAGE_RESOURCE_DIRECTORY* dir = resourceDir();
80 if (dir == NULL)
return false;
81 size_t namesNum = dir->NumberOfNamedEntries;
82 size_t idsNum = dir->NumberOfIdEntries;
84 size_t totalEntries = namesNum + idsNum;
85 for (
size_t i = 0; i < totalEntries && i <
MAX_ENTRIES; i++ ) {
87 long topDirId = (this->topEntryID !=
TOP_ENTRY_ROOT) ? this->topEntryID : long(i) ;
92 if (entry->
getPtr() == NULL) {
97 pe::resource_type typeId =
static_cast<pe::resource_type
>(entry->
getID());
101 this->
entries.push_back(entry);
110 if (
getPtr() == NULL)
return 0;
111 bufsize_t size =
sizeof(IMAGE_RESOURCE_DIRECTORY);
118 IMAGE_RESOURCE_DIRECTORY* d = resourceDir();
119 if (d == NULL)
return NULL;
123 case TIMESTAMP:
return &d->TimeDateStamp;
134 IMAGE_RESOURCE_DIRECTORY* d = resourceDir();
135 if (d == NULL)
return 0;
139 void *nextPtr = (&d->NumberOfIdEntries) + 1;
140 void *argPtr = &d->NumberOfIdEntries;
141 return (BYTE*) nextPtr - (BYTE*)argPtr;
153 return "ReproChecksum";
155 return "TimeDateStamp";
170 this->childDir = NULL;
173 this->childLeaf = NULL;
181 if (childRaw == 0 || childRaw ==
INVALID_ADDR)
return false;
184 long depth = this->parentDir->
getDepth() + 1;
189 if (this->album != NULL) {
190 album->
putLeaf(childLeaf, topEntryID);
199 if (this->parentDir == NULL)
return NULL;
205 offset += (this->
entryNum *
sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY));
208 return (IMAGE_RESOURCE_DIRECTORY_ENTRY*) ptr;
214 IMAGE_RESOURCE_DIRECTORY_ENTRY* entry =
getEntryPtr();
215 if (entry == NULL)
return NULL;
221 return &entry->OffsetToData;
232 return "Offset To Data";
239 IMAGE_RESOURCE_DIRECTORY_ENTRY* entry =
getEntryPtr();
240 if (entry == NULL)
return false;
241 if (entry->NameIsString == 1)
return true;
247 IMAGE_RESOURCE_DIRECTORY_ENTRY* entry =
getEntryPtr();
248 if (entry == NULL)
return false;
249 if (entry->DataIsDirectory == 1)
return true;
255 IMAGE_RESOURCE_DIRECTORY_ENTRY* entry =
getEntryPtr();
263 return fOff + entry->NameOffset;
271 const size_t BASIC_SIZE =
sizeof(IMAGE_RESOURCE_DIRECTORY_STRING);
279 case pe::RESTYPE_CURSOR :
return "Cursor";
280 case pe::RESTYPE_FONT :
return "Font";
281 case pe::RESTYPE_BITMAP :
return "Bitmap";
282 case pe::RESTYPE_ICON :
return "Icon";
283 case pe::RESTYPE_MENU :
return "Menu";
284 case pe::RESTYPE_DIALOG :
return "Dialog";
285 case pe::RESTYPE_STRING :
return "String";
286 case pe::RESTYPE_FONTDIR :
return "Font Dir";
287 case pe::RESTYPE_ACCELERATOR :
return "Accelerator";
288 case pe::RESTYPE_RCDATA :
return "RC Data";
289 case pe::RESTYPE_MESSAGETABLE :
return "Message Table";
291 case pe::RESTYPE_GROUP_CURSOR :
return "Cursors Group";
292 case pe::RESTYPE_GROUP_ICON :
return "Icons Group";
293 case pe::RESTYPE_VERSION :
return "Version";
294 case pe::RESTYPE_DLGINCLUDE :
return "Dlg Include";
295 case pe::RESTYPE_PLUGPLAY :
return "Plug & Play";
296 case pe::RESTYPE_VXD :
return "VXD";
297 case pe::RESTYPE_ANICURSOR :
return "Animated Cursor";
298 case pe::RESTYPE_ANIICON :
return "Animated Icon";
299 case pe::RESTYPE_HTML :
return "HTML";
300 case pe::RESTYPE_MANIFEST :
return "Manifest";
307 IMAGE_RESOURCE_DIRECTORY_ENTRY* entry =
getEntryPtr();
308 if (entry == NULL)
return 0;
316 const IMAGE_RESOURCE_DIRECTORY_ENTRY* entry =
getEntryPtr();
320 if (entry->DataIsDirectory) {
321 return entry->OffsetToDirectory;
323 return entry->OffsetToData;
336 return fOff + childOff;
352 if (!leaf)
return NULL;
358 case RESERVED:
return &leaf->Reserved;
const offset_t INVALID_ADDR
offset_t getDirEntryAddress()
virtual bufsize_t getFieldSize(size_t fieldId, size_t subField=FIELD_NONE)
virtual offset_t getFieldOffset(size_t fieldId, size_t subField=FIELD_NONE)
virtual offset_t getOffset()
std::vector< ExeNodeWrapper * > entries
BYTE * getContentAt(offset_t offset, bufsize_t size, bool allowExceptions=false)
virtual bufsize_t getSize()
virtual QString getFieldName(size_t fieldId)
virtual void * getFieldPtr(size_t fieldId, size_t subField)
IMAGE_RESOURCE_DIRECTORY * mainResourceDir()
virtual bufsize_t getFieldSize(size_t fieldId, size_t subField)
virtual QString getName()
bufsize_t getEntriesAreaSize()
virtual QString getFieldName(size_t fieldId)
offset_t getChildAddress()
IMAGE_RESOURCE_DIRECTORY_ENTRY * getEntryPtr()
static QString translateType(WORD id)
virtual QString getName()
IMAGE_RESOURCE_DIRECTORY_STRING * getNameStr()
offset_t getChildOffsetToDirectory()
virtual void * getFieldPtr(size_t fieldId, size_t subField=FIELD_NONE)
IMAGE_RESOURCE_DATA_ENTRY * leafEntryPtr()
virtual void * getFieldPtr(size_t fieldId, size_t subField)
virtual QString getFieldName(size_t fieldId)
void mapIdToLeafType(long topId, pe::resource_type leafType)
void putLeaf(ResourceLeafWrapper *leaf, long topEntryId)