Merge remote-tracking branch 'Blu3train/Artemis_x64'
This commit is contained in:
commit
4d590613d3
@ -7,6 +7,10 @@
|
|||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#define XX2 XX,XX // WORD
|
||||||
|
#define XX4 XX2,XX2 // DWORD
|
||||||
|
#define XX8 XX4,XX4 // QWORD
|
||||||
|
|
||||||
namespace Engine
|
namespace Engine
|
||||||
{
|
{
|
||||||
enum : DWORD { X64_MAX_REL_ADDR = 0x00300000 };
|
enum : DWORD { X64_MAX_REL_ADDR = 0x00300000 };
|
||||||
@ -215,6 +219,35 @@ namespace Engine
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InsertArtemisHook() {
|
||||||
|
//by Blu3train
|
||||||
|
/*
|
||||||
|
* Sample games:
|
||||||
|
* https://vndb.org/v45247
|
||||||
|
*/
|
||||||
|
const BYTE bytes[] = {
|
||||||
|
0xCC, // int 3
|
||||||
|
0x40, 0x57, // push rdi <- hook here
|
||||||
|
0x48, 0x83, 0xEC, 0x40, // sub rsp,40
|
||||||
|
0x48, 0xC7, 0x44, 0x24, 0x30, XX4, // mov qword ptr [rsp+30],FFFFFFFFFFFFFFFE
|
||||||
|
0x48, 0x89, 0x5C, 0x24, 0x50 // mov [rsp+50],rbx
|
||||||
|
};
|
||||||
|
|
||||||
|
ULONG64 range = min(processStopAddress - processStartAddress, X64_MAX_REL_ADDR);
|
||||||
|
for (auto addr : Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStartAddress + range)) {
|
||||||
|
HookParam hp = {};
|
||||||
|
hp.address = addr + 1;
|
||||||
|
hp.offset = -0x44 -4; //RDI
|
||||||
|
hp.type = USING_STRING | USING_UTF8 | NO_CONTEXT;
|
||||||
|
ConsoleOutput("vnreng: INSERT Artemis Hook ");
|
||||||
|
NewHook(hp, "Artemis");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConsoleOutput("vnreng:Artemis: pattern not found");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool InsertKiriKiriZHook()
|
bool InsertKiriKiriZHook()
|
||||||
{
|
{
|
||||||
//by Blu3train
|
//by Blu3train
|
||||||
@ -268,6 +301,11 @@ namespace Engine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Util::CheckFile(L"*.pfs")) {
|
||||||
|
InsertArtemisHook();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (Util::CheckFile(L"*.py") && InsertRenpyHook()) return true;
|
if (Util::CheckFile(L"*.py") && InsertRenpyHook()) return true;
|
||||||
|
|
||||||
for (const wchar_t* monoName : { L"mono.dll", L"mono-2.0-bdwgc.dll" }) if (HMODULE module = GetModuleHandleW(monoName)) if (InsertMonoHooks(module)) return true;
|
for (const wchar_t* monoName : { L"mono.dll", L"mono-2.0-bdwgc.dll" }) if (HMODULE module = GetModuleHandleW(monoName)) if (InsertMonoHooks(module)) return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user