diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index 6a06f7b..e955a3c 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -62,8 +62,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(hostSignaller, &HostSignaller::AddThread, this, &MainWindow::AddThread); connect(hostSignaller, &HostSignaller::RemoveThread, this, &MainWindow::RemoveThread); connect(this, &MainWindow::ThreadOutputReceived, this, &MainWindow::ThreadOutput); - std::map extensions = LoadExtensions(); - for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ": " + i.second); + ReloadExtensions(); Host::Open(); Host::AddConsoleOutput(L"NextHooker beta v2.1.2 by Artikash\r\nSource code and more information available under GPLv3 at https://github.com/Artikash/NextHooker"); } @@ -139,6 +138,13 @@ void MainWindow::ThreadOutput(TextThread* thread, QString output) } } +void MainWindow::ReloadExtensions() +{ + extenCombo->clear(); + std::map extensions = LoadExtensions(); + for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ": " + i.second); +} + std::unordered_map MainWindow::GetInfoForExtensions(TextThread* thread) { return @@ -236,9 +242,7 @@ void MainWindow::on_addExtenButton_clicked() extenName + "_nexthooker_extension.dll"; QFile::copy(extenFileName, copyTo); - extenCombo->clear(); - std::map extensions = LoadExtensions(); - for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ": " + i.second); + ReloadExtensions(); } void MainWindow::on_rmvExtenButton_clicked() @@ -247,7 +251,5 @@ void MainWindow::on_rmvExtenButton_clicked() QString extenFileName = extenCombo->currentText().split(":")[0] + "_" + extenCombo->currentText().split(": ")[1] + "_nexthooker_extension.dll"; FreeLibrary(GetModuleHandleW(extenFileName.toStdWString().c_str())); DeleteFileW(extenFileName.toStdWString().c_str()); - extenCombo->clear(); - std::map extensions = LoadExtensions(); - for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ": " + i.second); + ReloadExtensions(); } diff --git a/GUI/mainwindow.h b/GUI/mainwindow.h index a3e0f71..ba01025 100644 --- a/GUI/mainwindow.h +++ b/GUI/mainwindow.h @@ -41,6 +41,7 @@ private slots: void on_rmvExtenButton_clicked(); private: + void ReloadExtensions(); std::unordered_map GetInfoForExtensions(TextThread* thread); QVector GetAllHooks(DWORD processId);