mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
944 B
57 lines
944 B
#include "master.hxx"
|
|
#pragma hdrstop
|
|
|
|
#include <imagehlp.h>
|
|
|
|
PVOID
|
|
GetRemoteReturnAddress
|
|
(
|
|
IN HANDLE hProcess,
|
|
IN HANDLE hThread
|
|
)
|
|
{
|
|
ULONG ReadBuf[2];
|
|
PVOID pvBp;
|
|
CONTEXT Context;
|
|
|
|
Context.ContextFlags = CONTEXT_CONTROL;
|
|
|
|
if ( !GetThreadContext( hThread,
|
|
&Context ) )
|
|
{
|
|
return( FALSE );
|
|
}
|
|
|
|
pvBp = (PVOID)Context.Ebp;
|
|
|
|
if ( pvBp == NULL )
|
|
{
|
|
return( NULL );
|
|
}
|
|
|
|
if ( !ReadProcessMemory( hProcess,
|
|
pvBp,
|
|
ReadBuf,
|
|
sizeof( ReadBuf ),
|
|
NULL ) )
|
|
{
|
|
DebugPrintf( "GetRemoteReturnAddress: can't read stack, error %lu\n", GetLastError() );
|
|
return( NULL );
|
|
}
|
|
|
|
return( (PVOID)ReadBuf[1] );
|
|
}
|
|
|
|
BOOL
|
|
RemoteStackBacktrace
|
|
(
|
|
IN PCHILD_THREAD_INFO pThread
|
|
)
|
|
{
|
|
DoStackTrace( pThread,
|
|
100,
|
|
1 );
|
|
|
|
return( TRUE );
|
|
}
|
|
|