gpt4 book ai didi

C++获取分配部分的基地址

转载 作者:搜寻专家 更新时间:2023-10-31 01:39:15 24 4
gpt4 key购买 nike

由于我之前不清楚,所以我会重写我的问题。

我需要获取使用 VirtualAllocEx() 分配的一段内存的绝对基址。

例如,如果我分配了 0x20000 个字节并获得地址 0x5000000。

我需要一种使用值 0x5015000 获取地址 0x5000000 的方法。

VirtualQuery() 返回值 0x5015000 所在的页面地址,而不是分配的内存部分的基地址。

所以我需要一种不同的方法来找到任何已分配内存部分的基地址。

最佳答案

免责声明:此处没有任何 WinAPI 经验。

VirtualQuery() returns the page address that the value 0x5015000 resides in and not the base address of the allocated section of memory.

据我了解the docs , VirtualQuery() 返回 structure包含多条信息,包括...

BaseAddress

A pointer to the base address of the region of pages.

AllocationBase

A pointer to the base address of a range of pages allocated by the VirtualAlloc function. The page pointed to by the BaseAddress member is contained within this allocation range.

会不会是您只检查了 BaseAddress 而没有检查 AllocationBase?因为后者听起来与您正在寻找的完全一样......

关于C++获取分配部分的基地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31539648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com