简体   繁体   English

如何使用游戏的基指针在C ++中编辑值?

[英]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.

相关问题 如何将基类指针转换为派生自该类的指针? C ++ - How do I cast a base class pointer to a pointer of a class derived from it? C++ 如何在 c++ 中使用带有 arrays 的指针并返回指针值? - How do I use pointers with arrays in c++ and return a pointer value? 如何在C ++中使用指针的方法? - How to use a pointer's methods in C++? C++:如何防止通过指向其基子对象的指针修改派生对象? - C++: How do I prevent modification of a derived object through a pointer to its base subobject? 如何在C ++中增加指针的指针值 - How to increase pointer's pointer value in C++ C ++在创建指针时如何使用变量作为指针的大小? - C++ How do I use a variable for the size of the pointer when creating a pointer? 如何在C ++中移动指针? - How do I move a pointer in C++? C++:如何使用 memory 地址与 a.exe 基址而不是 a.dll 基址 - C++: How do I use memory address with a .exe base instead of a .dll base C++,在使用基本 class 指针对其进行初始化后,如何启用对派生 class 的唯一成员的访问? - C++, how do I enable access of a unique member of a derived class, after I initialized it using a base class pointer? C ++,不能使用数组或向量,如何使用指针来解决这个问题? - C++, Can't use an array or vectors, how do I use a pointer to get through this mess?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM