pykd/pykd/windbgeng.h
SND\kernelnet_cp 73478dc355 [0.2.x] began work at the new version
git-svn-id: https://pykd.svn.codeplex.com/svn@78304 9b283d60-5439-405e-af05-b73fd8c4d996
2017-11-08 17:42:50 +04:00

62 lines
1.3 KiB
C++

#pragma once
#include "dbgengine.h"
#include "dbgexcept.h"
#include "pyaux.h"
namespace pykd {
///////////////////////////////////////////////////////////////////////////////////
class DebugEngine {
public:
struct DbgEngBind {
CComQIPtr<IDebugClient4> client;
CComQIPtr<IDebugControl4> control;
CComQIPtr<IDebugSystemObjects2> system;
CComQIPtr<IDebugSymbols3> symbols;
DbgEngBind( PDEBUG_CLIENT4 c )
{
client = c;
control = c;
system = c;
symbols = c;
}
PyThreadStateSaver pystate;
};
DbgEngBind*
operator->()
{
if ( m_bind.get() != NULL )
return m_bind.get();
CComPtr<IDebugClient4> client = NULL;
HRESULT hres = DebugCreate( __uuidof(IDebugClient4), (void **)&client );
if ( FAILED( hres ) )
throw DbgException("DebugCreate failed");
m_bind.reset(new DbgEngBind(client) );
return m_bind.get();
}
private:
std::auto_ptr<DbgEngBind> m_bind;
};
///////////////////////////////////////////////////////////////////////////////////
extern DebugEngine g_dbgEng;
///////////////////////////////////////////////////////////////////////////////////
};