[英]How do I use a game's base pointer to edit a value in C++?
Okay I've followed a couple of tutorials on how to find the base/static pointer of a game's value with cheat engine (hp, strength, experience, gold, etc). 好的,我已经关注了如何使用作弊引擎(hp,力量,经验,黄金等)找到游戏价值的基本/静态指针的几个教程。 To test this I tried it on Microsoft's Spider Solitaire and it worked.
为了测试这一点,我在微软的蜘蛛纸牌上试了一下它就可以了。 I got the base pointer for the amount of moves ("zetten" as you will see in my dutch version of Spider Solitaire), and made it reference to another pointer which referenced to the actual value (assuming that's how it's called).
我得到了移动量的基本指针(你将在我的荷兰版Spider Solitaire中看到“zetten”),并使它引用另一个指向实际值的指针(假设它是如何被调用的)。
That's basically what it looks like. 这基本上就是它的样子。 So now I've got the base pointer which would be SpiderSolitaire.exe+B5F78 and it uses 2 offsets to get to the actual address of the value.
所以现在我有了SpiderSolitaire.exe + B5F78的基本指针,它使用2个偏移来获取值的实际地址。 This is the code that I use to edit memory values with in C++:
这是我用C ++编写内存值的代码:
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <strsafe.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
long address = 0x??????;
int newvalue = 200000;
DWORD newvaluesize = sizeof(newvalue);
HWND hWnd = FindWindow(0, L"Spider Solitaire");
HANDLE pHandle;
DWORD pid;
if(hWnd != 0) {
cout << "Found windowx.\n";
GetWindowThreadProcessId(hWnd, &pid);
pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
}
else {
cout << "Can't find window\n";
}
if(pHandle !=0) {
WriteProcessMemory(pHandle, (LPVOID)address, &newvalue, newvaluesize, 0);
cout << "Written to memory successfully\n";
getchar();
}
else {
cout << "Couldn't get handle.\n";
getchar();
}
CloseHandle(pHandle);
return 0;
}
So I have all the information I need, except I don't know how to implement base pointers and offsets and whatnot into the C++ program. 所以我拥有我需要的所有信息,除了我不知道如何在C ++程序中实现基本指针和偏移以及诸如此类的东西。 I tried using
我试过用
long address = SpiderSolitaire.exe+B5F78+e8+10
but that didn't work (SpiderSoliteire.exe is a string anyway so I didn't expect it to work). 但这不起作用(无论如何,SpiderSoliteire.exe是一个字符串,所以我没想到它会起作用)。 I've tried searching for tutorials or something on the internet, but those only show how to directly alter a value in 1 memory address, not how to alter a value by referencing it through 2 pointers.
我曾尝试在互联网上搜索教程或其他东西,但那些只显示如何直接改变1个内存地址中的值,而不是如何通过2个指针引用它来改变值。 How do I do this?
我该怎么做呢? How do I implement this base pointer, and the 2 offsets into my C++ program so that I can edit the memory value?
如何实现这个基指针,以及2个偏移到我的C ++程序中,以便我可以编辑内存值?
I tried same thing and they said to that i need to write my own OS for that. 我尝试了同样的事情,他们说我需要为此编写自己的操作系统。 Some said i need to be in ring-0 area.
有人说我需要在0区。 I say you can use asm (assembler)
我说你可以使用asm(汇编程序)
mov [address],register
comand COMAND
Gcc, VC++ 10 , Digital Mars has some asm{} block definitions inside. Gcc,VC ++ 10,Digital Mars内部有一些asm {}块定义。
You have to figure out where the process is loaded, which can vary. 您必须弄清楚加载过程的位置,这可能会有所不同。 See this earlier question for details.
有关详细信息,请参阅前面的问 It does more than you need;
它比你需要的更多; you just need the base address part.
你只需要基地址部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.