diff --git a/pykd/dbgengine.h b/pykd/dbgengine.h index e0360ab..f9ddfb6 100644 --- a/pykd/dbgengine.h +++ b/pykd/dbgengine.h @@ -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 ); diff --git a/pykd/pykdver.h b/pykd/pykdver.h index ef7ca3a..297ce78 100644 --- a/pykd/pykdver.h +++ b/pykd/pykdver.h @@ -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 diff --git a/pykd/python/pymod.cpp b/pykd/python/pymod.cpp index 794eb30..4f1e549 100644 --- a/pykd/python/pymod.cpp +++ b/pykd/python/pymod.cpp @@ -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, diff --git a/pykd/win/dbgeng.cpp b/pykd/win/dbgeng.cpp index 316f3b0..ad8e7e3 100644 --- a/pykd/win/dbgeng.cpp +++ b/pykd/win/dbgeng.cpp @@ -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 );