Skip to content

Commit

Permalink
Add support for main function detection in x64 Windows binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 committed Dec 8, 2023
1 parent 693912a commit 5891264
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ui/viewframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,29 @@ class SymbolsView;
class ViewFrame;
class ViewPane;


class TimerWithMaxTries: public QObject
{
Q_OBJECT

QTimer* timer;
size_t attempts;
size_t initialDelay;
size_t maxTries;
size_t delay;
std::atomic<bool> stopped = false;

public:
TimerWithMaxTries(QWidget* parent, size_t initialDelay, size_t n, size_t msec);
void start();
void stop();
~TimerWithMaxTries();

Q_SIGNALS:
void timeout();
};


/*!
\ingroup viewframe
Expand Down Expand Up @@ -374,6 +397,7 @@ class BINARYNINJAUIAPI ViewFrame : public QWidget
bool m_aboutToClose = false;

UIActionHandler m_actionHandler;
TimerWithMaxTries* m_mainNavigationTimer;

protected:
QPointer<CompileDialog> compileDialog;
Expand All @@ -390,6 +414,8 @@ class BINARYNINJAUIAPI ViewFrame : public QWidget
*/
BinaryNinja::Ref<HistoryEntry> deserializeHistoryEntry(const Json::Value& json);

bool tryMainSymbolsNavigation();

public:
explicit ViewFrame(QWidget* parent, FileContext* file, const QString& type, bool createDynamicWidgets = false);
virtual ~ViewFrame();
Expand Down Expand Up @@ -488,6 +514,7 @@ class BINARYNINJAUIAPI ViewFrame : public QWidget
void updateCrossReferenceSelection();
void nextCrossReference();
void prevCrossReference();
void tryNavigateToMain();

void updateVariableList();
void updateStackView();
Expand Down

0 comments on commit 5891264

Please sign in to comment.