概述
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;
- <strong>以下引用csdn论坛的观点,我认为这解释地比较清楚了:</strong>
- PVOID BaseAddress; //该页的基地址,是VirtualQuery(Ex)第一个参数下舍入下一个页面的边界的值
- 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)最后
以上就是和谐毛巾为你收集整理的MEMORY_BASIC_INFORMATION中 BaseAddress 和 AllocationBase 区别的全部内容,希望文章能够帮你解决MEMORY_BASIC_INFORMATION中 BaseAddress 和 AllocationBase 区别所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复