堆栈和堆栈基地址

编程入门 行业动态 更新时间:2024-10-27 15:22:23
本文介绍了堆栈和堆栈基地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在 MEMORY_BASIC_INFORMATION 结构中找到两个PVOID变量,分别称为BaseAddress和AllocationBase.

In the MEMORY_BASIC_INFORMATION structure one finds two PVOID variables, called BaseAddress and AllocationBaserespectively.

我正在读一本关于线程的书,它详细介绍了如何使堆栈空间留在堆栈上,但是我不确定我是否正确理解了一些东西.

I'm reading a book on Threading and its going over how to get the stackspace left on the stack in quite some detail, however there's something I'm not sure I understand correctly.

上述结构中的BaseAddress,它指向当前线程堆栈中的最高地址还是最低地址?由于堆栈向下增长,因此最低的堆栈将位于顶部,最高的堆栈将位于底部.

The BaseAddress in the structure mentioned above, does it point to the highest address in the current thread stack or the lowest address? Since the stack grows downwards, the lowest would be at the top and the highest at the bottom.

AllocationBase和BaseAddress字段之间到底有什么区别?我觉得MSDN文档不是很解释,所以我希望有人可以澄清更多信息?

What exactly is the difference between the AllocationBase and BaseAddress field? I don't find the MSDN documentation very explanatory, so I'm hoping someone can clarify a bit more?

在我的书中,它还说"AllocationBase"地址与TEB结构中的"DeallocationStack"字段相同,它指出了堆栈的末尾,我认为这是最高地址,但是它的BASE,我猜它应该是最低的地址,因为堆栈向下增长.所以我对什么是什么感到困惑?

In my book it also says that the 'AllocationBase' address is the same as the 'DeallocationStack' field in the TEB structure, which it says points to the end of the stack, which I thought was the highest address, however since its BASE, I'm guessing it should be the lowest address, as the stack grows downward. So I'm kind of confused as to what's what?

每个此页,"DeallocationStack '是:最大堆栈大小存储在DeallocationStack字段中

Per this page, 'DeallocationStack' is: The maximum stack size is stored in the field DeallocationStack

有人可以帮助我理解我的困惑吗?

Can someone help me understand my confusion?

推荐答案

在MEMORY_BASIC_INFORMATION结构中:

  • BaseAddress-查询的内存页面的地址(VirtualQuery(LPCVOID lpAddress ,...").
  • AllocationBase-分配的内存块的开始.用于重新分配. BaseAddress> = AllocationBase.
  • 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.

如果要查询堆栈,则AllocationBase将是堆栈的最低地址(堆栈顶部).

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

更多推荐

堆栈和堆栈基地址

本文发布于:2023-11-07 09:09:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566059.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:堆栈   基地

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!