[0.1.x] fixed : intBase for x64

git-svn-id: https://pykd.svn.codeplex.com/svn@72658 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2011-12-23 15:13:00 +00:00 committed by Mikhail I. Izmestev
parent f93df74624
commit 7c70e6d166
6 changed files with 44 additions and 48 deletions

View File

@ -65,4 +65,39 @@ python::object getRegByName( const std::wstring &regName )
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
ULONG64 DebugClient::loadMSR( ULONG msr )
{
HRESULT hres;
ULONG64 value;
hres = m_dataSpaces->ReadMsr( msr, &value );
if ( FAILED( hres ) )
throw DbgException( "IDebugDataSpaces::ReadMsr failed" );
return value;
}
ULONG64 loadMSR( ULONG msr )
{
return g_dbgClient->loadMSR( msr );
}
///////////////////////////////////////////////////////////////////////////////////
void DebugClient::setMSR( ULONG msr, ULONG64 value)
{
HRESULT hres;
hres = m_dataSpaces->WriteMsr(msr, value);
if ( FAILED( hres ) )
throw DbgException( "IDebugDataSpaces::WriteMsr failed" );
}
void setMSR( ULONG msr, ULONG64 value)
{
g_dbgClient->setMSR( msr, value );
}
///////////////////////////////////////////////////////////////////////////////////
} // end namespace pykd } // end namespace pykd

View File

@ -11,6 +11,10 @@ python::object getRegByName( const std::wstring &regName );
python::object getRegByIndex( ULONG index ); python::object getRegByIndex( ULONG index );
ULONG64 loadMSR( ULONG msr );
void setMSR( ULONG msr, ULONG64 value);
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
}; // end pykd namespace }; // end pykd namespace

View File

@ -179,25 +179,6 @@ void loadDump( const std::wstring &fileName ) {
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
ULONG64 DebugClient::loadMSR( ULONG msr )
{
HRESULT hres;
ULONG64 value;
hres = m_dataSpaces->ReadMsr( msr, &value );
if ( FAILED( hres ) )
throw DbgException( "IDebugDataSpaces::ReadMsr failed" );
return value;
}
ULONG64 loadMSR( ULONG msr )
{
return g_dbgClient->loadMSR( msr );
}
///////////////////////////////////////////////////////////////////////////////////
void DebugClient::startProcess( const std::wstring &processName ) void DebugClient::startProcess( const std::wstring &processName )
{ {
HRESULT hres; HRESULT hres;
@ -370,22 +351,6 @@ void setExecutionStatus( ULONG status )
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
void DebugClient::setMSR( ULONG msr, ULONG64 value)
{
HRESULT hres;
hres = m_dataSpaces->WriteMsr(msr, value);
if ( FAILED( hres ) )
throw DbgException( "IDebugDataSpaces::WriteMsr failed" );
}
void setMSR( ULONG msr, ULONG64 value)
{
g_dbgClient->setMSR( msr, value );
}
///////////////////////////////////////////////////////////////////////////////////
void DebugClient::waitForEvent() void DebugClient::waitForEvent()
{ {
HRESULT hres; HRESULT hres;

View File

@ -304,14 +304,10 @@ bool isKernelDebugging();
bool isDumpAnalyzing(); bool isDumpAnalyzing();
ULONG64 loadMSR( ULONG msr );
ULONG ptrSize(); ULONG ptrSize();
void setExecutionStatus( ULONG status ); void setExecutionStatus( ULONG status );
void setMSR( ULONG msr, ULONG64 value);
void terminateProcess(); void terminateProcess();
void waitForEvent(); void waitForEvent();

View File

@ -195,20 +195,15 @@ private:
return BaseTypeVariant(false); return BaseTypeVariant(false);
} }
else if ( _PyLong_Sign( obj.ptr() ) >= 0 ) else if ( PyInt_CheckExact( obj.ptr() ) )
{ {
if ( PyInt_CheckExact( obj.ptr() ) ) return BaseTypeVariant( LONG( PyLong_AsLong( obj.ptr() ) ) );
return BaseTypeVariant( ULONG( PyLong_AsUnsignedLong( obj.ptr() ) ) );
else
if( PyLong_CheckExact( obj.ptr() ) )
return BaseTypeVariant( ULONG64( PyLong_AsUnsignedLongLong( obj.ptr() ) ) );
} }
else else
{ {
if ( PyInt_CheckExact( obj.ptr() ) ) if ( _PyLong_Sign( obj.ptr() ) >= 0 )
return BaseTypeVariant( LONG( PyLong_AsLong( obj.ptr() ) ) ); return BaseTypeVariant( ULONG64( PyLong_AsUnsignedLongLong( obj.ptr() ) ) );
else else
if( PyLong_CheckExact( obj.ptr() ) )
return BaseTypeVariant( LONG64( PyLong_AsLongLong( obj.ptr() ) ) ); return BaseTypeVariant( LONG64( PyLong_AsLongLong( obj.ptr() ) ) );
} }

View File

@ -26,6 +26,7 @@ class IntBaseTest( unittest.TestCase ):
self.assertTrue( 0xFFFFFFFFFFFFFFFF == intBase(0xFFFFFFFFFFFFFFFF) ) self.assertTrue( 0xFFFFFFFFFFFFFFFF == intBase(0xFFFFFFFFFFFFFFFF) )
self.assertTrue( -20 == intBase(-20) ) self.assertTrue( -20 == intBase(-20) )
self.assertTrue( -2000 == intBase(-2000) ) self.assertTrue( -2000 == intBase(-2000) )
self.assertTrue( -0x7FFFFFFF == intBase(-0x7FFFFFFF) )
self.assertTrue( -20000000000 == intBase(-20000000000) ) self.assertTrue( -20000000000 == intBase(-20000000000) )
self.assertTrue( -0x8000000000000000 == intBase(-0x8000000000000000) ) self.assertTrue( -0x8000000000000000 == intBase(-0x8000000000000000) )
self.assertTrue( intBase(0x20L) == intBase(0x20) ) self.assertTrue( intBase(0x20L) == intBase(0x20) )