PVOID HandlerData;
INT i;
PRUNTIME_FUNCTION FunctionEntry;
-DPRINT1("RtlWalkFrameChain called\n");
- RtlCaptureContext(&Context);
+ DPRINT("Enter RtlWalkFrameChain\n");
+
+ /* Capture the current Context */
+ RtlCaptureContext(&Context);
ControlPc = Context.Rip;
+ /* Get the stack limits */
RtlpGetStackLimits(&StackLow, &StackHigh);
/* Check if we want the user-mode stack frame */
DPRINT("normal funtion, new Rip = %p, new Rsp = %p\n", (PVOID)Context.Rip, (PVOID)Context.Rsp);
}
- ControlPc = Context.Rip;
- /* Save this frame */
+ /* Check if new Rip is valid */
+ if (!Context.Rip)
+ {
+ break;
+ }
- Callers[i] = (PVOID)ControlPc;
+ /* Check, if we have left our stack */
+ if ((Context.Rsp < StackLow) || (Context.Rsp > StackHigh))
+ {
+ break;
+ }
+ /* Save this frame and continue with new Rip */
+ ControlPc = Context.Rip;
+ Callers[i] = (PVOID)ControlPc;
}
+ DPRINT("RtlWalkFrameChain returns %ld\n", i);
return i;
}