mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[0.2.x] add function getExt
git-svn-id: https://pykd.svn.codeplex.com/svn@87117 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
58df54763b
commit
39ca17dd9a
@ -204,6 +204,7 @@ void appendSymbolPath(const std::string &symPath);
|
|||||||
|
|
||||||
// Extensions
|
// Extensions
|
||||||
ULONG64 loadExtension(const std::wstring &extPath );
|
ULONG64 loadExtension(const std::wstring &extPath );
|
||||||
|
ULONG64 getExtension(const std::wstring &extPath );
|
||||||
void removeExtension( ULONG64 extHandle );
|
void removeExtension( ULONG64 extHandle );
|
||||||
std::wstring callExtension( ULONG64 extHandle, const std::wstring command, const std::wstring ¶ms );
|
std::wstring callExtension( ULONG64 extHandle, const std::wstring command, const std::wstring ¶ms );
|
||||||
|
|
||||||
|
@ -84,6 +84,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Set directory of SYMSRV.dll library.\nUsually this is a directory of WinDbg");
|
"Set directory of SYMSRV.dll library.\nUsually this is a directory of WinDbg");
|
||||||
python::def( "loadExt", &loadExtension,
|
python::def( "loadExt", &loadExtension,
|
||||||
"Load a WinDBG extension. Return handle of the loaded extension" );
|
"Load a WinDBG extension. Return handle of the loaded extension" );
|
||||||
|
python::def( "getExt", &getExtension,
|
||||||
|
"Return handle of the loaded extension" );
|
||||||
python::def( "removeExt", &removeExtension,
|
python::def( "removeExt", &removeExtension,
|
||||||
"Unload a WinDBG extension. Parameters: handle returned by loadExt" );
|
"Unload a WinDBG extension. Parameters: handle returned by loadExt" );
|
||||||
python::def( "callExt", &callExtension,
|
python::def( "callExt", &callExtension,
|
||||||
|
@ -1298,7 +1298,23 @@ ULONG64 loadExtension(const std::wstring &extPath )
|
|||||||
|
|
||||||
hres = g_dbgEng->control->AddExtensionWide( extPath.c_str(), 0, &handle );
|
hres = g_dbgEng->control->AddExtensionWide( extPath.c_str(), 0, &handle );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugControl::AddExtension failed" );
|
throw DbgException( "IDebugControl::AddExtension", hres );
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ULONG64 getExtension(const std::wstring &extPath )
|
||||||
|
{
|
||||||
|
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||||
|
|
||||||
|
HRESULT hres;
|
||||||
|
ULONG64 handle = 0;
|
||||||
|
|
||||||
|
hres = g_dbgEng->control->GetExtensionByPathWide( extPath.c_str(), &handle );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugControl::GetExtensionByPath", hres );
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
@ -1325,7 +1341,7 @@ std::wstring callExtension( ULONG64 extHandle, const std::wstring command, const
|
|||||||
hres = g_dbgEng->control->CallExtensionWide( extHandle, command.c_str(), params.c_str() );
|
hres = g_dbgEng->control->CallExtensionWide( extHandle, command.c_str(), params.c_str() );
|
||||||
|
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugControl::CallExtension failed" );
|
throw DbgException( "IDebugControl::CallExtension", hres );
|
||||||
|
|
||||||
return std::wstring( outReader.Line() );
|
return std::wstring( outReader.Line() );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user