This commit is contained in:
Yosin-Lenheart 2022-02-07 03:31:00 +08:00
parent a06f53ffc1
commit 87aa13d231
6 changed files with 147 additions and 79 deletions

View File

@ -1,14 +1,8 @@
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
#include <iostream>
#include <Windows.h>
#include <string>
//#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);
}
}
}

View File

@ -3,3 +3,5 @@
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>
#include <iostream>
#include <string>

View File

@ -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

View File

@ -166,6 +166,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="函数块.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -29,5 +29,8 @@
<ClCompile Include="pch.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="函数块.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

64
test/函数块.cpp Normal file
View File

@ -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;
}