-
-
[求助]编写windbg扩展程序,如何调用非扩展命令,求解,谢谢大神指导
-
发表于: 2015-10-22 17:31 2092
-
直接上代码,求大神指导,谢谢!
BOOL CDumpCallstackMgr::InitInterface()
{
HRESULT hr = S_OK;
hr = DebugCreate(__uuidof(IDebugClient), (LPVOID*)&m_sptrDebugClient);
if(FAILED(hr))
return FALSE;
hr = m_sptrDebugClient->QueryInterface(__uuidof(IDebugControl), (LPVOID*)&m_sptrDebugControl);
if(FAILED(hr))
return FALSE;
hr = m_sptrDebugClient->QueryInterface(__uuidof(IDebugSymbols), (LPVOID*)&m_sptrDebugSymbols);
if(FAILED(hr))
return FALSE;
return TRUE;
}
BOOL CDumpCallstackMgr::OpenAndAnalyizeDumpFile()
{
if (!InitInterface())
return FALSE;
HRESULT hr = S_OK;
if (m_sptrDebugSymbols && !m_strSymbolPath.empty())
{
hr = m_sptrDebugSymbols->SetSymbolPath(m_strSymbolPath.c_str());
if (FAILED(hr)) return FALSE;
}
hr = m_sptrDebugClient->SetOutputCallbacks(&m_dumpOutputMgr);
hr = m_sptrDebugClient->OpenDumpFile(m_strDumpFilePath.c_str());
if (FAILED(hr)) return FALSE;
hr = m_sptrDebugControl->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE);
if (FAILED(hr)) return FALSE;
m_strOutputCallStackInfo += m_dumpOutputMgr.GetOutputInfo();
if (m_strOutputCallStackInfo.empty()) return FALSE;
//调用!analyze -v
m_dumpOutputMgr.CleanOutputBuffer();
hr = m_sptrDebugControl->Execute( DEBUG_OUTCTL_THIS_CLIENT | DEBUG_OUTCTL_OVERRIDE_MASK | DEBUG_OUTCTL_NOT_LOGGED, "!analyze -v", DEBUG_EXECUTE_DEFAULT );
if (FAILED(hr))return FALSE;
//调用lm,lmvm等怎么搞?求解
return TRUE;
}
BOOL CDumpCallstackMgr::InitInterface()
{
HRESULT hr = S_OK;
hr = DebugCreate(__uuidof(IDebugClient), (LPVOID*)&m_sptrDebugClient);
if(FAILED(hr))
return FALSE;
hr = m_sptrDebugClient->QueryInterface(__uuidof(IDebugControl), (LPVOID*)&m_sptrDebugControl);
if(FAILED(hr))
return FALSE;
hr = m_sptrDebugClient->QueryInterface(__uuidof(IDebugSymbols), (LPVOID*)&m_sptrDebugSymbols);
if(FAILED(hr))
return FALSE;
return TRUE;
}
BOOL CDumpCallstackMgr::OpenAndAnalyizeDumpFile()
{
if (!InitInterface())
return FALSE;
HRESULT hr = S_OK;
if (m_sptrDebugSymbols && !m_strSymbolPath.empty())
{
hr = m_sptrDebugSymbols->SetSymbolPath(m_strSymbolPath.c_str());
if (FAILED(hr)) return FALSE;
}
hr = m_sptrDebugClient->SetOutputCallbacks(&m_dumpOutputMgr);
hr = m_sptrDebugClient->OpenDumpFile(m_strDumpFilePath.c_str());
if (FAILED(hr)) return FALSE;
hr = m_sptrDebugControl->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE);
if (FAILED(hr)) return FALSE;
m_strOutputCallStackInfo += m_dumpOutputMgr.GetOutputInfo();
if (m_strOutputCallStackInfo.empty()) return FALSE;
//调用!analyze -v
m_dumpOutputMgr.CleanOutputBuffer();
hr = m_sptrDebugControl->Execute( DEBUG_OUTCTL_THIS_CLIENT | DEBUG_OUTCTL_OVERRIDE_MASK | DEBUG_OUTCTL_NOT_LOGGED, "!analyze -v", DEBUG_EXECUTE_DEFAULT );
if (FAILED(hr))return FALSE;
//调用lm,lmvm等怎么搞?求解
return TRUE;
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
赞赏
看原图
赞赏
雪币:
留言: