44pe::IMAGE_COR20_HEADER* ClrDirWrapper::clrDir()
49 if (ptr == NULL)
return NULL;
51 return (pe::IMAGE_COR20_HEADER*) ptr;
67 return sizeof(pe::IMAGE_COR20_HEADER);
78 return "CLR Directory";
83 pe::IMAGE_COR20_HEADER* d = clrDir();
87 case CB:
return &d->cb;
92 case FLAGS:
return &d->Flags;
95 return &d->EntryPointRVA;
116 case CB:
return "Cb";
121 case FLAGS:
return "Flags";
123 const pe::IMAGE_COR20_HEADER* d = clrDir();
124 if (!d)
return "EntryPoint";
126 if (d->Flags & pe::COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) {
127 return "EntryPointRVA";
129 return "EntryPointToken";
152 const pe::IMAGE_COR20_HEADER* d = clrDir();
154 if (d->Flags & pe::COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) {
174 const size_t clrFlagsCount = 6;
175 const DWORD clrFlags[clrFlagsCount] = {
176 pe::COMIMAGE_FLAGS_ILONLY,
177 pe::COMIMAGE_FLAGS_32BITREQUIRED,
178 pe::COMIMAGE_FLAGS_IL_LIBRARY,
179 pe::COMIMAGE_FLAGS_STRONGNAMESIGNED,
180 pe::COMIMAGE_FLAGS_NATIVE_ENTRYPOINT,
181 pe::COMIMAGE_FLAGS_TRACKDEBUGDATA
183 std::set<DWORD> allFlags;
184 for (
size_t i = 0; i < clrFlagsCount; ++i) {
185 const DWORD nextFlag = clrFlags[i];
186 if (flags & nextFlag) {
187 allFlags.insert(nextFlag);
195 if (flags & pe::COMIMAGE_FLAGS_ILONLY) {
198 if (flags & pe::COMIMAGE_FLAGS_32BITREQUIRED) {
199 return(
"32-bit required");
201 if (flags & pe::COMIMAGE_FLAGS_IL_LIBRARY) {
202 return (
"IL Library");
204 if (flags & pe::COMIMAGE_FLAGS_STRONGNAMESIGNED) {
205 return(
"Strong Name Signed");
207 if (flags & pe::COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) {
208 return(
"Native EntryPoint");
210 if (flags & pe::COMIMAGE_FLAGS_TRACKDEBUGDATA) {
211 return(
"Track Debug Data");
218 const pe::IMAGE_COR20_HEADER* d = clrDir();
221 if (fieldId !=
FLAGS)
return "";
224 std::set<DWORD>::iterator itr;
226 for (itr = flagsSet.begin() ; itr != flagsSet.end(); ++itr) {
227 const DWORD nextFlag = *itr;
229 if (flagInfo.length() == 0)
continue;
230 list.append(flagInfo);
232 return list.join(
";");
static std::set< DWORD > getFlagsSet(DWORD flags)
virtual size_t getFieldsCount()
virtual QString getName()
virtual QString getFieldName(size_t fieldId)
QString translateFieldContent(size_t fieldId)
static QString translateFlag(DWORD value)
virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField=FIELD_NONE)
virtual bufsize_t getSize()
@ EXPORT_ADDR_TABLE_JMPS_SIZE
@ STRONG_NAME_SIGNATURE_SIZE
@ STRONG_NAME_SIGNATURE_VA
@ CODE_MANAGER_TABLE_SIZE
@ EXPORT_ADDR_TABLE_JMPS_VA
@ MANAGED_NATIVE_HDR_SIZE
virtual void * getFieldPtr(size_t fieldId, size_t subField)
offset_t getDirEntryAddress()
BYTE * getContentAt(offset_t offset, bufsize_t size, bool allowExceptions=false)