Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
horsicq committed Jan 19, 2021
1 parent 562984f commit dbabdc9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xbinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ XBinary::XBinary(QIODevice *pDevice, bool bIsImage, qint64 nImageBase)
setEntropyProcessEnable(true);
setHashProcessEnable(true);
setMode(MODE_UNKNOWN);
setFileType(FT_BINARY);
setArch("NOEXEC");
setVersion("");
setType(TYPE_UNKNOWN);
Expand Down Expand Up @@ -112,6 +113,16 @@ QString XBinary::getTypeAsString()
return typeIdToString(getType());
}

void XBinary::setFileType(XBinary::FT fileType)
{
g_fileType=fileType;
}

XBinary::FT XBinary::getFileType()
{
return g_fileType;
}

QString XBinary::modeIdToString(XBinary::MODE mode)
{
QString sResult="Unknown"; // mb TODO translate
Expand Down
4 changes: 4 additions & 0 deletions xbinary.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ static const double D_ENTROPY_THRESHOLD; // 6.5
virtual QString typeIdToString(int nType);
QString getTypeAsString();

void setFileType(FT fileType);
virtual FT getFileType();

static QString modeIdToString(MODE mode);
static QString endiannessToString(bool bIsBigEndian);

Expand Down Expand Up @@ -839,6 +842,7 @@ static const double D_ENTROPY_THRESHOLD; // 6.5
MODE g_mode;
QString g_sVersion;
int g_nType;
FT g_fileType;
};

#endif // XBINARY_H
18 changes: 18 additions & 0 deletions xelf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3938,6 +3938,24 @@ int XELF::getType()
return nResult;
}

XBinary::FT XELF::getFileType()
{
FT result;

MODE mode=getMode();

if(mode==MODE_32)
{
result=FT_ELF32;
}
else if(mode==MODE_64)
{
result=FT_ELF64;
}

return result;
}

QString XELF::typeIdToString(int nType)
{
QString sResult="Unknown"; // mb TODO translate
Expand Down
1 change: 1 addition & 0 deletions xelf.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ class XELF : public XBinary
virtual MODE getMode();
virtual QString getArch();
virtual int getType();
virtual FT getFileType();
virtual QString typeIdToString(int nType);

virtual qint64 getBaseAddress();
Expand Down

0 comments on commit dbabdc9

Please sign in to comment.