[+] added : isValid() routine; it validates virtual address

git-svn-id: https://pykd.svn.codeplex.com/svn@61122 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2011-02-07 07:59:22 +00:00
parent f198999116
commit c74a81d560
3 changed files with 46 additions and 0 deletions

View File

@ -98,6 +98,7 @@ BOOST_PYTHON_MODULE( pykd )
boost::python::def( "dprintln", &DbgPrint::dprintln, dprintln( boost::python::args( "str", "dml" ), "" ) ); boost::python::def( "dprintln", &DbgPrint::dprintln, dprintln( boost::python::args( "str", "dml" ), "" ) );
boost::python::def( "loadDump", &dbgLoadDump ); boost::python::def( "loadDump", &dbgLoadDump );
boost::python::def( "dbgCommand", &dbgCommand ); boost::python::def( "dbgCommand", &dbgCommand );
boost::python::def( "isValid", &isOffsetValid );
boost::python::def( "is64bitSystem", &is64bitSystem ); boost::python::def( "is64bitSystem", &is64bitSystem );
boost::python::def( "isKernelDebugging", &isKernelDebugging ); boost::python::def( "isKernelDebugging", &isKernelDebugging );
boost::python::def( "ptrSize", ptrSize ); boost::python::def( "ptrSize", ptrSize );

View File

@ -4,6 +4,7 @@
#include "dbgexcept.h" #include "dbgexcept.h"
#include "dbgmem.h" #include "dbgmem.h"
#include "dbgsystem.h" #include "dbgsystem.h"
#include "dbgcallback.h"
using namespace std; using namespace std;
@ -526,3 +527,44 @@ loadLinkedList( ULONG64 address )
} }
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
bool
isOffsetValid( ULONG64 addr )
{
HRESULT hres;
try {
// íóæíî ïîäàâèòü âîçìîæíûé âûâîä â êîíñîëü îá îòñóòñòâóþùåé ñòðàíèöå ïàìÿòè
OutputReader outputReader( dbgExt->client );
ULONG offsetInfo;
hres =
dbgExt->dataSpaces4->GetOffsetInformation(
DEBUG_DATA_SPACE_VIRTUAL,
DEBUG_OFFSINFO_VIRTUAL_SOURCE,
addr,
&offsetInfo,
sizeof( offsetInfo ),
NULL );
if ( FAILED( hres ) )
throw DbgException( "IDebugDataSpace4::GetOffsetInformation failed" );
return offsetInfo != DEBUG_VSOURCE_INVALID;
}
catch( std::exception &e )
{
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd error: %s\n", e.what() );
}
catch(...)
{
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "pykd unexpected error\n" );
}
return false;
}
///////////////////////////////////////////////////////////////////////////////////

View File

@ -91,4 +91,7 @@ addr64( ULONG64 addr );
boost::python::object boost::python::object
loadLinkedList( ULONG64 address ); loadLinkedList( ULONG64 address );
bool
isOffsetValid( ULONG64 addr );
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////