From c596116a03b59a6e31bd7607d6fb7a6ab04ecc80 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 27 Jan 2019 03:39:33 -0500 Subject: [PATCH] add oleaut hooks as misc --- vnrhook/engine/engine.cc | 15 --------------- vnrhook/engine/engine.h | 1 - vnrhook/engine/match.cc | 6 ------ vnrhook/engine/native/pchooks.cc | 17 +++++++++-------- vnrhook/engine/native/pchooks.h | 2 ++ 5 files changed, 11 insertions(+), 30 deletions(-) diff --git a/vnrhook/engine/engine.cc b/vnrhook/engine/engine.cc index e1bc547..0bcd393 100644 --- a/vnrhook/engine/engine.cc +++ b/vnrhook/engine/engine.cc @@ -11905,21 +11905,6 @@ bool InsertSilkysHook() return true; } -bool InsertSRPGHook() -{ - if (DWORD addr = (DWORD)GetProcAddress(GetModuleHandleW(L"oleaut32.dll"), "SysAllocString")) - { - HookParam hp = {}; - hp.offset = 4; - hp.address = addr; - hp.type = USING_STRING | USING_UNICODE; - NewHook(hp, "SRPG"); - return true; - } - ConsoleOutput("Textractor: SRPG: couldn't find function"); - return false; -} - /** jichi 6/1/2014 Eushully * Insert to the last GetTextExtentPoint32A * diff --git a/vnrhook/engine/engine.h b/vnrhook/engine/engine.h index fd33dec..3004ee8 100644 --- a/vnrhook/engine/engine.h +++ b/vnrhook/engine/engine.h @@ -142,7 +142,6 @@ bool InsertScenarioPlayerHook();// sol-fa-soft: *.iar && *.sec5 bool InsertSiglusHook(); // SiglusEngine: SiglusEngine.exe bool InsertSideBHook(); // SideB: Copyright side-B bool InsertSilkysHook(); // SilkysPlus -bool InsertSRPGHook(); // SilverSoft SRPG studio: *.dts bool InsertSyuntadaHook(); // Syuntada: dSoh.dat bool InsertSystem43Hook(); // System43@AliceSoft: AliceStart.ini bool InsertSystemAoiHook(); // SystemAoi: *.vfs diff --git a/vnrhook/engine/match.cc b/vnrhook/engine/match.cc index ca4e9f0..aff0020 100644 --- a/vnrhook/engine/match.cc +++ b/vnrhook/engine/match.cc @@ -449,12 +449,6 @@ bool DetermineEngineByFile4() return true; } - // Artikash 1/18/2019: SRPG Studio sample game https://www.freem.ne.jp/win/game/16844 - if (Util::CheckFile(L"*.dts")) { - InsertSRPGHook(); - return true; - } - return false; } diff --git a/vnrhook/engine/native/pchooks.cc b/vnrhook/engine/native/pchooks.cc index 9665ca4..3894ef3 100644 --- a/vnrhook/engine/native/pchooks.cc +++ b/vnrhook/engine/native/pchooks.cc @@ -154,16 +154,12 @@ void PcHooks::hookGDIPlusFunctions() } -bool PcHooks::hookD3DXFunctions(HMODULE d3dxModule) +void PcHooks::hookD3DXFunctions(HMODULE d3dxModule) { ConsoleOutput("Textractor: inserting Direct3D hooks (EXPERIMENTAL)"); uintptr_t createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DXCreateFontIndirectA"); if (!createFont) createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DX10CreateFontIndirectA"); - if (!createFont) - { - ConsoleOutput("Textractor: D3DX failed: couldn't find entry function"); - return false; - } + if (!createFont) return ConsoleOutput("Textractor: D3DX failed: couldn't find entry function"); struct D3DXFont { @@ -192,11 +188,10 @@ bool PcHooks::hookD3DXFunctions(HMODULE d3dxModule) hp.address = (*font.vtable)[15]; hp.type = USING_STRING | USING_UNICODE; NewHook(hp, "ID3DXFont::DrawTextW"); - return true; + return; } } ConsoleOutput("Textractor: D3DX failed: couldn't find vtable"); - return false; } // jichi 10/2/2013 @@ -275,6 +270,12 @@ void PcHooks::hookOtherPcFunctions() NEW_HOOK(CharPrevW, s_arg1, 0,0,0, USING_UNICODE|DATA_INDIRECT, 1) //NEW_HOOK(CharNextExA, s_arg2, 0,0,0, USING_STRING|DATA_INDIRECT, s_arg1 / (short)sizeof(uintptr_t)) // LPSTR WINAPI CharNextExA(_In_ WORD CodePage, _In_ LPCSTR lpCurrentChar, _In_ DWORD dwFlags); //NEW_HOOK(CharNextExW, s_arg2, 0,0,0, USING_UNICODE|DATA_INDIRECT, s_arg1 / (short)sizeof(uintptr_t)) + if (HMODULE module = GetModuleHandleW(L"OLEAUT32")) + { + NEW_MODULE_HOOK(module, SysAllocString, s_arg1, 0, 0, 0, USING_UNICODE|USING_STRING, 0) + NEW_MODULE_HOOK(module, SysAllocStringByteLen, s_arg1, 0, 0, 0, USING_STRING, s_arg2) + NEW_MODULE_HOOK(module, SysAllocStringLen, s_arg1, 0, 0, 0, USING_UNICODE|USING_STRING, s_arg2) + } } // EOF diff --git a/vnrhook/engine/native/pchooks.h b/vnrhook/engine/native/pchooks.h index 2510a7b..b79cf79 100644 --- a/vnrhook/engine/native/pchooks.h +++ b/vnrhook/engine/native/pchooks.h @@ -3,6 +3,8 @@ // pchooks.h // 8/1/2014 jichi +#include + namespace PcHooks { void hookGDIFunctions();