mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 08:54:12 +08:00
bugfix/reorganize
This commit is contained in:
parent
31dafc4416
commit
afe0464b56
@ -5,18 +5,6 @@ void HostSignaller::Initialize()
|
||||
{
|
||||
Host::RegisterProcessAttachCallback([&](DWORD pid){ emit AddProcess(pid); });
|
||||
Host::RegisterProcessDetachCallback([&](DWORD pid){ emit RemoveProcess(pid); });
|
||||
Host::RegisterThreadCreateCallback([&](TextThread* thread)
|
||||
{
|
||||
emit AddThread(thread);
|
||||
thread->RegisterOutputCallBack([&](TextThread* thread, std::wstring output)
|
||||
{
|
||||
output = DispatchSentenceToExtensions(output,
|
||||
{
|
||||
{ "current select", ttCombo->currentText().split(":")[0].toInt() == thread->Number() ? 1 : 0 }
|
||||
});
|
||||
emit ThreadOutput(thread, QString::fromWCharArray(output.c_str()));
|
||||
return output;
|
||||
});
|
||||
});
|
||||
Host::RegisterThreadCreateCallback([&](TextThread* thread) { emit AddThread(thread); });
|
||||
Host::RegisterThreadRemoveCallback([&](TextThread* thread){ emit RemoveThread(thread); });
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ signals:
|
||||
void RemoveProcess(unsigned int processId);
|
||||
void AddThread(TextThread* thread);
|
||||
void RemoveThread(TextThread* thread);
|
||||
void ThreadOutput(TextThread* thread, QString output);
|
||||
};
|
||||
|
||||
#endif // HOSTSIGNALLER_H
|
||||
|
@ -67,7 +67,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(hostSignaller, &HostSignaller::RemoveProcess, this, &MainWindow::RemoveProcess);
|
||||
connect(hostSignaller, &HostSignaller::AddThread, this, &MainWindow::AddThread);
|
||||
connect(hostSignaller, &HostSignaller::RemoveThread, this, &MainWindow::RemoveThread);
|
||||
connect(hostSignaller, &HostSignaller::ThreadOutput, this, &MainWindow::ThreadOutput);
|
||||
connect(this, &MainWindow::ThreadOutputReceived, this, &MainWindow::ThreadOutput);
|
||||
std::map<int, QString> extensions = LoadExtensions();
|
||||
for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ":" + i.second);
|
||||
Host::Open();
|
||||
@ -115,6 +115,15 @@ void MainWindow::AddThread(TextThread* thread)
|
||||
GenerateHCode(Host::GetHookParam(thread->GetThreadParameter().pid, thread->GetThreadParameter().hook), thread->GetThreadParameter().pid) +
|
||||
")"
|
||||
);
|
||||
thread->RegisterOutputCallBack([&](TextThread* thread, std::wstring output)
|
||||
{
|
||||
output = DispatchSentenceToExtensions(output,
|
||||
{
|
||||
{ "current select", ttCombo->currentText().split(":")[0].toInt() == thread->Number() ? 1 : 0 }
|
||||
});
|
||||
emit ThreadOutputReceived(thread, QString::fromWCharArray(output.c_str()));
|
||||
return output;
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::RemoveThread(TextThread* thread)
|
||||
@ -218,7 +227,7 @@ void MainWindow::on_ttCombo_activated(int index)
|
||||
|
||||
void MainWindow::on_addExtenButton_clicked()
|
||||
{
|
||||
QString extenFileName = QFileDialog::getOpenFileName(this, "Select extension dll", "C:\\", "Extensions (*.dll)");
|
||||
QString extenFileName = QFileDialog::getOpenFileName(this, "Select Extension dll", "C:\\", "Extensions (*.dll)");
|
||||
if (!extenFileName.length()) return;
|
||||
QString extenName = extenFileName.split("/")[extenFileName.split("/").count() - 1];
|
||||
extenName.chop(4);
|
||||
@ -233,6 +242,7 @@ void MainWindow::on_addExtenButton_clicked()
|
||||
|
||||
void MainWindow::on_rmvExtenButton_clicked()
|
||||
{
|
||||
if (extenCombo->currentText().size() == 0) return;
|
||||
QString extenFileName = extenCombo->currentText().split(":")[0] + "_" + extenCombo->currentText().split(":")[1] + "_nexthooker_extension.dll";
|
||||
FreeLibrary(GetModuleHandleW(extenFileName.toStdWString().c_str()));
|
||||
DeleteFileW(extenFileName.toStdWString().c_str());
|
||||
|
@ -22,6 +22,9 @@ public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
signals:
|
||||
void ThreadOutputReceived(TextThread* thread, QString output);
|
||||
|
||||
private slots:
|
||||
void AddProcess(unsigned int processId);
|
||||
void RemoveProcess(unsigned int processId);
|
||||
@ -35,7 +38,6 @@ private slots:
|
||||
void on_hookButton_clicked();
|
||||
void on_saveButton_clicked();
|
||||
void on_addExtenButton_clicked();
|
||||
|
||||
void on_rmvExtenButton_clicked();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user