Author: fireball
Date: Sat Mar 15 04:29:54 2008
New Revision: 32693
URL:
http://svn.reactos.org/svn/reactos?rev=3D32693&view=3Drev
Log:
Daniel Zimmerman <netzimme(a)aim.com>
- Implement RtlGetCallersAddress.
- Add RtlCaptureStackBackTrace prototype to PSDK.
See issue #3125 for more details.
Modified:
trunk/reactos/include/psdk/winnt.h
trunk/reactos/lib/rtl/i386/except.c
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?=
rev=3D32693&r1=3D32692&r2=3D32693&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/include/psdk/winnt.h (original)
+++ trunk/reactos/include/psdk/winnt.h Sat Mar 15 04:29:54 2008
@@ -2903,6 +2903,17 @@
#endif
=
NTSYSAPI
+WORD =
+NTAPI
+RtlCaptureStackBackTrace(
+ IN DWORD FramesToSkip,
+ IN DWORD FramesToCapture,
+ OUT PVOID *BackTrace,
+ OUT PDWORD BackTraceHash OPTIONAL
+);
+
+
+NTSYSAPI
PVOID
NTAPI
RtlPcToFileHeader(
Modified: trunk/reactos/lib/rtl/i386/except.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/except.c=
?rev=3D32693&r1=3D32692&r2=3D32693&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/lib/rtl/i386/except.c (original)
+++ trunk/reactos/lib/rtl/i386/except.c Sat Mar 15 04:29:54 2008
@@ -16,14 +16,47 @@
/* PUBLIC FUNCTIONS ******************************************************=
****/
=
/*
- * @unimplemented
+ * @implemented
*/
VOID
NTAPI
RtlGetCallersAddress(OUT PVOID *CallersAddress,
OUT PVOID *CallersCaller)
{
- UNIMPLEMENTED;
+ USHORT FrameCount;
+ PVOID BackTrace[2];
+ PULONG BackTraceHash =3D NULL;
+
+ /* Get the tow back trace address */
+ FrameCount =3D RtlCaptureStackBackTrace(2, 2, &BackTrace[0],BackTraceH=
ash);
+
+ /* Only if user want it */
+ if (*CallersAddress !=3D NULL)
+ {
+ /* only when first frames exist */ =
+ if (FrameCount >=3D 1)
+ {
+ *CallersAddress =3D BackTrace[0];
+ }
+ else
+ {
+ *CallersAddress =3D NULL;
+ }
+ }
+
+ /* Only if user want it */
+ if (*CallersCaller !=3D NULL)
+ {
+ /* only when second frames exist */ =
+ if (FrameCount >=3D 2)
+ {
+ *CallersCaller =3D BackTrace[1];
+ }
+ else
+ {
+ *CallersCaller =3D NULL;
+ }
+ }
}
=
/*