From b61cef538691db4348106ee5baca7042e735da60 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 30 Jan 2019 15:14:14 -0500 Subject: [PATCH] more d3dx hooks --- vnrhook/engine/native/pchooks.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vnrhook/engine/native/pchooks.cc b/vnrhook/engine/native/pchooks.cc index 73db28c..9fbb9e7 100644 --- a/vnrhook/engine/native/pchooks.cc +++ b/vnrhook/engine/native/pchooks.cc @@ -157,6 +157,15 @@ void PcHooks::hookGDIPlusFunctions() void PcHooks::hookD3DXFunctions(HMODULE d3dxModule) { ConsoleOutput("Textractor: inserting Direct3D hooks (EXPERIMENTAL)"); + + if (GetProcAddress(d3dxModule, "D3DXCreateTextA")) + { + NEW_MODULE_HOOK(d3dxModule, D3DXCreateTextA, s_arg3, 0, 0, 0, USING_STRING, 0) + NEW_MODULE_HOOK(d3dxModule, D3DXCreateTextW, s_arg3, 0, 0, 0, USING_STRING|USING_UNICODE, 0) + } + + // Second call in D3DX(10)CreateFontIndirect is D3DXFont constructor, which sets up the vtable + // Call it to set up the vtable then extract the function addresses from that vtable uintptr_t createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DXCreateFontIndirectA"); if (!createFont) createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DX10CreateFontIndirectA"); if (!createFont) return ConsoleOutput("Textractor: D3DX failed: couldn't find entry function"); @@ -276,8 +285,8 @@ void PcHooks::hookOtherPcFunctions() 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) + NEW_MODULE_HOOK(module, SysAllocStringByteLen, s_arg1, 0, 0, 0, USING_STRING, s_arg2 / arg_sz) + NEW_MODULE_HOOK(module, SysAllocStringLen, s_arg1, 0, 0, 0, USING_UNICODE|USING_STRING, s_arg2 / arg_sz) } }