主修改整合基本完成
This commit is contained in:
45
test/hook.cpp
Normal file
45
test/hook.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "pch.h"
|
||||
#include "hook.h"
|
||||
|
||||
#include "sock.h"
|
||||
#include "MinHook.h"
|
||||
#include "squirrel.h"
|
||||
|
||||
#pragma comment(lib, "libMinHook.x86.lib")
|
||||
|
||||
|
||||
|
||||
|
||||
uint32_t hook::H_Register_Nut(uint32_t v, void* f, int freeVarsCnt)
|
||||
{
|
||||
|
||||
static int build = 0;
|
||||
if (build == 0 && f == (void*)0x005C5980)
|
||||
{
|
||||
squirrel::R_Register_Nut();
|
||||
}
|
||||
return MLnewclosure(v, f, freeVarsCnt);
|
||||
}
|
||||
|
||||
|
||||
void hook::H_Register_Pack(void* Ecx)
|
||||
{
|
||||
Lpfn_Init(Ecx);
|
||||
sock::R_Register_Pack();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int hook::RegisterHook()
|
||||
{
|
||||
MH_Initialize();
|
||||
MH_CreateHook((void*)INIT_PACK_ADDRESS, &H_Register_Pack, reinterpret_cast<void**>(&Lpfn_Init));
|
||||
|
||||
MH_CreateHook((void*)INIT_NUT_ADDRESS, &H_Register_Nut, reinterpret_cast<void**>(&MLnewclosure));
|
||||
|
||||
MH_EnableHook((void*)INIT_PACK_ADDRESS);
|
||||
MH_EnableHook((void*)INIT_NUT_ADDRESS);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user