forked from Public-Mirror/Textractor
add x64 engine
This commit is contained in:
parent
e0507b85d3
commit
4ea5c9cb32
@ -44,10 +44,8 @@ constexpr auto ALREADY_INJECTED = L"Textractor: already injected";
|
||||
constexpr auto ARCHITECTURE_MISMATCH = L"Textractor: architecture mismatch: try 32 bit Textractor instead";
|
||||
constexpr auto INJECT_FAILED = L"Textractor: couldn't inject";
|
||||
constexpr auto INVALID_CODE = L"Textractor: invalid code";
|
||||
constexpr auto NO_HOOKS = L"Textractor: no hooks detected";
|
||||
constexpr auto INVALID_CODEPAGE = L"Textractor: couldn't convert text (invalid codepage?)";
|
||||
constexpr auto PIPE_CONNECTED = u8"Textractor: pipe connected";
|
||||
constexpr auto DISABLE_HOOKS = u8"Textractor: hooks don't work on x64, only read codes work: engine disabled";
|
||||
constexpr auto INSERTING_HOOK = u8"Textractor: inserting hook: %s";
|
||||
constexpr auto REMOVING_HOOK = u8"Textractor: removing hook: %s";
|
||||
constexpr auto HOOK_FAILED = u8"Textractor: failed to insert hook";
|
||||
|
@ -58,7 +58,7 @@ struct HookParam
|
||||
char function[MAX_MODULE_SIZE];
|
||||
DWORD type; // flags
|
||||
UINT codepage; // text encoding
|
||||
WORD length_offset; // index of the string length
|
||||
short length_offset; // index of the string length
|
||||
DWORD user_value; // 7/20/2014: jichi additional parameters for PSP games
|
||||
|
||||
text_fun_t text_fun;
|
||||
|
@ -4,6 +4,8 @@ if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||
set(vnrhook_src
|
||||
main.cc
|
||||
texthook.cc
|
||||
engine/match64.cc
|
||||
engine/native/pchooks.cc
|
||||
util/ithsys/ithsys.cc
|
||||
)
|
||||
else()
|
||||
@ -46,4 +48,4 @@ target_compile_definitions(vnrhook
|
||||
_CRT_NON_CONFORMING_SWPRINTFS
|
||||
_SCL_SECURE_NO_WARNINGS # config.pri
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
)
|
||||
)
|
||||
|
@ -866,7 +866,7 @@ bool DetermineEngineType()
|
||||
bool found = false;
|
||||
#ifndef ITH_DISABLE_ENGINE
|
||||
__try { found = UnsafeDetermineEngineType(); }
|
||||
__except(ExceptHandler((GetExceptionInformation())->ExceptionRecord, 0, 0, 0)) {}
|
||||
__except (ExceptHandler((GetExceptionInformation())->ExceptionRecord, 0, 0, 0)) { ConsoleOutput("Textractor: Hijack ERROR"); }
|
||||
#endif // ITH_DISABLE_ENGINE
|
||||
if (!found) { // jichi 10/2/2013: Only enable it if no game engine is detected
|
||||
PcHooks::hookOtherPcFunctions();
|
||||
|
20
vnrhook/engine/match64.cc
Normal file
20
vnrhook/engine/match64.cc
Normal file
@ -0,0 +1,20 @@
|
||||
#include "main.h"
|
||||
#include "native/pchooks.h"
|
||||
#include "match.h"
|
||||
|
||||
namespace Engine
|
||||
{
|
||||
void Hijack()
|
||||
{
|
||||
static bool hijacked = false;
|
||||
if (hijacked) return;
|
||||
hijacked = true;
|
||||
__try
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
PcHooks::hookGDIPlusFunctions();
|
||||
PcHooks::hookOtherPcFunctions();
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER) { ConsoleOutput("Textractor: Hijack ERROR"); }
|
||||
}
|
||||
}
|
@ -28,14 +28,38 @@
|
||||
|
||||
// Static hook
|
||||
#define NEW_HOOK(_fun, _data, _data_ind, _split_off, _split_ind, _type, _len_off) \
|
||||
NEW_HOOK_AT((DWORD)_fun, _fun, _data, _data_ind, _split_off, _split_ind, _type, _len_off) \
|
||||
NEW_HOOK_AT((uintptr_t)_fun, _fun, _data, _data_ind, _split_off, _split_ind, _type, _len_off) \
|
||||
|
||||
#define NEW_MODULE_HOOK(_module, _fun, _data, _data_ind, _split_off, _split_ind, _type, _len_off) \
|
||||
{ \
|
||||
if (DWORD addr = (DWORD)::GetProcAddress(_module, #_fun)) \
|
||||
if (uintptr_t addr = (uintptr_t)::GetProcAddress(_module, #_fun)) \
|
||||
NEW_HOOK_AT(addr, _fun, _data, _data_ind, _split_off, _split_ind, _type, _len_off) \
|
||||
}
|
||||
|
||||
#ifndef _WIN64
|
||||
enum args {
|
||||
s_retaddr = 0
|
||||
, s_arg1 = 4 * 1 // 0x4
|
||||
, s_arg2 = 4 * 2 // 0x8
|
||||
, s_arg3 = 4 * 3 // 0xc
|
||||
, s_arg4 = 4 * 4 // 0x10
|
||||
, s_arg5 = 4 * 5 // 0x14
|
||||
, s_arg6 = 4 * 6 // 0x18
|
||||
, s_arg7 = 4 * 7
|
||||
};
|
||||
#else // _WIN32
|
||||
enum args {
|
||||
s_retaddr = 0x0,
|
||||
s_arg1 = -0x20,
|
||||
s_arg2 = -0x28,
|
||||
s_arg3 = -0x50,
|
||||
s_arg4 = -0x58,
|
||||
s_arg5 = 0x8,
|
||||
s_arg6 = 0x10,
|
||||
s_arg7 = 0x18
|
||||
};
|
||||
#endif // _WIN64
|
||||
|
||||
// jichi 7/17/2014: Renamed from InitDefaultHook
|
||||
void PcHooks::hookGDIFunctions()
|
||||
{
|
||||
@ -61,15 +85,6 @@ void PcHooks::hookGDIFunctions()
|
||||
//
|
||||
// Note: All functions does not have NO_CONTEXT attribute and will be filtered.
|
||||
|
||||
enum stack {
|
||||
s_retaddr = 0
|
||||
, s_arg1 = 4 * 1 // 0x4
|
||||
, s_arg2 = 4 * 2 // 0x8
|
||||
, s_arg3 = 4 * 3 // 0xc
|
||||
, s_arg4 = 4 * 4 // 0x10
|
||||
, s_arg5 = 4 * 5 // 0x14
|
||||
, s_arg6 = 4 * 6 // 0x18
|
||||
};
|
||||
|
||||
//#define _(Name, ...) \
|
||||
// hookman[HF_##Name].InitHook(Name, __VA_ARGS__); \
|
||||
@ -79,39 +94,39 @@ void PcHooks::hookGDIFunctions()
|
||||
// 7/26/2014 jichi: Why there is no USING_SPLIT type?
|
||||
|
||||
// gdi32.dll
|
||||
NEW_HOOK(GetTextExtentPoint32A, s_arg2, 0,s_arg1,0, USING_STRING, 3) // BOOL GetTextExtentPoint32(HDC hdc, LPCTSTR lpString, int c, LPSIZE lpSize);
|
||||
NEW_HOOK(GetTextExtentExPointA, s_arg2, 0,s_arg1,0, USING_STRING, 3) // BOOL GetTextExtentExPoint(HDC hdc, LPCTSTR lpszStr, int cchString, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize);
|
||||
NEW_HOOK(GetTabbedTextExtentA, s_arg2, 0,s_arg1,0, USING_STRING, 3) // DWORD GetTabbedTextExtent(HDC hDC, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions);
|
||||
NEW_HOOK(GetCharacterPlacementA, s_arg2, 0,s_arg1,0, USING_STRING, 3) // DWORD GetCharacterPlacement(HDC hdc, LPCTSTR lpString, int nCount, int nMaxExtent, LPGCP_RESULTS lpResults, DWORD dwFlags);
|
||||
NEW_HOOK(GetGlyphIndicesA, s_arg2, 0,s_arg1,0, USING_STRING, 3) // DWORD GetGlyphIndices( HDC hdc, LPCTSTR lpstr, int c, LPWORD pgi, DWORD fl);
|
||||
NEW_HOOK(GetTextExtentPoint32A, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // BOOL GetTextExtentPoint32(HDC hdc, LPCTSTR lpString, int c, LPSIZE lpSize);
|
||||
NEW_HOOK(GetTextExtentExPointA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // BOOL GetTextExtentExPoint(HDC hdc, LPCTSTR lpszStr, int cchString, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize);
|
||||
NEW_HOOK(GetTabbedTextExtentA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // DWORD GetTabbedTextExtent(HDC hDC, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions);
|
||||
NEW_HOOK(GetCharacterPlacementA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // DWORD GetCharacterPlacement(HDC hdc, LPCTSTR lpString, int nCount, int nMaxExtent, LPGCP_RESULTS lpResults, DWORD dwFlags);
|
||||
NEW_HOOK(GetGlyphIndicesA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // DWORD GetGlyphIndices( HDC hdc, LPCTSTR lpstr, int c, LPWORD pgi, DWORD fl);
|
||||
NEW_HOOK(GetGlyphOutlineA, s_arg2, 0,s_arg1,0, BIG_ENDIAN, 1) // DWORD GetGlyphOutline(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2);
|
||||
NEW_HOOK(ExtTextOutA, s_arg6, 0,s_arg1,0, USING_STRING, 7) // BOOL ExtTextOut(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lprc, LPCTSTR lpString, UINT cbCount, const INT *lpDx);
|
||||
NEW_HOOK(TextOutA, s_arg4, 0,s_arg1,0, USING_STRING, 5) // BOOL TextOut(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString);
|
||||
NEW_HOOK(TabbedTextOutA, s_arg4, 0,s_arg1,0, USING_STRING, 5) // LONG TabbedTextOut(HDC hDC, int X, int Y, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions, int nTabOrigin);
|
||||
NEW_HOOK(ExtTextOutA, s_arg6, 0,s_arg1,0, USING_STRING, s_arg7 / (short)sizeof(uintptr_t)) // BOOL ExtTextOut(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lprc, LPCTSTR lpString, UINT cbCount, const INT *lpDx);
|
||||
NEW_HOOK(TextOutA, s_arg4, 0,s_arg1,0, USING_STRING, s_arg5 / (short)sizeof(uintptr_t)) // BOOL TextOut(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString);
|
||||
NEW_HOOK(TabbedTextOutA, s_arg4, 0,s_arg1,0, USING_STRING, s_arg5 / (short)sizeof(uintptr_t)) // LONG TabbedTextOut(HDC hDC, int X, int Y, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions, int nTabOrigin);
|
||||
NEW_HOOK(GetCharABCWidthsA, s_arg2, 0,s_arg1,0, BIG_ENDIAN, 1) // BOOL GetCharABCWidths(HDC hdc, UINT uFirstChar, UINT uLastChar, LPABC lpabc);
|
||||
NEW_HOOK(GetCharABCWidthsFloatA, s_arg2, 0,s_arg1,0, BIG_ENDIAN, 1) // BOOL GetCharABCWidthsFloat(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT lpABCF);
|
||||
NEW_HOOK(GetCharWidth32A, s_arg2, 0,s_arg1,0, BIG_ENDIAN, 1) // BOOL GetCharWidth32(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer);
|
||||
NEW_HOOK(GetCharWidthFloatA, s_arg2, 0,s_arg1,0, BIG_ENDIAN, 1) // BOOL GetCharWidthFloat(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer);
|
||||
|
||||
NEW_HOOK(GetTextExtentPoint32W, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3)
|
||||
NEW_HOOK(GetTextExtentExPointW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3)
|
||||
NEW_HOOK(GetTabbedTextExtentW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3)
|
||||
NEW_HOOK(GetCharacterPlacementW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3)
|
||||
NEW_HOOK(GetGlyphIndicesW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3)
|
||||
NEW_HOOK(GetTextExtentPoint32W, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(GetTextExtentExPointW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(GetTabbedTextExtentW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(GetCharacterPlacementW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(GetGlyphIndicesW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(GetGlyphOutlineW, s_arg2, 0,s_arg1,0, USING_UNICODE, 1)
|
||||
NEW_HOOK(ExtTextOutW, s_arg6, 0,s_arg1,0, USING_UNICODE|USING_STRING, 7)
|
||||
NEW_HOOK(TextOutW, s_arg4, 0,s_arg1,0, USING_UNICODE|USING_STRING, 5)
|
||||
NEW_HOOK(TabbedTextOutW, s_arg4, 0,s_arg1,0, USING_UNICODE|USING_STRING, 5)
|
||||
NEW_HOOK(ExtTextOutW, s_arg6, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg7 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(TextOutW, s_arg4, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg5 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(TabbedTextOutW, s_arg4, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg5 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(GetCharABCWidthsW, s_arg2, 0,s_arg1,0, USING_UNICODE, 1)
|
||||
NEW_HOOK(GetCharABCWidthsFloatW, s_arg2, 0,s_arg1,0, USING_UNICODE, 1)
|
||||
NEW_HOOK(GetCharWidth32W, s_arg2, 0,s_arg1,0, USING_UNICODE, 1)
|
||||
NEW_HOOK(GetCharWidthFloatW, s_arg2, 0,s_arg1,0, USING_UNICODE, 1)
|
||||
|
||||
// user32.dll
|
||||
NEW_HOOK(DrawTextA, s_arg2, 0,s_arg1,0, USING_STRING, 3) // int DrawText(HDC hDC, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat);
|
||||
NEW_HOOK(DrawTextExA, s_arg2, 0,s_arg1,0, USING_STRING, 3) // int DrawTextEx(HDC hdc, LPTSTR lpchText,int cchText, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams);
|
||||
NEW_HOOK(DrawTextW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3)
|
||||
NEW_HOOK(DrawTextExW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3)
|
||||
NEW_HOOK(DrawTextA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // int DrawText(HDC hDC, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat);
|
||||
NEW_HOOK(DrawTextExA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // int DrawTextEx(HDC hdc, LPTSTR lpchText,int cchText, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams);
|
||||
NEW_HOOK(DrawTextW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(DrawTextExW, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t))
|
||||
}
|
||||
|
||||
// jichi 6/18/2015: GDI+ functions
|
||||
@ -124,15 +139,6 @@ void PcHooks::hookGDIPlusFunctions()
|
||||
}
|
||||
|
||||
ConsoleOutput("gdi+: loaded");
|
||||
enum stack {
|
||||
s_retaddr = 0
|
||||
, s_arg1 = 4 * 1 // 0x4
|
||||
, s_arg2 = 4 * 2 // 0x8
|
||||
, s_arg3 = 4 * 3 // 0xc
|
||||
, s_arg4 = 4 * 4 // 0x10
|
||||
, s_arg5 = 4 * 5 // 0x14
|
||||
, s_arg6 = 4 * 6 // 0x18
|
||||
};
|
||||
|
||||
// gdiplus.dll
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms534053%28v=vs.85%29.aspx
|
||||
@ -141,11 +147,11 @@ void PcHooks::hookGDIPlusFunctions()
|
||||
// Use arg1 pionter to GpGraphics as split
|
||||
//using namespace Gdiplus::DllExports;
|
||||
// Use arg5 style as split
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathString, s_arg2, 0,s_arg5,0, USING_UNICODE|USING_STRING, 3) // GpStatus WINGDIPAPI GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathStringl, s_arg2, 0,s_arg5,0, USING_UNICODE|USING_STRING, 3) // GpStatus WINGDIPAPI GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST Rect *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
//NEW_MODULE_HOOK(hModule, GdipMeasureCharacterRanges, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3) // GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions)
|
||||
NEW_MODULE_HOOK(hModule, GdipDrawString, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3) // GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush);
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureString, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, 3) // GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled )
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathString, s_arg2, 0,s_arg5,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // GpStatus WINGDIPAPI GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathStringl, s_arg2, 0,s_arg5,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // GpStatus WINGDIPAPI GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST Rect *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
//NEW_MODULE_HOOK(hModule, GdipMeasureCharacterRanges, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions)
|
||||
NEW_MODULE_HOOK(hModule, GdipDrawString, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush);
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureString, s_arg2, 0,s_arg1,0, USING_UNICODE|USING_STRING, s_arg3 / (short)sizeof(uintptr_t)) // GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled )
|
||||
}
|
||||
|
||||
// jichi 10/2/2013
|
||||
@ -154,16 +160,6 @@ void PcHooks::hookOtherPcFunctions()
|
||||
{
|
||||
// int TextHook::InitHook(LPVOID addr, DWORD data, DWORD data_ind, DWORD split_off, DWORD split_ind, WORD type, DWORD len_off)
|
||||
|
||||
enum stack {
|
||||
s_retaddr = 0
|
||||
, s_arg1 = 4 * 1 // 0x4
|
||||
, s_arg2 = 4 * 2 // 0x8
|
||||
, s_arg3 = 4 * 3 // 0xc
|
||||
, s_arg4 = 4 * 4 // 0x10
|
||||
, s_arg5 = 4 * 5 // 0x14
|
||||
, s_arg6 = 4 * 6 // 0x18
|
||||
};
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/78zh94ax.aspx
|
||||
// int WINAPI lstrlen(LPCTSTR lpString);
|
||||
// Lstr functions usually extracts rubbish, and might crash certain games like 「Magical Marriage Lunatics!!」
|
||||
@ -225,15 +221,15 @@ void PcHooks::hookOtherPcFunctions()
|
||||
|
||||
// 3/17/2014 jichi: Temporarily disabled
|
||||
// http://sakuradite.com/topic/159
|
||||
NEW_HOOK(MultiByteToWideChar, s_arg3, 0,4,0, USING_STRING, 4)
|
||||
NEW_HOOK(WideCharToMultiByte, s_arg3, 0,4,0, USING_UNICODE|USING_STRING, 4)
|
||||
NEW_HOOK(MultiByteToWideChar, s_arg3, 0,4,0, USING_STRING, s_arg4 / (short)sizeof(uintptr_t))
|
||||
NEW_HOOK(WideCharToMultiByte, s_arg3, 0,4,0, USING_UNICODE|USING_STRING, s_arg4 / (short)sizeof(uintptr_t))
|
||||
|
||||
NEW_HOOK(CharNextA, s_arg1, 0,0,0, USING_STRING|DATA_INDIRECT, 1) // LPTSTR WINAPI CharNext(_In_ LPCTSTR lpsz);
|
||||
NEW_HOOK(CharNextW, s_arg1, 0,0,0, USING_UNICODE|DATA_INDIRECT, 1)
|
||||
NEW_HOOK(CharPrevA, s_arg1, 0,0,0, USING_STRING|DATA_INDIRECT, 1) // LPTSTR WINAPI CharPrev(_In_ LPCTSTR lpszStart, _In_ LPCTSTR lpszCurrent);
|
||||
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, 1) // LPSTR WINAPI CharNextExA(_In_ WORD CodePage, _In_ LPCSTR lpCurrentChar, _In_ DWORD dwFlags);
|
||||
//NEW_HOOK(CharNextExW, s_arg2, 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))
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
@ -3,19 +3,12 @@
|
||||
// Branch: ITH_DLL/main.cpp, rev 128
|
||||
// 8/24/2013 TODO: Clean up this file
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (disable:4100) // C4100: unreference formal parameter
|
||||
//# pragma warning (disable:4733) // C4733: Inline asm assigning to 'FS:0' : handler not registered as safe handler
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include "main.h"
|
||||
#include "defs.h"
|
||||
#include "text.h"
|
||||
#include "MinHook.h"
|
||||
#include "engine/engine.h"
|
||||
#include "engine/match.h"
|
||||
#include "texthook.h"
|
||||
#include "util/growl.h"
|
||||
|
||||
std::unique_ptr<WinMutex> viewMutex;
|
||||
|
||||
@ -37,13 +30,13 @@ DWORD WINAPI Pipe(LPVOID)
|
||||
AutoHandle<> hostPipe = INVALID_HANDLE_VALUE;
|
||||
hookPipe = INVALID_HANDLE_VALUE;
|
||||
|
||||
while (hookPipe == INVALID_HANDLE_VALUE || hostPipe == INVALID_HANDLE_VALUE)
|
||||
while (!hookPipe || !hostPipe)
|
||||
{
|
||||
if (hookPipe == INVALID_HANDLE_VALUE)
|
||||
if (!hookPipe)
|
||||
{
|
||||
hookPipe = CreateFileW(HOOK_PIPE, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
}
|
||||
if (hookPipe != INVALID_HANDLE_VALUE && hostPipe == INVALID_HANDLE_VALUE)
|
||||
if (hookPipe && !hostPipe)
|
||||
{
|
||||
hostPipe = CreateFileW(HOST_PIPE, GENERIC_READ | FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
DWORD mode = PIPE_READMODE_MESSAGE;
|
||||
@ -57,11 +50,7 @@ DWORD WINAPI Pipe(LPVOID)
|
||||
WriteFile(hookPipe, buffer, sizeof(DWORD), &count, nullptr);
|
||||
|
||||
ConsoleOutput(PIPE_CONNECTED);
|
||||
#ifdef _WIN64
|
||||
ConsoleOutput(DISABLE_HOOKS);
|
||||
#else
|
||||
Engine::Hijack();
|
||||
#endif
|
||||
|
||||
while (running && ReadFile(hostPipe, buffer, PIPE_BUFFER_SIZE, &count, nullptr))
|
||||
switch (*(HostCommandType*)buffer)
|
||||
@ -157,4 +146,4 @@ void RemoveHook(uint64_t addr, int maxOffset)
|
||||
if (abs((long long)(hooks[i].address - addr)) <= maxOffset) return hooks[i].Clear();
|
||||
}
|
||||
|
||||
// EOF
|
||||
// EOF
|
||||
|
Loading…
x
Reference in New Issue
Block a user