diff --git a/test/dllmain.cpp b/test/dllmain.cpp index 656f97e..9838e0b 100644 --- a/test/dllmain.cpp +++ b/test/dllmain.cpp @@ -1,14 +1,8 @@ // dllmain.cpp : 定义 DLL 应用程序的入口点。 #include "pch.h" -#include -#include -#include +//#include "函数块.h" -int Nut头地址; -int 属性头地址; -int 可开始执行判断; - /* typedef int func(int a,class b); func* f = (func*)0x1127D60; @@ -16,87 +10,48 @@ func* f = (func*)0x1127D60; -//获取EXE使用头 号位数据 -int GetExeNutWrtNum(int Pos) -{ - int num = *(int*)(0x40079F + (Pos * 4)); - return num; -} - -//写EXE使用头 号位数据 -void SetExeNutWrtNum(int Pos , int num) -{ - int *p = (int*)(0x40079F + (Pos * 4)); - *p = num; -} - -//获取Nut头 号位数据 -int GetNutArrNum(int Pos) -{ - int num = *(int*)(Nut头地址 + (Pos * 8)); - return num; -} - -//写Nut头 号位数据 -void SetNutArrNum(int Pos, int num) -{ - int* p = (int*)(Nut头地址 + (Pos * 8)); - *p = num; -} - -//读内存偏移地址 -int GetHook(int Addr , std::string 地址) -{ - size_t pos = 地址.find("+"); - size_t size = 地址.size(); - int GetHookArr[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; - int i = 0; - - while (pos != std::string::npos) - { - std::string x = 地址.substr(0, pos); - GetHookArr[i] = stoi(x, 0, 16); - i++; - 地址 = 地址.substr(pos + 1, size); - pos = 地址.find("+"); - } - - int num; - num = *(int*)(Addr); - - if (num != 0) - { - for (int z = 0; z < i; z++) - { - num = *(int*)(num + GetHookArr[z]); - } - } - return num; -} -typedef DWORD funa(); -funa* a = (funa*)0x1127EC0; - -typedef DWORD testc; -testc* tc = (testc*)0x1AEB6E4; - - -typedef int(__fastcall* sendp)(DWORD thisc, int de, int a); -sendp psendp = (sendp)0x1127D60; - - void testcall() { - psendp(*tc, 0, 0x2D); - a(); + //_SendpacksType(*_SendClass, 0, 0x2D); + //_SendPacks(); + /* + _SendpacksType(*_SendClass, 0, 38); + _SendPacksByte(*_SendClass, 0, 1); + _SendPacksByte(*_SendClass, 0, 0); + _SendPacksWord(*_SendClass, 0, 1109); + _SendPacksWord(*_SendClass, 0, 268); + _SendPacksByte(*_SendClass, 0, 5); + _SendPacksWord(*_SendClass, 0, 0); + _SendPacksWord(*_SendClass, 0, 0); + _SendPacks(); + */ + + + /* + _SendpacksType(*_SendClass, 0, 17); + _SendPacksByte(*_SendClass, 3, 1); + _SendPacksWord(*_SendClass, 56, 1); + _SendPacksDWord(*_SendClass, 0, 1); + _SendPacksDWord(*_SendClass, 6, 1); + _SendPacks(); + */ + + _SendpacksType(*_SendClass, 0, 0x3); + _SendPacks(); } void ThreadFun(void) { + // 下方写全局变量 + static int Nut头地址; + static int 属性头地址; + static int 可开始执行判断; + while (true) { Sleep(500); @@ -111,13 +66,12 @@ void ThreadFun(void) if (GetExeNutWrtNum(61) != 0 && Nut头地址 == 0)Nut头地址 = GetExeNutWrtNum(61); //if (GetExeNutWrtNum(61 != 0))属性头地址 = GetExeNutWrtNum(61); - //std::cout << GetExeNutWrtNum(0) << std::endl;; if (GetExeNutWrtNum(0) == 666) { std::cout << u8"写成功" << std::endl;; testcall(); SetExeNutWrtNum(0, 0); - SetNutArrNum(20, 0); + SetNutArrNum(Nut头地址 , 20, 0); } } } diff --git a/test/framework.h b/test/framework.h index 80cbbc9..35967b2 100644 --- a/test/framework.h +++ b/test/framework.h @@ -3,3 +3,5 @@ #define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 // Windows 头文件 #include +#include +#include diff --git a/test/pch.h b/test/pch.h index 9660927..30c0905 100644 --- a/test/pch.h +++ b/test/pch.h @@ -10,4 +10,48 @@ // 添加要在此处预编译的标头 #include "framework.h" + + + + +//获取EXE使用头 号位数据 +int GetExeNutWrtNum(int Pos); + +//写EXE使用头 号位数据 +void SetExeNutWrtNum(int Pos, int num); + +//获取Nut头 号位数据 +int GetNutArrNum(int Nut头地址, int Pos); + +//写Nut头 号位数据 +void SetNutArrNum(int Nut头地址, int Pos, int num); + +//读内存偏移地址 +int GetHook(int Addr, std::string 地址); + + +//发包函数 地址 +typedef DWORD SendPacks(); +static SendPacks* _SendPacks = (SendPacks*)0x1127EC0; + +//发包Class this地址 +typedef DWORD SendClass; +static SendClass* _SendClass = (SendClass*)0x1AEB6E4; + +//发包类型 地址 +typedef int(__fastcall* SendPacksType)(DWORD thisc, int Seat, int Parm); +static SendPacksType _SendpacksType = (SendPacksType)0x1127D60; + +//发包参数 BYTE +typedef int(__fastcall* SendPacksByte)(DWORD thisc, int Seat, int Parm); +static SendPacksByte _SendPacksByte = (SendPacksByte)0x1128550; + +//发包参数 WORD +typedef int(__fastcall* SendPacksWORD)(DWORD thisc, int Seat, int Parm); +static SendPacksWORD _SendPacksWord = (SendPacksWORD)0x1128580; + +//发包参数 DWORD +typedef int(__fastcall* SendPacksDWORD)(DWORD thisc, int Seat, int Parm); +static SendPacksDWORD _SendPacksDWord = (SendPacksDWORD)0x11285B0; + #endif //PCH_H diff --git a/test/test.vcxproj b/test/test.vcxproj index 64e5514..02b99b5 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -166,6 +166,7 @@ Create Create + diff --git a/test/test.vcxproj.filters b/test/test.vcxproj.filters index 2689155..4e26f38 100644 --- a/test/test.vcxproj.filters +++ b/test/test.vcxproj.filters @@ -29,5 +29,8 @@ 源文件 + + 源文件 + \ No newline at end of file diff --git a/test/函数块.cpp b/test/函数块.cpp new file mode 100644 index 0000000..a7f8d76 --- /dev/null +++ b/test/函数块.cpp @@ -0,0 +1,64 @@ +#include "pch.h" + + + + + + +//ȡEXEʹͷ λ +int GetExeNutWrtNum(int Pos) +{ + int num = *(int*)(0x40079F + (Pos * 4)); + return num; +} + +//дEXEʹͷ λ +void SetExeNutWrtNum(int Pos, int num) +{ + int* p = (int*)(0x40079F + (Pos * 4)); + *p = num; +} + +//ȡNutͷ λ +int GetNutArrNum(int Nutͷַ, int Pos ) +{ + int num = *(int*)(Nutͷַ + (Pos * 8)); + return num; +} + +//дNutͷ λ +void SetNutArrNum(int Nutͷַ, int Pos, int num) +{ + int* p = (int*)(Nutͷַ + (Pos * 8)); + *p = num; +} + +//ڴƫƵַ +int GetHook(int Addr, std::string ַ) +{ + size_t pos = ַ.find("+"); + size_t size = ַ.size(); + int GetHookArr[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; + int i = 0; + + while (pos != std::string::npos) + { + std::string x = ַ.substr(0, pos); + GetHookArr[i] = stoi(x, 0, 16); + i++; + ַ = ַ.substr(pos + 1, size); + pos = ַ.find("+"); + } + + int num; + num = *(int*)(Addr); + + if (num != 0) + { + for (int z = 0; z < i; z++) + { + num = *(int*)(num + GetHookArr[z]); + } + } + return num; +}