天天看点

中国式家长的作弊实现之利用c语言进行内存修改

中国式家长的作弊实现之利用c语言进行内存修改

首先的话,作者是个小白,还在努力学习之中,对于编程语言可以说是一知半解,

然后弄这样一个博客吧,分享一下自己的学习经历,也希望能给一些新手一点帮助。

一开始就是我自己玩中国式家长,之前两天肝了10个小时,觉得挺有意思的,然后现在不想玩了,

但是28块钱买下来的游戏,怎么能白白闲置在这里呢,于是就成了我的练手之作,

今天就拿他来祭天。

OK如果你玩过这个游戏你就会发现这个游戏的悟性可以说是非常重要了,所以作为初学者,我们当然要对他的悟性进行修改了。

我一开始先找到悟性,然后找出了他的基址

然后因为我找出来了,那我就直接上图

中国式家长的作弊实现之利用c语言进行内存修改

不过真的是太久没摸过ce了,这个悟性基址我找的是头昏眼花。不过好在还是弄出来了

587B504 偏移 D4 88 1D0 8 318

知道基址了就很好弄下来了

然后打开我们的VC,因为我只弄了一个功能,而且功能只有5次偏移,所以我就写一个5次偏移

#include <tchar.h>
#include "stdafx.h"
#include <Windows.h>
#include<iostream>
using namespace std;
int gameaddress = 0x587b504; //游戏基址;
HANDLE gameprocess; //句柄类型 获取
//5次偏移
int *get5point(int gameaddress,int p1,int p2,int p3,int p4,int p5)
{
	int iBase, iP1, iP2,iP3,iP4,*iP5;
    if (!ReadProcessMemory(gameprocess, (LPVOID)gameaddress, &iBase, 4, NULL))
    {
        return NULL;
    }

    if (!ReadProcessMemory(gameprocess, (LPVOID)(iBase + p1), &iP1, 4, NULL))
    {
        return NULL;
    }
    if (!ReadProcessMemory(gameprocess, (LPVOID)(iP1 + p2), &iP2, 4, NULL))
    {
        return NULL;
    }
	if (!ReadProcessMemory(gameprocess, (LPVOID)(iP2 + p3), &iP3, 4, NULL))
    {
        return NULL;
    }
	if (!ReadProcessMemory(gameprocess, (LPVOID)(iP3 + p4), &iP4, 4, NULL))
    {
        return NULL;
    }
    iP5=(int *)(iP4+p5);
	return iP5;
}
//修改悟性
void wxxg()
{
	int *pwx=get5point(gameaddress,0xD4,0x88,0x1D0,0x8,0x318);
	float  wx = 150;
	cout<<pwx<<endl;
	WriteProcessMemory(gameprocess, pwx,&wx, 4, NULL);
}

int _tmain(int argc, _TCHAR* argv[])
{
    //获取游戏窗口所在进程的进程ID,也就是PID
    HWND hWnd = FindWindow(NULL, TEXT("中国式家长"));
    if (NULL == hWnd)
    {
        printf("查找窗口失败\n");
        return 0;
    }
    
    DWORD dwProcessId;
    GetWindowThreadProcessId(hWnd, &dwProcessId);
    printf("进程ID:%d\n", dwProcessId);
    
    //获取进程句柄
    gameprocess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
    if (NULL == gameprocess)
    {
        printf("打开进程失败\n");
        return 0;
    }
    wxxg();
    getchar();
    return 0;
}
           

然后我在52的ID是 这是昵称的昵称

继续阅读