指针和内存地址 - 突击立方体

发布于 2025-02-08 21:22:48 字数 981 浏览 5 评论 0 原文

将以游戏突击立方体为例。以下是通过搜索健康价值发现的作弊引擎发现的地址。

我们有0x0050F4F4(静态本地播放器指针)指向0x00CA9000(动态播放器对象地址),

0x00C9A000 + f8 = 0x00c9a0f8将为我们提供健康的动态地址


class CPlayer
{
public:
char __0x0000[0xF7]; //0x0 - 0xF7
    __int32 m_nHealth; //0xF8
};


#define ADDR_Player 0x0050F4F4

CPlayer* pPlayer = *(CPlayer**) ADDR_Player;

pPlayer->m_nHealth;

然后 他们是否将addr_player施放到指向Cplayer类型指针的指针?这是一个双重指针?

如果您退出 *addr_player:

0x0050f4f4-> 0x00C9A000 = 13202112(随机值)

如果您解释 *ADDR_PLAYER + OFFSET:

0x0050f4f4-> 0x00c9a00+f8 = 40(健康)

我认为这是这样的: cplayer*pplayer =*(cplayer*)addr_player; ,但这是不正确的,我不明白为什么将正确的一个铸成双指针:

cplayer*pplayer*pplayer =*(cplayer*(cplayer*) *)addr_player;

Will be using the game Assault Cube as an example. Here are the addresses found with Cheat Engine from searching the health value.

We have 0x0050F4F4 (static local player pointer) which points to 0x00CA9000 (dynamic player object address)

Then 0x00C9A000 + F8 = 0x00C9A0F8 will give us the dynamic address of health

Here is the class:


class CPlayer
{
public:
char __0x0000[0xF7]; //0x0 - 0xF7
    __int32 m_nHealth; //0xF8
};


#define ADDR_Player 0x0050F4F4

CPlayer* pPlayer = *(CPlayer**) ADDR_Player;

pPlayer->m_nHealth;

What I don’t understand is why did they cast ADDR_Player to a pointer to a pointer of type CPlayer? How is it a double pointer?

If you dereference *ADDR_Player:

0x0050F4F4 -> 0x00C9A000 = 13202112 (random value)

If you dereference *ADDR_Player + offset:

0x0050F4F4 -> 0x00C9A00+F8 = 40 (health)

I thought it would be like this:
CPlayer* pPlayer = *(CPlayer*) ADDR_Player; but this is incorrect and I don’t understand why the correct one is casted to a double pointer:

CPlayer* pPlayer = *(CPlayer**) ADDR_Player;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

日暮斜阳 2025-02-15 21:22:48

0x0050f4f4 是一个内存地址,因此保存该值的变量的类型将是“指向某物的指针”,但是指向什么?

地址 0x0050f4f4 的内容?另一个内存地址: 0x00C9A000 。由于那是一个内存地址,因此该数据的类型是“指向某物的指针”。这意味着原始变量持有 0x0050f4f4 的类型是“指向指针指向某物的指针”。

最后,您可以查看地址 0x00C9A000 的居住在什么。那是 cplayer 对象,因此变量持有 0x00C9A000 是“指向 cplayer ”的指针,这意味着变量持有 0x0050f4f4 是“指向 cplayer 的指针”。

也就是说,您在内存中有类似的东西:

 Memory       ADDR_Player              0x0050F4F4               0x00C9A000
┌─────────────┬──────────┬─────────────┬──────────┬─────────────┬────────────────────────┐
│             │          │             │          │             │                        │
│     ...     │0x0050F4F4│     ...     │0x00C9A000│     ...     │     CPlayer Object     │
│             │     │    │             │     │    │             │                        │
└─────────────┴─────┼────┴─────────────┴─────┼────┴─────────────┴────────────────────────┘
                    │                  ▲     │                  ▲
                    │                  │     │                  │
                    └──────────────────┘     └──────────────────┘

如您所见, addr_player 指向指向您 cplayer 对象的指针。也就是说,它是 cplayer **

0x0050F4F4 is a memory address, so the type of a variable holding that value would be a "pointer to something", but a pointer to what?

What resides at address 0x0050F4F4? Another memory address: 0x00C9A000. Since that is a memory address, the type of that data is "pointer to something". That means the type of the original variable holding 0x0050F4F4 is "pointer to pointer to something".

Finally, you can look at what resides at address 0x00C9A000. That's a CPlayer object, so the variable holding 0x00C9A000 is a "pointer to CPlayer" which means the variable holding 0x0050F4F4 is a "pointer to pointer to CPlayer".

That is, you have something like this in memory:

 Memory       ADDR_Player              0x0050F4F4               0x00C9A000
┌─────────────┬──────────┬─────────────┬──────────┬─────────────┬────────────────────────┐
│             │          │             │          │             │                        │
│     ...     │0x0050F4F4│     ...     │0x00C9A000│     ...     │     CPlayer Object     │
│             │     │    │             │     │    │             │                        │
└─────────────┴─────┼────┴─────────────┴─────┼────┴─────────────┴────────────────────────┘
                    │                  ▲     │                  ▲
                    │                  │     │                  │
                    └──────────────────┘     └──────────────────┘

As you can see, ADDR_Player points to a pointer that points to your CPlayer object. That is, it is a CPlayer**.

无畏 2025-02-15 21:22:48

您需要一个指针 cplayer*。当删除的指针是指针 cplayer ** 时,指针将是一个指针。因此,将施放到 cplayer ** 和DERECERCTING是获取 cplayer*值的好方法。

You want a pointer CPlayer*. What will be a pointer when dereferenced is a pointer to pointer CPlayer**. So casting to CPlayer** and dereferencing is a good way to obtain CPlayer* value.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文