views:

1236

answers:

3

I've recently heard about the CaptureStackBackTrace function by reading this post. I cannot find it in any of my Visual Studio 2005 header files however, and I'm guessing (from the MSDN URL which mentions VS.85) that this may only be a Visual Studio 2008 thing.

Is there a way, perhaps by manually finding the entry point in a system DLL somewhere, to get this function under Visual Studio 2005?

A: 

Did you update your Windows SDK to the most recent version? Since this is a Windows API function, it should be included there.

OregonGhost
So did updating your SDK work?
Nick
I guess so, since he accepted my answer ;)
OregonGhost
+2  A: 

Remarks

The CaptureStackBackTrace function is defined as the RtlCaptureStackBackTrace function. For more information, see Winbase.h and Winnt.h.

leppie
A: 

I haven't updated my Windows SDK beyond whatever comes with Visual Studio 2005 but I have found this solution to work:

typedef USHORT (WINAPI *CaptureStackBackTraceType)(__in ULONG, __in ULONG, __out PVOID*, __out_opt PULONG);
CaptureStackBackTraceType func = (CaptureStackBackTraceType)(GetProcAddress(LoadLibrary("kernel32.dll"), "RtlCaptureStackBackTrace"));
// Then use 'func' as if it were CaptureStackBackTrace
pauldoo