1

在矢量异常处理程序中,我正在像这样遍历堆栈帧(在 32 位进程中,假设没有 FPO):

unsigned int *nextFrame;
unsigned int returnAddress;
__asm mov [nextFrame], ebp
while (!IsBadReadPtr(nextFrame, 8))
{
  nextFrame = (unsigned int *)*nextFrame;
  returnAddress = *(nextFrame + 1);
}

但是,IsBadReadPtr似乎停止条件不够好,因为经过几次迭代后,我在*(nextFrame + 1).

正确的条件是什么?

更新:事实证明IsBadReadPtr引发(并处理)异常,因此根本不能在 VEH 中使用。

Update2最后,我尝试使用一些“启发式”来检测帧的结束位置:我将当前帧指针与前一个帧指针进行比较,如果差异看起来不合理,则中断循环。

4

0 回答 0