//定义读取内存的方法
DWORD R4(DWORD base);
可变参函数 用来读取内存
//DWORD R4(DWORD base,...);
定义写内存的方法
bool W4(DWORD base, float dwValue);
//debugview调试 过滤头:qidai
void DbgPrintfA(char*pszFormat, ...);
//将float转换为字符串
CStringA formatMyData(float a);
#include "stdafx.h"
#include "Tools.h"
//定义读取内存的方法
DWORD R4(DWORD base){
DWORD res;
__try{
__asm{
mov eax, base;
mov eax, [eax]
mov res, eax
}
}
__except (1){
MessageBoxA(0, "读取内存出错", 0, 0);
}
return res;
}
可变参函数 用来读取内存
//DWORD R4(DWORD*pszFormat,...){
// va_list argList;
//
// va_start(argList,pszFormat);//参数列表初始化
//
//
//
// va_end(argList);
//}
//debugview调试 过滤头:qidai
void DbgPrintfA(char*pszFormat, ...){
char szBufFormat[0x1000];
char szBufFormat_Game[0x1008] = "qidai:";//DebugView的过滤条件
va_list argList;
va_start(argList, pszFormat);//参数列表初始化
vsprintf_s(szBufFormat, pszFormat, argList);
strcat_s(szBufFormat_Game, szBufFormat);
OutputDebugStringA(szBufFormat_Game);//关键
va_end(argList);
}
//将float转换为字符串
CStringA formatMyData(float a){
CStringA tmp;
tmp.Format("%f", a);
return tmp;
}
//定义写内存的方法
bool W4(DWORD base, float dwValue){
__try{
__asm{
mov eax, dwValue
mov ebx, base
mov[ebx], eax
}
}
__except (1){
MessageBoxA(0, "修改无限视距失败", 0, 0);
return false;
}
return true;
}