forked from Public-Mirror/Textractor
clean up engine
This commit is contained in:
parent
1b9febb4a5
commit
df9fb07395
@ -7655,19 +7655,17 @@ void InsertBrunsHook()
|
|||||||
HookParam hp = {};
|
HookParam hp = {};
|
||||||
hp.offset = 4;
|
hp.offset = 4;
|
||||||
hp.length_offset = 1;
|
hp.length_offset = 1;
|
||||||
hp.type = USING_UNICODE|MODULE_OFFSET|FUNCTION_OFFSET;
|
hp.type = USING_UNICODE;
|
||||||
// jichi 12/27/2013: This function does not work for the latest bruns games anymore
|
|
||||||
hp.function = 0x8b24c7bc;
|
|
||||||
//?push_back@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXG@Z
|
//?push_back@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXG@Z
|
||||||
if (Util::CheckFile(L"msvcp90.dll"))
|
if (Util::CheckFile(L"msvcp90.dll"))
|
||||||
hp.module = 0xc9c36a5b; // 3385027163
|
hp.address = (DWORD)GetProcAddress(GetModuleHandleW(L"msvcp90.dll"), "?push_back@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXG@Z");
|
||||||
else if (Util::CheckFile(L"msvcp80.dll"))
|
else if (Util::CheckFile(L"msvcp80.dll"))
|
||||||
hp.module = 0xa9c36a5b; // 2848156251
|
hp.address = (DWORD)GetProcAddress(GetModuleHandleW(L"msvcp80.dll"), "?push_back@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXG@Z");
|
||||||
else if (Util::CheckFile(L"msvcp100.dll")) // jichi 8/17/2013: MSVCRT 10.0 and 11.0
|
else if (Util::CheckFile(L"msvcp100.dll")) // jichi 8/17/2013: MSVCRT 10.0 and 11.0
|
||||||
hp.module = 0xb571d760; // 3044136800;
|
hp.address = (DWORD)GetProcAddress(GetModuleHandleW(L"msvcp100.dll"), "?push_back@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXG@Z");
|
||||||
else if (Util::CheckFile(L"msvcp110.dll"))
|
else if (Util::CheckFile(L"msvcp110.dll"))
|
||||||
hp.module = 0xd571d760; // 3581007712;
|
hp.address = (DWORD)GetProcAddress(GetModuleHandleW(L"msvcp110.dll"), "?push_back@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXG@Z");
|
||||||
if (hp.module) {
|
if (hp.address) {
|
||||||
ConsoleOutput("vnreng: INSERT Brus#1");
|
ConsoleOutput("vnreng: INSERT Brus#1");
|
||||||
NewHook(hp, "Bruns");
|
NewHook(hp, "Bruns");
|
||||||
}
|
}
|
||||||
|
@ -498,42 +498,19 @@ int TextHook::UnsafeInsertHookCode()
|
|||||||
{
|
{
|
||||||
//ConsoleOutput("vnrcli:UnsafeInsertHookCode: enter");
|
//ConsoleOutput("vnrcli:UnsafeInsertHookCode: enter");
|
||||||
enum : int { yes = 0, no = 1 };
|
enum : int { yes = 0, no = 1 };
|
||||||
// MODULE_OFFSET is set, but there's no module address
|
if (hp.module && (hp.type & MODULE_OFFSET)) { // Map hook offset to real address.
|
||||||
// this means that this is an absolute address found on Windows 2000/XP
|
if (DWORD base = GetModuleBase(hp.module)) {
|
||||||
// we make the address relative to the process base
|
hp.address += base;
|
||||||
// we also store the original address in the function field because normally there can not
|
}
|
||||||
// exist a function address without a module address
|
else {
|
||||||
if (hp.type & MODULE_OFFSET && !hp.module) {
|
currentHook--;
|
||||||
DWORD base = GetModuleBase();
|
ConsoleOutput("vnrcli:UnsafeInsertHookCode: FAILED: module not present");
|
||||||
hp.function = hp.address;
|
return no;
|
||||||
hp.address -= 0x400000;
|
}
|
||||||
hp.address += base;
|
hp.type &= ~MODULE_OFFSET;
|
||||||
hp.type &= ~MODULE_OFFSET;
|
|
||||||
}
|
|
||||||
else if (hp.module && (hp.type & MODULE_OFFSET)) { // Map hook offset to real address.
|
|
||||||
if (DWORD base = GetModuleBase(hp.module)) {
|
|
||||||
if (hp.function && (hp.type & FUNCTION_OFFSET)) {
|
|
||||||
base = GetExportAddress(base, hp.function);
|
|
||||||
if (base)
|
|
||||||
hp.address += base;
|
|
||||||
else {
|
|
||||||
currentHook--;
|
|
||||||
ConsoleOutput("vnrcli:UnsafeInsertHookCode: FAILED: function not found in the export table");
|
|
||||||
return no;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
hp.address += base;
|
|
||||||
}
|
|
||||||
hp.type &= ~(MODULE_OFFSET | FUNCTION_OFFSET);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
currentHook--;
|
|
||||||
ConsoleOutput("vnrcli:UnsafeInsertHookCode: FAILED: module not present");
|
|
||||||
return no;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
TextHook *it = hookman;
|
TextHook *it = hookman;
|
||||||
for (int i = 0; (i < currentHook) && it; it++) { // Check if there is a collision.
|
for (int i = 0; (i < currentHook) && it; it++) { // Check if there is a collision.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user