forked from Public-Mirror/Textractor
update anex86 hook
This commit is contained in:
parent
93238e13ed
commit
8e67827ae6
@ -13,6 +13,12 @@
|
|||||||
"configurationType": "RelWithDebInfo",
|
"configurationType": "RelWithDebInfo",
|
||||||
"inheritEnvironments": [ "msvc_x86" ]
|
"inheritEnvironments": [ "msvc_x86" ]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "x86-Release",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "Release",
|
||||||
|
"inheritEnvironments": [ "msvc_x86" ]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "x64-Debug",
|
"name": "x64-Debug",
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
@ -24,6 +30,12 @@
|
|||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"configurationType": "RelWithDebInfo",
|
"configurationType": "RelWithDebInfo",
|
||||||
"inheritEnvironments": [ "msvc_x64" ]
|
"inheritEnvironments": [ "msvc_x64" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x64-Release",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "Release",
|
||||||
|
"inheritEnvironments": [ "msvc_x64" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ find_qt5(Core Widgets)
|
|||||||
add_executable(Textractor WIN32
|
add_executable(Textractor WIN32
|
||||||
main.cpp
|
main.cpp
|
||||||
mainwindow.cpp
|
mainwindow.cpp
|
||||||
extenwindow.cpp
|
extenwindow.cpp
|
||||||
host/exception.cpp
|
host/exception.cpp
|
||||||
host/host.cpp
|
host/host.cpp
|
||||||
host/textthread.cpp
|
host/textthread.cpp
|
||||||
|
@ -88,7 +88,7 @@ namespace
|
|||||||
}
|
}
|
||||||
HCode.erase(0, 1);
|
HCode.erase(0, 1);
|
||||||
|
|
||||||
if ((hp.type & USING_STRING))
|
if (hp.type & USING_STRING)
|
||||||
{
|
{
|
||||||
if (HCode[0] == L'F')
|
if (HCode[0] == L'F')
|
||||||
{
|
{
|
||||||
|
@ -145,6 +145,9 @@ inline std::string WideStringToString(const std::wstring& text)
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline void TEXTRACTOR_MESSAGE(const wchar_t* format, const Args&... args) { MessageBoxW(NULL, FormatString(format, args...).c_str(), L"Textractor", MB_OK); }
|
inline void TEXTRACTOR_MESSAGE(const wchar_t* format, const Args&... args) { MessageBoxW(NULL, FormatString(format, args...).c_str(), L"Textractor", MB_OK); }
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
inline void TEXTRACTOR_DEBUG(const wchar_t* format, const Args&... args) { std::thread([=] { TEXTRACTOR_MESSAGE(format, args...); }).detach(); }
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define TEST(...) static auto _ = CreateThread(nullptr, 0, [](auto) { __VA_ARGS__; return 0UL; }, NULL, 0, nullptr);
|
#define TEST(...) static auto _ = CreateThread(nullptr, 0, [](auto) { __VA_ARGS__; return 0UL; }, NULL, 0, nullptr);
|
||||||
#else
|
#else
|
||||||
|
@ -31,4 +31,4 @@ inline QString S(const std::string& s) { return QString::fromStdString(s); }
|
|||||||
inline QString S(const std::wstring& s) { return QString::fromStdWString(s); }
|
inline QString S(const std::wstring& s) { return QString::fromStdWString(s); }
|
||||||
// TODO: allow paired surrogates
|
// TODO: allow paired surrogates
|
||||||
inline void sanitize(QString& s) { s.chop(std::distance(std::remove_if(s.begin(), s.end(), [](QChar ch) { return ch.isSurrogate(); }), s.end())); }
|
inline void sanitize(QString& s) { s.chop(std::distance(std::remove_if(s.begin(), s.end(), [](QChar ch) { return ch.isSurrogate(); }), s.end())); }
|
||||||
inline QString sanitize(QString&& s) { sanitize(s); return s; }
|
inline QString sanitize(QString&& s) { sanitize(s); return std::move(s); }
|
||||||
|
@ -10095,7 +10095,7 @@ BYTE JIS_tableL[0x80] = {
|
|||||||
0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x00,
|
0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
void SpecialHookAnex86(DWORD esp_base, HookParam *hp, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
void SpecialHookAnex86(DWORD esp_base, HookParam*, BYTE, DWORD *data, DWORD *split, DWORD *len)
|
||||||
{
|
{
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
@ -10134,19 +10134,28 @@ _fin:
|
|||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
bool InsertAnex86Hook()
|
bool InsertAnex86Hook()
|
||||||
{
|
{
|
||||||
const DWORD dwords[] = {0x618ac033,0x0d418a0c}; // jichi 12/25/2013: Remove static keyword
|
const BYTE bytes[] = {
|
||||||
for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 8; i++)
|
0x8a, XX, 0x0c, // mov ??,[ecx+0C]
|
||||||
if (*(DWORD *)i == dwords[0])
|
0x8a, XX, 0x0d // mov ??,[ecx+0D]
|
||||||
if (*(DWORD *)(i + 4) == dwords[1]) {
|
};
|
||||||
|
bool found = false;
|
||||||
|
for (auto addr : Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress)) {
|
||||||
|
//const DWORD dwords[] = {0x618ac033,0x0d418a0c}; // jichi 12/25/2013: Remove static keyword
|
||||||
|
//for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 8; i++)
|
||||||
|
//if (*(DWORD *)i == dwords[0])
|
||||||
|
//if (*(DWORD *)(i + 4) == dwords[1]) {
|
||||||
HookParam hp = {};
|
HookParam hp = {};
|
||||||
hp.address = i;
|
if (*(BYTE*)(addr - 2) == 0x33 || *(BYTE*)(addr - 2) == 0x31) addr = addr - 2;
|
||||||
|
hp.address = addr;
|
||||||
|
hp.offset = pusha_ecx_off - 4;
|
||||||
hp.text_fun = SpecialHookAnex86;
|
hp.text_fun = SpecialHookAnex86;
|
||||||
//hp.type = EXTERN_HOOK;
|
//hp.type = EXTERN_HOOK;
|
||||||
hp.length_offset = 1;
|
hp.length_offset = 1;
|
||||||
ConsoleOutput("vnreng: INSERT Anex86");
|
ConsoleOutput("vnreng: INSERT Anex86");
|
||||||
NewHook(hp, "Anex86");
|
NewHook(hp, "Anex86");
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
if (found) return true;
|
||||||
ConsoleOutput("vnreng:Anex86: failed");
|
ConsoleOutput("vnreng:Anex86: failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user