forked from Public-Mirror/Textractor
make host play nice with larger addresses, and more refactoring
This commit is contained in:
parent
bc6c1325ed
commit
c32066e43c
@ -17,6 +17,5 @@ struct InfoForExtension
|
||||
InfoForExtension* nextProperty;
|
||||
};
|
||||
typedef const wchar_t*(*ExtensionFunction)(const wchar_t*, const InfoForExtension*);
|
||||
extern QComboBox* ttCombo;
|
||||
|
||||
#endif // EXTENSIONS_H
|
||||
|
@ -117,10 +117,7 @@ void MainWindow::AddThread(TextThread* thread)
|
||||
);
|
||||
thread->RegisterOutputCallBack([&](TextThread* thread, std::wstring output)
|
||||
{
|
||||
output = DispatchSentenceToExtensions(output,
|
||||
{
|
||||
{ "current select", ttCombo->currentText().split(":")[0].toInt() == thread->Number() ? 1 : 0 }
|
||||
});
|
||||
output = DispatchSentenceToExtensions(output, GetInfoForExtensions(thread));
|
||||
emit ThreadOutputReceived(thread, QString::fromWCharArray(output.c_str()));
|
||||
return output;
|
||||
});
|
||||
@ -147,6 +144,18 @@ void MainWindow::ThreadOutput(TextThread* thread, QString output)
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, int> MainWindow::GetInfoForExtensions(TextThread* thread)
|
||||
{
|
||||
return
|
||||
{
|
||||
{ "current select", ttCombo->currentText().split(":")[0].toInt() == thread->Number() ? 1 : 0 },
|
||||
{ "text number", thread->Number() },
|
||||
{ "process id", thread->GetThreadParameter().pid },
|
||||
{ "hook address", (int)thread->GetThreadParameter().hook },
|
||||
{ "hook address (upper 32 bits)", (int)(thread->GetThreadParameter().hook >> 32) }
|
||||
};
|
||||
}
|
||||
|
||||
QVector<HookParam> MainWindow::GetAllHooks(DWORD processId)
|
||||
{
|
||||
std::unordered_set<DWORD> addresses;
|
||||
|
@ -41,6 +41,7 @@ private slots:
|
||||
void on_rmvExtenButton_clicked();
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, int> GetInfoForExtensions(TextThread* thread);
|
||||
QVector<HookParam> GetAllHooks(DWORD processId);
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
|
18
GUI/misc.cpp
18
GUI/misc.cpp
@ -113,9 +113,9 @@ HookParam ParseHCode(QString HCode)
|
||||
hp.type |= MODULE_OFFSET;
|
||||
hp.module = Hash(HCode);
|
||||
}
|
||||
if (hp.offset & 0x80000000)
|
||||
if (hp.offset < 0)
|
||||
hp.offset -= 4;
|
||||
if (hp.split & 0x80000000)
|
||||
if (hp.split < 0)
|
||||
hp.split -= 4;
|
||||
return hp;
|
||||
}
|
||||
@ -143,27 +143,29 @@ QString GenerateHCode(HookParam hp, DWORD processId)
|
||||
}
|
||||
if (hp.type & NO_CONTEXT)
|
||||
code += "N";
|
||||
if (hp.offset >> 31)
|
||||
code += "-" + QString::number(-(hp.offset + 4), 16);
|
||||
if (hp.offset < 0) hp.offset += 4;
|
||||
if (hp.split < 0) hp.split += 4;
|
||||
if (hp.offset < 0)
|
||||
code += "-" + QString::number(-hp.offset, 16);
|
||||
else
|
||||
code += QString::number(hp.offset, 16);
|
||||
if (hp.type & DATA_INDIRECT)
|
||||
{
|
||||
if (hp.index >> 31)
|
||||
if (hp.index < 0)
|
||||
code += "*-" + QString::number(-hp.index, 16);
|
||||
else
|
||||
code += "*" + QString::number(hp.index, 16);
|
||||
}
|
||||
if (hp.type & USING_SPLIT)
|
||||
{
|
||||
if (hp.split >> 31)
|
||||
code += ":-" + QString::number(-(hp.split + 4), 16);
|
||||
if (hp.split < 0)
|
||||
code += ":-" + QString::number(-hp.split, 16);
|
||||
else
|
||||
code += ":" + QString::number(hp.split, 16);
|
||||
}
|
||||
if (hp.type & SPLIT_INDIRECT)
|
||||
{
|
||||
if (hp.split_index >> 31)
|
||||
if (hp.split_index < 0)
|
||||
code += "*-" + QString::number(-hp.split_index, 16);
|
||||
else
|
||||
code += "*" + QString::number(hp.split_index, 16);
|
||||
|
@ -28,7 +28,7 @@ struct ThreadParameterHasher
|
||||
{
|
||||
size_t operator()(const ThreadParameter& tp) const
|
||||
{
|
||||
return std::hash<DWORD>()(tp.pid << 6) + std::hash<DWORD>()(tp.hook) + std::hash<DWORD>()(tp.retn) + std::hash<DWORD>()(tp.spl);
|
||||
return std::hash<__int64>()(tp.pid << 6) + std::hash<__int64>()(tp.hook) + std::hash<__int64>()(tp.retn) + std::hash<__int64>()(tp.spl);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
struct ThreadParameter
|
||||
{
|
||||
DWORD pid; // jichi: 5/11/2014: The process ID
|
||||
DWORD hook; // Artikash 6/6/2018: The start address of the hook
|
||||
DWORD retn; // jichi 5/11/2014: The return address of the hook
|
||||
DWORD spl; // jichi 5/11/2014: the processed split value of the hook paramete
|
||||
unsigned __int64 hook; // Artikash 6/6/2018: The start address of the hook
|
||||
unsigned __int64 retn; // jichi 5/11/2014: The return address of the hook
|
||||
__int64 spl; // jichi 5/11/2014: the processed split value of the hook paramete
|
||||
|
||||
// Artikash 5/31/2018: required for unordered_map to work with struct key
|
||||
friend bool operator==(const ThreadParameter& one, const ThreadParameter& two)
|
||||
|
@ -77,7 +77,7 @@ struct Hook { // size: 0x80
|
||||
BYTE recover[0x68 - sizeof(HookParam)];
|
||||
BYTE original[0x10];
|
||||
|
||||
DWORD Address() const { return hp.address; }
|
||||
unsigned __int64 Address() const { return hp.address; }
|
||||
DWORD Type() const { return hp.type; }
|
||||
WORD Length() const { return hp.hook_len; }
|
||||
LPSTR Name() const { return hook_name; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user