首页
社区
课程
招聘
[求助]OD是怎么知道cpu栈的栈底的
发表于: 2010-12-7 21:12 4205

[求助]OD是怎么知道cpu栈的栈底的

2010-12-7 21:12
4205
我正在写一个调试器,但是不知道栈是怎么计算的。OD当中可以看到栈底,它是怎么获得的呢。有高手能帮小弟解答一下吗,非常感谢。

[培训]科锐软件逆向54期预科班、正式班开始火爆招生报名啦!!!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 678
活跃值: (12)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
GetThreadContext
The GetThreadContext function retrieves the context of the specified thread.

BOOL GetThreadContext(
  HANDLE hThread,       // handle to thread with context
  LPCONTEXT lpContext   // context structure
);
Parameters
hThread
[in] Handle to the thread whose context is to be retrieved.
Windows NT/2000/XP: The handle must have THREAD_GET_CONTEXT access to the thread. For more information, see Thread Security and Access Rights.

WOW64: The handle must also have THREAD_QUERY_INFORMATION access.

lpContext
[in/out] Pointer to the CONTEXT structure that receives the appropriate context of the specified thread. The value of the ContextFlags member of this structure specifies which portions of a thread's context are retrieved. The CONTEXT structure is highly computer specific. Currently, there are CONTEXT structures defined for Intel, MIPS, Alpha, and PowerPC processors. Refer to the WinNt.h header file for definitions of these structures.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.
2010-12-7 21:25
0
雪    币: 21
活跃值: (200)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
这个是用来获得断点的信息的。这个函数我已经在用了,但我希望能获得CPU调用的栈。也就是说,pe文件在运行的时候会把一段内存分配为栈空间。我想知道它的地址从多少到多少,OD是怎么实现的。
2010-12-8 11:57
0
游客
登录 | 注册 方可回帖
返回