MEMORY_BASIC_INFORMATION结构

MEMORY_BASIC_INFORMATION这个结构中的两个成员的区别:

typedef struct _MEMORY_BASIC_INFORMATION {  
PVOID BaseAddress;  
PVOID AllocationBase;  
DWORD AllocationProtect;  
SIZE_T RegionSize;  
DWORD State;  
DWORD Protect;  
DWORD Type;
} MEMORY_BASIC_INFORMATION,  *PMEMORY_BASIC_INFORMATION; 

以下引用csdn论坛的观点,我认为这解释地比较清楚了:
PVOID BaseAddress;  //该页的基地址,是VirtualQuery(Ex)第一个参数下舍入下一个页面的边界的值
页的边界启始地址. 在地址形式上类似: 0xXXXXX000(X86,页大小为4KB)

PVOID AllocationBase;

在进程中为了使用内存,必须保留(Reserved)内存和占有内存(Committed) -使用VirtualAlloc()函数. VirtualAlloc分配的内存称为区域(Region)- 一片连续的页. 为了分配效率(?) Windows会以64-KB为边界计算区域的启始地址,所以区域的启始地址在形式上类似: 0xXXXX0000,这里的64KB页就是所谓的分配粒度,因此 AllocationBase正是一个区域(Region)的启始地址


另外,BaseAddress一定在AllocationBase地址范围之内
(The page pointed to by the BaseAddress member is contained within this allocation range)
以下是我在应用VirtualQuery函数时MEMORY_BASIC_INFORMATION结构里面的
PVOID BaseAddress;
PVOID AllocationBase;两个成员的返回值

=================================
BaseAddress   AllocationBase
0x00401000    0x00400000
0x00401700    0x00400000
0x00401800    0x00400000
0x00401a00    0x00400000

=================================

BaseAddress - the address of the queried memory page ( VirtualQuery(LPCVOID lpAddress,... ).

AllocationBase - the beginning of the allocated memory block. It is used for deallocation. BaseAddress >= AllocationBase.

If you are querying stack then AllocationBase will be the lowest address of the stack (the stack top)


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值