Daniel Zimmerman <netzimme@aim.com>

- Implement RtlGetCallersAddress.
- Add RtlCaptureStackBackTrace prototype to PSDK.
See issue #3125 for more details.

svn path=/trunk/; revision=32693
This commit is contained in:
Aleksey Bragin 2008-03-15 09:29:54 +00:00
parent 68f67228b5
commit 1789bf3561
2 changed files with 46 additions and 2 deletions

View file

@ -2902,6 +2902,17 @@ typedef struct _RTL_CRITICAL_SECTION {
} RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION;
#endif
NTSYSAPI
WORD
NTAPI
RtlCaptureStackBackTrace(
IN DWORD FramesToSkip,
IN DWORD FramesToCapture,
OUT PVOID *BackTrace,
OUT PDWORD BackTraceHash OPTIONAL
);
NTSYSAPI
PVOID
NTAPI

View file

@ -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 = NULL;
/* Get the tow back trace address */
FrameCount = RtlCaptureStackBackTrace(2, 2, &BackTrace[0],BackTraceHash);
/* Only if user want it */
if (*CallersAddress != NULL)
{
/* only when first frames exist */
if (FrameCount >= 1)
{
*CallersAddress = BackTrace[0];
}
else
{
*CallersAddress = NULL;
}
}
/* Only if user want it */
if (*CallersCaller != NULL)
{
/* only when second frames exist */
if (FrameCount >= 2)
{
*CallersCaller = BackTrace[1];
}
else
{
*CallersCaller = NULL;
}
}
}
/*