diff --git a/pykd/dbgmem.cpp b/pykd/dbgmem.cpp index 89379ec..c1ec88a 100644 --- a/pykd/dbgmem.cpp +++ b/pykd/dbgmem.cpp @@ -52,48 +52,41 @@ loadMemory( ULONG64 address, PVOID dest, ULONG length, BOOLEAN phyAddr ) /////////////////////////////////////////////////////////////////////////////////// ULONG64 -addr64Ex( ULONG64 addr, IDebugControl *control ) +addr64( ULONG64 addr) { HRESULT hres; try { ULONG processorMode; - hres = control->GetActualProcessorType( &processorMode ); + hres = dbgExt->control->GetActualProcessorType( &processorMode ); if ( FAILED( hres ) ) - throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" ); - + throw DbgException( "IDebugControl::GetEffectiveProcessorType failed" ); + switch( processorMode ) { case IMAGE_FILE_MACHINE_I386: if ( *( (ULONG*)&addr + 1 ) == 0 ) return (ULONG64)(LONG)addr; - + case IMAGE_FILE_MACHINE_AMD64: break; - + default: - throw DbgException( "Unknown processor type" ); + throw DbgException( "Unknown processor type" ); break; } } - 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 addr; -} + 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" ); + } -/////////////////////////////////////////////////////////////////////////////////// - -ULONG64 addr64( ULONG64 addr ) -{ - return addr64Ex(addr, dbgExt->control); + return addr; } /////////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/dbgmem.h b/pykd/dbgmem.h index 0312ffa..6d1e40b 100644 --- a/pykd/dbgmem.h +++ b/pykd/dbgmem.h @@ -79,9 +79,6 @@ loadWStrToBuffer( ULONG64 address, PWCHAR buffer, ULONG bufferLen ); bool compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length, BOOLEAN phyAddr = FALSE ); -ULONG64 -addr64Ex( ULONG64 addr, IDebugControl *control ); - ULONG64 addr64( ULONG64 addr ); diff --git a/pykd/dbgmodule.h b/pykd/dbgmodule.h index d8e487f..ae51356 100644 --- a/pykd/dbgmodule.h +++ b/pykd/dbgmodule.h @@ -30,17 +30,15 @@ struct ModuleInfo { } ModuleInfo( - const IMAGEHLP_MODULEW64 &dbgImageHelperInfo, - IDebugControl *control = dbgExt->control + const IMAGEHLP_MODULEW64 &dbgImageHelperInfo ) : m_base(addr64(dbgImageHelperInfo.BaseOfImage)) , m_timeDataStamp(dbgImageHelperInfo.TimeDateStamp) , m_checkSumm(dbgImageHelperInfo.CheckSum) { } ModuleInfo( - const DEBUG_MODULE_PARAMETERS &dbgModuleParameters, - IDebugControl *control = dbgExt->control - ) : m_base(addr64Ex(dbgModuleParameters.Base, control)) + const DEBUG_MODULE_PARAMETERS &dbgModuleParameters + ) : m_base(addr64(dbgModuleParameters.Base)) , m_timeDataStamp(dbgModuleParameters.TimeDateStamp) , m_checkSumm(dbgModuleParameters.Checksum) { @@ -168,4 +166,4 @@ loadModule( const std::string &moduleName ); boost::python::object findModule( ULONG64 addr ); -///////////////////////////////////////////////////////////////////////////////// \ No newline at end of file +/////////////////////////////////////////////////////////////////////////////////