• 大小: 11.54MB
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2023-07-12
  • 语言: 其他
  • 标签: WinDbg  

资源简介

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 =

评论

共有 条评论