[0.2.x] added : systemUptime routine ( return the number of seconds the target system has been running )

[0.2.x] added : getCurrentTime routine ( return the number of seconds since the beginning of 1970 at the target system )

git-svn-id: https://pykd.svn.codeplex.com/svn@82391 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-01-21 07:58:54 +00:00 committed by Mikhail I. Izmestev
parent 11829511aa
commit 6602337447
4 changed files with 39 additions and 1 deletions

View File

@ -35,6 +35,8 @@ void eprintln( const std::wstring &str );
ULONG ptrSize();
bool is64bitSystem();
ULONG getPageSize();
ULONG getSystemUptime();
ULONG getCurrentTime();
//manage debug module
ULONG64 findModuleBase( const std::string &moduleName );

View File

@ -2,7 +2,7 @@
#define PYKD_VERSION_MAJOR 0
#define PYKD_VERSION_MINOR 2
#define PYKD_VERSION_SUBVERSION 0
#define PYKD_VERSION_BUILDNO 15
#define PYKD_VERSION_BUILDNO 16
#define __VER_STR2__(x) #x

View File

@ -142,6 +142,10 @@ BOOST_PYTHON_MODULE( pykd )
"Check if target system has 64 address space" );
python::def( "pageSize", &getPageSize,
"Get the page size for the currently executing processor context" );
python::def( "systemUptime", &getSystemUptime,
"Return the number of seconds the computer has been running" );
python::def( "currentTime", &getCurrentTime,
"Return the number of seconds since the beginning of 1970" );
// Manage target memory access
python::def( "addr64", &addr64,

View File

@ -721,6 +721,38 @@ ULONG getPageSize()
///////////////////////////////////////////////////////////////////////////////
ULONG getSystemUptime()
{
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
HRESULT hres;
ULONG time;
hres = g_dbgEng->control->GetCurrentSystemUpTime( &time );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl2::GetCurrentSystemUpTime", hres );
return time;
}
///////////////////////////////////////////////////////////////////////////////
ULONG getCurrentTime()
{
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
HRESULT hres;
ULONG time;
hres = g_dbgEng->control->GetCurrentTimeDate( &time );
if ( FAILED( hres ) )
throw DbgException( "IDebugControl2::GetCurrentTimeDate", hres );
return time;
}
///////////////////////////////////////////////////////////////////////////////
ULONG64 loadMSR( ULONG msr )
{
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );