forked from Public-Mirror/Textractor
move to hex for processId display and display text handles
This commit is contained in:
parent
310d12ea14
commit
cd3cb280d5
@ -6,7 +6,7 @@
|
|||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
TextThread::TextThread(ThreadParam tp, DWORD status) : tp(tp), status(status), name(Host::GetHookName(tp.pid, tp.hook)) {}
|
TextThread::TextThread(ThreadParam tp, DWORD status) : handle(ThreadCounter++), name(Host::GetHookName(tp.pid, tp.hook)), tp(tp), status(status) {}
|
||||||
|
|
||||||
TextThread::~TextThread()
|
TextThread::~TextThread()
|
||||||
{
|
{
|
||||||
|
@ -15,16 +15,17 @@ public:
|
|||||||
~TextThread();
|
~TextThread();
|
||||||
|
|
||||||
std::wstring GetStore();
|
std::wstring GetStore();
|
||||||
|
void AddText(const BYTE* data, int len);
|
||||||
|
void AddSentence(std::wstring sentence);
|
||||||
|
|
||||||
void RegisterOutputCallBack(ThreadOutputCallback cb) { Output = cb; }
|
void RegisterOutputCallBack(ThreadOutputCallback cb) { Output = cb; }
|
||||||
|
|
||||||
void AddText(const BYTE* data, int len);
|
const int64_t handle;
|
||||||
void AddSentence(std::wstring sentence);
|
|
||||||
|
|
||||||
const std::wstring name;
|
const std::wstring name;
|
||||||
const ThreadParam tp;
|
const ThreadParam tp;
|
||||||
|
|
||||||
inline static unsigned FlushDelay = 250; // flush every 250ms by default
|
inline static int FlushDelay = 250; // flush every 250ms by default
|
||||||
|
inline static int ThreadCounter = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Flush();
|
void Flush();
|
||||||
|
@ -51,7 +51,7 @@ MainWindow::~MainWindow()
|
|||||||
|
|
||||||
void MainWindow::AddProcess(unsigned int processId)
|
void MainWindow::AddProcess(unsigned int processId)
|
||||||
{
|
{
|
||||||
processCombo->addItem(QString::number(processId) + ": " + GetModuleName(processId));
|
processCombo->addItem(QString::number(processId, 16).toUpper() + ": " + GetModuleName(processId));
|
||||||
QFile file("SavedHooks.txt");
|
QFile file("SavedHooks.txt");
|
||||||
if (!file.open(QIODevice::ReadOnly)) return;
|
if (!file.open(QIODevice::ReadOnly)) return;
|
||||||
QString processName = GetFullModuleName(processId);
|
QString processName = GetFullModuleName(processId);
|
||||||
@ -69,7 +69,7 @@ void MainWindow::AddProcess(unsigned int processId)
|
|||||||
|
|
||||||
void MainWindow::RemoveProcess(unsigned int processId)
|
void MainWindow::RemoveProcess(unsigned int processId)
|
||||||
{
|
{
|
||||||
processCombo->removeItem(processCombo->findText(QString::number(processId) + ":", Qt::MatchStartsWith));
|
processCombo->removeItem(processCombo->findText(QString::number(processId, 16).toUpper() + ":", Qt::MatchStartsWith));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AddThread(TextThread* thread)
|
void MainWindow::AddThread(TextThread* thread)
|
||||||
@ -118,23 +118,23 @@ QString MainWindow::TextThreadString(TextThread* thread)
|
|||||||
{
|
{
|
||||||
ThreadParam tp = thread->tp;
|
ThreadParam tp = thread->tp;
|
||||||
return QString("%1:%2:%3:%4:%5: ").arg(
|
return QString("%1:%2:%3:%4:%5: ").arg(
|
||||||
QString::number(tp.pid),
|
QString::number(thread->handle, 16).toUpper(),
|
||||||
|
QString::number(tp.pid, 16),
|
||||||
QString::number(tp.hook, 16),
|
QString::number(tp.hook, 16),
|
||||||
QString::number(tp.retn, 16),
|
QString::number(tp.retn, 16),
|
||||||
QString::number(tp.spl, 16),
|
QString::number(tp.spl, 16)
|
||||||
QString::number((int64_t)thread, 16)
|
|
||||||
).toUpper();
|
).toUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadParam MainWindow::ParseTextThreadString(QString textThreadString)
|
ThreadParam MainWindow::ParseTextThreadString(QString textThreadString)
|
||||||
{
|
{
|
||||||
QStringList threadParam = textThreadString.split(":");
|
QStringList threadParam = textThreadString.split(":");
|
||||||
return { threadParam[0].toUInt(), threadParam[1].toULongLong(nullptr, 16), threadParam[2].toULongLong(nullptr, 16), threadParam[3].toULongLong(nullptr, 16) };
|
return { threadParam[1].toUInt(nullptr, 16), threadParam[2].toULongLong(nullptr, 16), threadParam[3].toULongLong(nullptr, 16), threadParam[4].toULongLong(nullptr, 16) };
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD MainWindow::GetSelectedProcessId()
|
DWORD MainWindow::GetSelectedProcessId()
|
||||||
{
|
{
|
||||||
return processCombo->currentText().split(":")[0].toULong();
|
return processCombo->currentText().split(":")[0].toULong(nullptr, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ReloadExtensions()
|
void MainWindow::ReloadExtensions()
|
||||||
@ -148,11 +148,11 @@ std::unordered_map<std::string, int64_t> MainWindow::GetInfoForExtensions(TextTh
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
{ "current select", (int64_t)ttCombo->currentText().startsWith(TextThreadString(thread)) },
|
{ "current select", ttCombo->currentText().startsWith(TextThreadString(thread)) },
|
||||||
{ "text number", 0 },
|
{ "text number", thread->handle },
|
||||||
{ "process id", thread->tp.pid },
|
{ "process id", thread->tp.pid },
|
||||||
{ "hook address", (int64_t)thread->tp.hook },
|
{ "hook address", thread->tp.hook },
|
||||||
{ "text handle", (int64_t)thread },
|
{ "text handle", thread->handle },
|
||||||
{ "text name", (int64_t)thread->name.c_str() }
|
{ "text name", (int64_t)thread->name.c_str() }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user