refactor and give extensions 64 bits
This commit is contained in:
parent
e2f83d47b9
commit
4bc0c834d7
@ -26,7 +26,7 @@ std::map<int, QString> LoadExtensions()
|
||||
return extensionNames;
|
||||
}
|
||||
|
||||
bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map<std::string, int> miscInfo)
|
||||
bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map<std::string, int64_t> miscInfo)
|
||||
{
|
||||
wchar_t* sentenceBuffer = (wchar_t*)malloc((sentence.size() + 1) * sizeof(wchar_t));
|
||||
wcscpy(sentenceBuffer, sentence.c_str());
|
||||
|
@ -5,12 +5,12 @@
|
||||
#include <map>
|
||||
|
||||
std::map<int, QString> LoadExtensions();
|
||||
bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map<std::string, int> miscInfo);
|
||||
bool DispatchSentenceToExtensions(std::wstring& sentence, std::unordered_map<std::string, int64_t> miscInfo);
|
||||
struct InfoForExtension
|
||||
{
|
||||
~InfoForExtension() { if (nextProperty) delete nextProperty; };
|
||||
const char* propertyName = "";
|
||||
int propertyValue = 0;
|
||||
int64_t propertyValue = 0;
|
||||
InfoForExtension* nextProperty = nullptr;
|
||||
};
|
||||
typedef wchar_t*(*ExtensionFunction)(const wchar_t*, const InfoForExtension*);
|
||||
|
@ -3,9 +3,10 @@
|
||||
// Branch IHF/TextThread.cpp, rev 133
|
||||
|
||||
#include "textthread.h"
|
||||
#include "host.h"
|
||||
#include "const.h"
|
||||
|
||||
TextThread::TextThread(ThreadParam tp, DWORD status) : tp(tp), status(status) {}
|
||||
TextThread::TextThread(ThreadParam tp, DWORD status) : tp(tp), status(status), name(Host::GetHookName(tp.pid, tp.hook)) {}
|
||||
|
||||
TextThread::~TextThread()
|
||||
{
|
||||
|
@ -15,13 +15,15 @@ public:
|
||||
~TextThread();
|
||||
|
||||
std::wstring GetStore();
|
||||
ThreadParam GetThreadParam() { return tp; }
|
||||
|
||||
void RegisterOutputCallBack(ThreadOutputCallback cb) { Output = cb; }
|
||||
|
||||
void AddText(const BYTE* data, int len);
|
||||
void AddSentence(std::wstring sentence);
|
||||
|
||||
const std::wstring name;
|
||||
const ThreadParam tp;
|
||||
|
||||
private:
|
||||
void Flush();
|
||||
|
||||
@ -34,7 +36,6 @@ private:
|
||||
DWORD timestamp = GetTickCount();
|
||||
|
||||
ThreadOutputCallback Output;
|
||||
ThreadParam tp;
|
||||
DWORD status;
|
||||
};
|
||||
|
||||
|
@ -77,9 +77,9 @@ void MainWindow::AddThread(TextThread* thread)
|
||||
{
|
||||
ttCombo->addItem(
|
||||
TextThreadString(thread) +
|
||||
QString::fromStdWString(Host::GetHookName(thread->GetThreadParam().pid, thread->GetThreadParam().hook)) +
|
||||
QString::fromStdWString(thread->name) +
|
||||
" (" +
|
||||
GenerateCode(Host::GetHookParam(thread->GetThreadParam()), thread->GetThreadParam().pid) +
|
||||
GenerateCode(Host::GetHookParam(thread->tp), thread->tp.pid) +
|
||||
")"
|
||||
);
|
||||
thread->RegisterOutputCallBack([&](TextThread* thread, std::wstring output)
|
||||
@ -117,7 +117,7 @@ void MainWindow::ThreadOutput(TextThread* thread, QString output)
|
||||
|
||||
QString MainWindow::TextThreadString(TextThread* thread)
|
||||
{
|
||||
ThreadParam tp = thread->GetThreadParam();
|
||||
ThreadParam tp = thread->tp;
|
||||
return QString("%1:%2:%3:%4: ").arg(
|
||||
QString::number(tp.pid),
|
||||
QString::number(tp.hook, 16),
|
||||
@ -144,16 +144,16 @@ void MainWindow::ReloadExtensions()
|
||||
for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ": " + i.second);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, int> MainWindow::GetInfoForExtensions(TextThread* thread)
|
||||
std::unordered_map<std::string, int64_t> MainWindow::GetInfoForExtensions(TextThread* thread)
|
||||
{
|
||||
return
|
||||
{
|
||||
{ "current select", (int)ttCombo->currentText().startsWith(TextThreadString(thread)) },
|
||||
{ "current select", (int64_t)ttCombo->currentText().startsWith(TextThreadString(thread)) },
|
||||
{ "text number", 0 },
|
||||
{ "process id", thread->GetThreadParam().pid },
|
||||
{ "hook address", (int)thread->GetThreadParam().hook },
|
||||
{ "hook address (upper 32 bits)", (int)(thread->GetThreadParam().hook >> 32) },
|
||||
{ "text handle", (int)thread }
|
||||
{ "process id", thread->tp.pid },
|
||||
{ "hook address", (int64_t)thread->tp.hook },
|
||||
{ "text handle", (int64_t)thread },
|
||||
{ "text name", (int64_t)thread->name.c_str() }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ private:
|
||||
ThreadParam ParseTextThreadString(QString textThreadString);
|
||||
DWORD GetSelectedProcessId();
|
||||
void ReloadExtensions();
|
||||
std::unordered_map<std::string, int> GetInfoForExtensions(TextThread* thread);
|
||||
std::unordered_map<std::string, int64_t> GetInfoForExtensions(TextThread* thread);
|
||||
QVector<HookParam> GetAllHooks(DWORD processId);
|
||||
|
||||
Ui::MainWindow* ui;
|
||||
|
@ -2,12 +2,13 @@
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
struct InfoForExtension
|
||||
{
|
||||
const char* propertyName;
|
||||
int propertyValue;
|
||||
int64_t propertyValue;
|
||||
InfoForExtension* nextProperty;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user