C++读写内存 可变参方法未写完 等完善

#include "stdafx.h"


//定义读取内存的方法
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;
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值