Author: tkreuzer
Date: Mon Nov 17 17:24:59 2008
New Revision: 37425
URL:
http://svn.reactos.org/svn/reactos?rev=37425&view=rev
Log:
Implement RtlGetCallersAddress
Modified:
branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c
Modified: branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/r…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] Mon Nov 17
17:24:59 2008
@@ -332,7 +332,7 @@
{
CONTEXT Context;
ULONG64 ControlPc, ImageBase, EstablisherFrame;
- ULONG64 StackBegin, StackEnd;
+ ULONG64 StackLow, StackHigh;
PVOID HandlerData;
INT i;
PRUNTIME_FUNCTION FunctionEntry;
@@ -341,7 +341,7 @@
ControlPc = Context.Rip;
- RtlpGetStackLimits(&StackBegin, &StackEnd);
+ RtlpGetStackLimits(&StackLow, &StackHigh);
/* Check if we want the user-mode stack frame */
if (Flags == 1)
@@ -384,3 +384,29 @@
return i;
}
+// CHEKCME: return PVOID?
+//
http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/Debug…
+VOID
+NTAPI
+RtlGetCallersAddress(
+ OUT PVOID *CallersAddress,
+ OUT PVOID *CallersCaller )
+{
+ PVOID Callers[4];
+ ULONG Number;
+
+ /* Get callers:
+ * RtlWalkFrameChain -> RtlGetCallersAddress -> x -> y */
+ Number = RtlWalkFrameChain(Callers, 4, 0);
+
+ if (CallersAddress)
+ {
+ *CallersAddress = (Number >= 3) ? Callers[2] : NULL;
+ }
+ if (CallersCaller)
+ {
+ *CallersCaller = (Number == 4) ? Callers[3] : NULL;
+ }
+
+ return;
+}