資源簡介
WinDbg 從SDK中安裝,Debugging Tools for Windows (x86)目錄所有文件,綠色含幫助文檔
代碼片段和文件信息
//----------------------------------------------------------------------------
//
//?C++?dbgeng?extension?framework.
//
//?Copyright?(C)?Microsoft?Corporation?2005-2006.
//
//----------------------------------------------------------------------------
#include?
#include?
#include?
#if?defined(_PREFAST_)?||?defined(_PREFIX_)
#define?PRE_ASSUME(_Cond)?__analysis_assume(_Cond)
#else
#define?PRE_ASSUME(_Cond)
#endif
#define?IsSpace(_Char)?isspace((UCHAR)(_Char))
WINDBG_EXTENSION_APIS64?ExtensionApis;
ExtCheckedPointer
????g_Ext(“g_Ext?not?set?used?outside?of?a?command“);
//----------------------------------------------------------------------------
//
//?ExtException?family.
//
//----------------------------------------------------------------------------
void
ExtException::PrintMessageVa(__in_ecount(BufferChars)?PSTR?Buffer
?????????????????????????????__in?ULONG?BufferChars
?????????????????????????????__in?PCSTR?Format
?????????????????????????????__in?va_list?Args)
{
????StringCchVPrintfA(Buffer?BufferChars?Format?Args);
????m_Message?=?Buffer;
}
void?WINAPIV
ExtException::PrintMessage(__in_ecount(BufferChars)?PSTR?Buffer
???????????????????????????__in?ULONG?BufferChars
???????????????????????????__in?PCSTR?Format
???????????????????????????...)
{
????va_list?Args;
????va_start(Args?Format);
????PrintMessageVa(Buffer?BufferChars?Format?Args);
????va_end(Args);
}
//----------------------------------------------------------------------------
//
//?Holders.
//
//----------------------------------------------------------------------------
void
ExtCurrentThreadHolder::Refresh(void)
{
????HRESULT?Status;
????
????if?((Status?=?g_Ext->m_System->
?????????GetCurrentThreadId(&m_ThreadId))?!=?S_OK)
????{
????????throw?ExtStatusException(Status
?????????????????????????????????“ExtCurrentThreadHolder::Refresh?failed“);
????}
}
void
ExtCurrentThreadHolder::Restore(void)
{
????if?(m_ThreadId?!=?DEBUG_ANY_ID)
????{
????????PRE_ASSUME(g_Ext.IsSet());
????????if?(g_Ext.IsSet())
????????{
????????????//?Ensure?that?g_Ext->?operator?will?not?throw?exception.
????????????g_Ext->m_System->SetCurrentThreadId(m_ThreadId);
????????}
????????m_ThreadId?=?DEBUG_ANY_ID;
????}
}
void
ExtCurrentProcessHolder::Refresh(void)
{
????HRESULT?Status;
????
????if?((Status?=?g_Ext->m_System->
?????????GetCurrentProcessId(&m_ProcessId))?!=?S_OK)
????{
????????throw?ExtStatusException(Status
?????????????????????????????????“ExtCurrentProcessHolder::Refresh?failed“);
????}
}
void
ExtCurrentProcessHolder::Restore(void)
{
????if?(m_ProcessId?!=?DEBUG_ANY_ID)
????{
????????PRE_ASSUME(g_Ext.IsSet());
????????if?(g_Ext.IsSet())
????????{
????????????//?Ensure?that?g_Ext->?operator?will?not?throw?exception.
????????????g_Ext->m_System->SetCurrentProcessId(m_ProcessId);
????????}
????????m_ProcessId?=
- 上一篇:微信小程序紅包源代碼
- 下一篇:ECOS開發文檔詳細檔案
評論
共有 條評論