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 = {};
|
||||
hp.offset = 4;
|
||||
hp.length_offset = 1;
|
||||
hp.type = USING_UNICODE|MODULE_OFFSET|FUNCTION_OFFSET;
|
||||
// jichi 12/27/2013: This function does not work for the latest bruns games anymore
|
||||
hp.function = 0x8b24c7bc;
|
||||
hp.type = USING_UNICODE;
|
||||
//?push_back@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXG@Z
|
||||
if (Util::CheckFile(L"msvcp90.dll"))
|
||||
hp.module = 0xc9c36a5b; // 3385027163
|
||||
if (Util::CheckFile(L"msvcp90.dll"))
|
||||
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"))
|
||||
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
|
||||
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"))
|
||||
hp.module = 0xd571d760; // 3581007712;
|
||||
if (hp.module) {
|
||||
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.address) {
|
||||
ConsoleOutput("vnreng: INSERT Brus#1");
|
||||
NewHook(hp, "Bruns");
|
||||
}
|
||||
|
@ -498,42 +498,19 @@ int TextHook::UnsafeInsertHookCode()
|
||||
{
|
||||
//ConsoleOutput("vnrcli:UnsafeInsertHookCode: enter");
|
||||
enum : int { yes = 0, no = 1 };
|
||||
// MODULE_OFFSET is set, but there's no module address
|
||||
// this means that this is an absolute address found on Windows 2000/XP
|
||||
// we make the address relative to the process base
|
||||
// we also store the original address in the function field because normally there can not
|
||||
// exist a function address without a module address
|
||||
if (hp.type & MODULE_OFFSET && !hp.module) {
|
||||
DWORD base = GetModuleBase();
|
||||
hp.function = hp.address;
|
||||
hp.address -= 0x400000;
|
||||
hp.address += base;
|
||||
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;
|
||||
}
|
||||
if (hp.module && (hp.type & MODULE_OFFSET)) { // Map hook offset to real address.
|
||||
if (DWORD base = GetModuleBase(hp.module)) {
|
||||
hp.address += base;
|
||||
}
|
||||
else {
|
||||
currentHook--;
|
||||
ConsoleOutput("vnrcli:UnsafeInsertHookCode: FAILED: module not present");
|
||||
return no;
|
||||
}
|
||||
hp.type &= ~MODULE_OFFSET;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
TextHook *it = hookman;
|
||||
for (int i = 0; (i < currentHook) && it; it++) { // Check if there is a collision.
|
||||
|
Loading…
x
Reference in New Issue
Block a user