11
This commit is contained in:
134
test/dllmain.cpp
134
test/dllmain.cpp
@@ -3,10 +3,6 @@
|
||||
//#include "函数块.h"
|
||||
|
||||
|
||||
/*
|
||||
typedef int func(int a,class b);
|
||||
func* f = (func*)0x1127D60;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -14,10 +10,122 @@ func* f = (func*)0x1127D60;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef int(SqGetStringFunc)(uint32_t v, uint32_t stackIndex, wchar_t** ppString);
|
||||
static SqGetStringFunc* SQGetString = (SqGetStringFunc*)0x1358E70;
|
||||
|
||||
|
||||
|
||||
static realSqNewClosure* MLnewclosure = NULL;
|
||||
|
||||
uint32_t NewClosure(uint32_t v, void* f, int freeVarsCnt)
|
||||
{
|
||||
std::cout << std::endl;
|
||||
|
||||
wchar_t* funcName;
|
||||
SQGetString(v, -1 - freeVarsCnt, &funcName);
|
||||
//if (funcName == L"sq_CreateAICharacter")
|
||||
//{
|
||||
//wprintf(L"Funaddr:%s\t", f);
|
||||
//std::cout << f << std::endl;
|
||||
//}
|
||||
wprintf(L"Funname:%s\tAbli:%d\tFunAddr:0x%p", funcName, freeVarsCnt, f);
|
||||
|
||||
|
||||
return MLnewclosure(v, f, freeVarsCnt);
|
||||
}
|
||||
|
||||
static realSqPushString* MLSqPushString = NULL;
|
||||
|
||||
uint32_t NewPushString(uint32_t v, wchar_t* f, int freeVarsCnt)
|
||||
{
|
||||
std::cout << std::endl;
|
||||
|
||||
wprintf(L"Funname:%s\tAbli:%d\tFunAddr:0x%p", f, freeVarsCnt, f);
|
||||
|
||||
return MLSqPushString(v, f, freeVarsCnt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int HOOK()
|
||||
{
|
||||
std::cout << u8"开始hook" << std::endl;
|
||||
|
||||
if (MH_Initialize() != MH_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
if (MH_CreateHook((void*)0x135B850, &NewClosure,
|
||||
reinterpret_cast<void**>(&MLnewclosure)) != MH_OK)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Enable the hook for MessageBoxW.
|
||||
if (MH_EnableHook((void*)0x135B850) != MH_OK)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (MH_CreateHook((void*)0x1358A60, &NewClosure,
|
||||
reinterpret_cast<void**>(&MLnewclosure)) != MH_OK)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Enable the hook for MessageBoxW.
|
||||
if (MH_EnableHook((void*)0x1358A60) != MH_OK)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef int(isgm)(int C);
|
||||
static isgm* gm = (isgm*)0x176F380;
|
||||
|
||||
|
||||
void testcall()
|
||||
{
|
||||
|
||||
//std::cout << gm(0x186FB828) << std::endl;
|
||||
|
||||
|
||||
//_SendpacksType(*_SendClass, 0, 0x2D);
|
||||
//_SendPacks();
|
||||
|
||||
/*
|
||||
_SendpacksType(*_SendClass, 0, 75);
|
||||
_SendPacksByte(*_SendClass, 0, 2);
|
||||
_SendPacksByte(*_SendClass, 0, 2);
|
||||
_SendPacks();
|
||||
|
||||
_SendpacksType(*_SendClass, 0, 75);
|
||||
_SendPacksByte(*_SendClass, 0, 1);
|
||||
_SendPacksByte(*_SendClass, 0, 2);
|
||||
_SendPacks();
|
||||
|
||||
|
||||
_SendpacksType(*_SendClass, 0, 37);
|
||||
_SendPacksWord(*_SendClass, 0, 636);
|
||||
_SendPacksWord(*_SendClass, 0, 268);
|
||||
_SendPacksByte(*_SendClass, 0, 5);
|
||||
_SendPacksWord(*_SendClass, 0, 200);
|
||||
_SendPacks();
|
||||
*/
|
||||
|
||||
/*
|
||||
_SendpacksType(*_SendClass, 0, 38);
|
||||
_SendPacksByte(*_SendClass, 0, 1);
|
||||
@@ -39,33 +147,35 @@ void testcall()
|
||||
_SendPacksDWord(*_SendClass, 6, 1);
|
||||
_SendPacks();
|
||||
*/
|
||||
|
||||
/*
|
||||
_SendpacksType(*_SendClass, 0, 0x3);
|
||||
_SendPacks();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void ThreadFun(void)
|
||||
void LenheartThread(void)
|
||||
{
|
||||
// 下方写全局变量
|
||||
static int Nut头地址;
|
||||
static int 属性头地址;
|
||||
static int 可开始执行判断;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
Sleep(500);
|
||||
Sleep(10);
|
||||
|
||||
if (GetHook(0x1A5FB4C, "0x14+0x28+") == 6)可开始执行判断 = 1;
|
||||
if (可开始执行判断 == 1)
|
||||
{
|
||||
RegisterNut();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Sleep(10);
|
||||
|
||||
if (GetExeNutWrtNum(61) != 0 && Nut头地址 == 0)Nut头地址 = GetExeNutWrtNum(61);
|
||||
//if (GetExeNutWrtNum(61 != 0))属性头地址 = GetExeNutWrtNum(61);
|
||||
|
||||
if (GetExeNutWrtNum(0) == 666)
|
||||
{
|
||||
std::cout << u8"写成功" << std::endl;;
|
||||
@@ -82,7 +192,7 @@ void ThreadFun(void)
|
||||
__declspec(dllexport) void Lenheart()
|
||||
{
|
||||
DWORD threadID;
|
||||
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFun, NULL, 0, &threadID);
|
||||
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)LenheartThread, NULL, 0, &threadID);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,9 +205,9 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
//int i = f(60,80);
|
||||
//std::cout << "12132132" << std::endl;
|
||||
//HOOK();
|
||||
Lenheart();
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
|
||||
Reference in New Issue
Block a user