游戏内存修改器原理
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
DWORD g_arList[1024] ;int g_nListCnt;
HANDLE g_hProcess;
BOOL Wr iteMemory(DWORD dwAddr, DWORD dwValue) ;void ShowList(void) ;
BOOL CompareAPage(DWORD dwBaseAddr, DWORD dwValue) ;BOOL FindNext(DWORD dwValue) ;
BOOL FindFirst(DWORD dwValue) ;
BOOL FindFirst(DWORD dwValue)
{const DWORD dwOneGB = 1024 * 1024 * 1024;const DWORD dwOnePage = 4 * 1024;if (NULL == g_hProcess)
{return FALSE;
}
DWORD dwBase;
OSVERSIONINFO vi = {si zeof(vi) } ;
: :GetVersionEx(&vi) ;i f (VER_PLATFORM_WIN32_WINDOWS == vi.dwPlatformI d){dwBase = 4 * 1024 * 1024;
}else
{dwBase = 640 * 1024;
}
f or (; dwB as e < 2 * dwOne GB; dwBas e += dwOneP age)
{
CompareAPage(dwBase, dwVa lue) ;
}return TRUE;
}
BOOL CompareAPage(DWORD dwBaseAddr, DWORD dwValue)
{
BYTE arBytes[4096] ;if ( ! : :ReadProcessMemory(g_hProcess, (LPVOID)dwBaseAddr,arBytes, 4096, NULL))
{return FALSE;
}
DWORD* p dw = NUL L;int i = 0;for (i = 0; i < (int)4 * 1024 -3; i++)
{p dw = (DWO RD*)&arBy t e s[i] ;i f (pdw[0] == dwVal ue)
{if (g_nListCnt >= 1024)
{return FALSE;
}g_arList[g_nListCnt++] = dwBaseAddr + i ;
}
}return TRUE;
}void ShowList(void)
{int i;for (i = 0; i < g_nListCnt; i++)
{printf("%08lX/n", g_arList[i]) ;
}
}
BOOL FindNext(DWORD dwValue)
{int nOrgCnt = g_nListCnt;g_nListCnt = 0;
BOOL bRet = FALSE;
DWORD dwReadValue;int i;f or (i = 0; i < nOrgCnt; i++)
{if ( : :ReadProcessMemory(g_hProcess,
(LPVOID)g_arL i st[i] , &dwReadVal ue, s i ze of(DWORD) , NULL))
{i f (dwReadVal ue == dwValue)
{g_arList[g_nListCnt++] = g_arLi st[i] ;bRet = TRUE;
}
}
}return bRet;
}
BOOL Wr iteMemory(DWORD dwAddr, DWORD dwValue)
{return : :WriteProcessMemory(g_hProcess, (LPVOID)dwAddr,
&dwValue, s i z eof(DWORD) , NULL) ;
}int main(int argc, char* argv[] )
{
TCHAR szFileName[] =_T(". ./Debug/Testor0. exe") ;
STARTUPINFO s i = {s izeof(si) } ;
PROCESS_INFORMAT ION pi ;
: :CreateProcess(NULL, szFileName, NULL, NULL, FALSE,C REATE_NEW_CONSOLE, NULL, NULL, &s i, π) ;
: :CloseHandle(pi.hThread) ;g_hProcess = pi.hProcess;int iVal;printf("Input val = ") ;scanf("%d", &iVal) ;
FindFirst(iVal) ;
ShowLi s t() ;if (g_nListCnt > 1)
{printf("Input val = ") ;scanf("%d", &iVal) ;
FindNext(iVal) ;
ShowLi s t() ;
}printf("New value = ") ;scanf("%d", &iVal) ;if (WriteMemory(g_arLi st[0], iVal) )
{printf("Write data success./n") ;
}
: :Cl oseHandle(g_hProce ss) ;return 0;
}
关于HostDare服务商在之前的文章中有介绍过几次,算是比较老牌的服务商,但是商家背景财力不是特别雄厚,算是比较小众的个人服务商。目前主流提供CKVM和QKVM套餐。前者是电信CN2 GIA,不过库存储备也不是很足,这不九月份发布新的补货库存活动,有提供九折优惠CN2 GIA,以及六五折优惠QKVM普通线路方案。这次活动截止到9月30日,不清楚商家这次库存补货多少。比如 QKVM基础的五个方案都...
热网互联怎么样?热网互联(hotiis)是随客云计算(Suike.Cloud)成立于2009年,增值电信业务经营许可证:B1-20203716)旗下平台。热网互联云主机是CN2高速回国线路,香港/日本/洛杉矶/韩国CN2高速线路云主机,最低33元/月;热网互联国内BGP高防服务器,香港服务器,日本服务器全线活动中,大量七五折来袭!点击进入:热网互联官方网站地址热网互联香港/日本/洛杉矶/韩国cn2...
欧路云怎么样?欧路云主要运行弹性云服务器,可自由定制配置,可选加拿大的480G超高防系列,也可以选择美国(200G高防)系列,也有速度直逼内地的香港CN2系列。所有配置都可以在下单的时候自行根据项目 需求来定制自由升级降级 (降级按天数配置费用 退款回预存款)。2021年7月14日美国 CERA 弹性云服务器 上新 联通CUVIP 线路!8折特惠中!点击进入:欧路云官方网站地址付款方式:PayPa...