Hi All,
I am trying to generate call stack using StackWalk64 API on 32-bit and 64-bit machine.
StackWalk64 API works fine for 32-bit machine but on the 64-bit machine after reading the first line of the call stack API StackWalk64 returns FALSE.
Machine type is also changed to IMAGE_FILE_MACHINE_AMD64 but it is still not working.
Please let us know how to generate the entire call stack by using the StackWalk64 API on 64 bit OS.
/* Init symbol information */
bResult = SymInitialize(hProcess, PDB_DIR, TRUE);
if(!bResult) {
return 1;
}
/* Setup stack frame */
(void)memset(&sFrame, 0, sizeof(sFrame));
sFrame.AddrPC.Offset = pExceptionPointers->ContextRecord->Eip;
sFrame.AddrFrame.Offset = pExceptionPointers->ContextRecord->Ebp;
sFrame.AddrStack.Offset = pExceptionPointers->ContextRecord->Esp;
sFrame.AddrPC.Mode = AddrModeFlat;
sFrame.AddrFrame.Mode = AddrModeFlat;
sFrame.AddrStack.Mode = AddrModeFlat;
while( cntFrame < MAX_STACK_FRAME ) {
bResult = StackWalk64 (IMAGE_FILE_MACHINE_I386,
hProcess,
hThread,
&sFrame,
&(pExceptionPointers->ContextRecord),
NULL, /* optional */
NULL, /* optional */
NULL, /* optional */
NULL); /* optional */----API StackWalk64 gets failed after retrieving the first frame on 64 BIT OS-
if(!bResult) {
/* End of stack or Error */
break;
}
Thank You