00046 :
00047
00048 This routine returns
the address of
the call to
the routine that called
00049
this routine, and
the address of
the call to
the routine that called
00050
the routine that called
this routine. For example,
if A called B called
00051 C which called
this routine,
the return addresses in B and
A would be
00052 returned.
00053
00054 Arguments:
00055
00056 CallersPc - Supplies a pointer to a variable that receives
the address
00057 of
the caller of
the caller of
this routine (B).
00058
00059 CallersCallersPc - Supplies a pointer to a variable that receives
the
00060 address of
the caller of
the caller of
the caller of
this routine
00061 (
A).
00062
00063 Return Value:
00064
00065 None.
00066
00067 Note:
00068
00069 If either of
the calling stack frames exceeds
the limits of
the stack,
00070 they are set to
NULL.
00071
00072 --*/
00073
00074 {
00075
#ifdef REALLY_GET_CALLERS_CALLER
00076
CONTEXT ContextRecord;
00077 FRAME_POINTERS EstablisherFrame;
00078 PRUNTIME_FUNCTION FunctionEntry;
00079 BOOLEAN InFunction;
00080 ULONG HighLimit, LowLimit;
00081 ULONG NextPc;
00082
00083
00084
00085
00086
00087
00088 *CallersPc =
NULL;
00089 *CallersCallersPc =
NULL;
00090
00091
00092
00093
00094
00095 RtlCaptureContext(&ContextRecord);
00096 NextPc = (ULONG)ContextRecord.IntRa;
00097
00098
00099
00100
00101
00102
RtlpGetStackLimits(&LowLimit, &HighLimit);
00103
00104
00105
00106
00107
00108
00109
00110
00111 FunctionEntry =
RtlLookupFunctionEntry(NextPc);
00112
if (FunctionEntry !=
NULL) {
00113
00114
00115
00116
00117
00118
00119 NextPc =
RtlVirtualUnwind(NextPc,
00120 FunctionEntry,
00121 &ContextRecord,
00122 &InFunction,
00123 &EstablisherFrame,
00124 NULL);
00125
00126
00127
00128
00129
00130 FunctionEntry =
RtlLookupFunctionEntry(NextPc);
00131
if ((FunctionEntry !=
NULL) && ((ULONG)ContextRecord.IntSp < HighLimit)) {
00132
00133
00134
00135
00136
00137
00138
00139 NextPc =
RtlVirtualUnwind(NextPc,
00140 FunctionEntry,
00141 &ContextRecord,
00142 &InFunction,
00143 &EstablisherFrame,
00144 NULL);
00145 *CallersPc = (PVOID)NextPc;
00146
00147
00148
00149
00150
00151
00152 FunctionEntry =
RtlLookupFunctionEntry(NextPc);
00153
if ((FunctionEntry !=
NULL) && ((ULONG)ContextRecord.IntSp < HighLimit)) {
00154
00155
00156
00157
00158
00159
00160
00161
00162 NextPc =
RtlVirtualUnwind(NextPc,
00163 FunctionEntry,
00164 &ContextRecord,
00165 &InFunction,
00166 &EstablisherFrame,
00167 NULL);
00168
00169 *CallersCallersPc = (PVOID)NextPc;
00170 }
00171 }
00172 }
00173
#else
00174
*CallersPc =
NULL;
00175 *CallersCallersPc =
NULL;
00176
#endif
00177
return;
00178 }