WinDBG 使用教学(二)

一. WinDBG 内建许多指令供你应用, 但其他指令是怎麽来的呢?

    其实是 DLL 档案的 export function, 你也可以称这些 DLL file 是 WinDBG 的外挂(plugin)

    (你可别说每个 DLL 档案的 export function 都可拿来当 WinDBG 的指令呢)

    e文对这些扩充指令的正式称呼是 Extension Command

    我们先来实做一个实验

    先在 WinDBG 命令列输入 !strct _EPROCESS

    你得到什麽回应呢?

    不卖关子

    因为你还没有 load 该指令的 DLL 档案, 所以没有得到你想要的答案

    先用 explorer 浏览到 C:\Program Files\Debugging Tools for Windows (x86)\w2kfre 这目录

    里面有个 kdex2x86.dll 档案

    将它拷贝到 C:\Program Files\Debugging Tools for Windows (x86) 底下

    (也就你WinDBG的安装目录)

    然後在 WinDBG 指令列输入 .load kdex2x86.dll

    是的, .load 指令就是装载 DLL, 完毕後你再输入 !strct _EPROCESS

    现在你应该看到 _EPROCESS 这结构的面貌了吧

    strct 只是 kdex2x86.dll 的 export function 的其中之一, 功能是用来看结构的

    这小段的介绍, 只是想告诉你 Extension Command 是怎麽来的


二. 善用 help 指令, 快速的了解每个 Dll 的 export function 的功能

    (也就是 Extension Command)

    在安装 WinDBG 後, 里面好几个目录, 每个目录里面都有众多的 Dll files,

    我们不知道这些 Dll File 是做什麽用的, 但如何快速了解它的功能呢

    嗯~, 是的, 每个 Dll file 里面都有一个 help function, 

    好让我们快速的了解每个 Extension Command 的功能和使用方法

    首先, 让我们用 IDA 来看看 kdex2x86.dll 它的 export function

    ExtensionApiVersion    4B405920 1 
    WinDbgExtensionDllInit 4B405840 2 
    apc                    4B409070 3 
    dpc                    4B409390 4 
    ethread                4B408E00 5 
    help                   4B40D980 6 
    idt                    4B4095B0 7 
    ip                     4B403FE0 8 
    kqueue                 4B408FA0 9 
    kthread                4B408ED0 10
    lastlivetime           4B410D70 11
    list                   4B408540 12
    s                      4B4033A0 13
    singlelist             4B4087B0 14
    smb                    4B407F30 15
    stack                  4B4115F0 16
    strct                  4B409B20 17
    version                4B405930 18
    xpool                  4B40A210 19
    DllEntryPoint          4B447370   

    虽然不多, 但一个一个摸索也很浪费时间

    现在让我们在 WinDBG 的命令列输入

    !kdex2x86.help

    你将得到下面列表的讯息, 

    lkd> !kdex2x86.help

    help                       - Display this message
    version                    - Display extension dll version
    apc [-?h] [expression]     - Dump APC or all APCs
    dpc [-?h] [expression]     - Dump DPC or all DPCs
    ethread [-?h] [expression] - Display ETHREAD structure
    kthread [-?h] [expression] - Display KTHREAD structure
    idt [-?h] [processornumber [interruptnumber]]
                               - Dump information about IDT and handlers
    kqueue [-?h] [expression]  - Display queue of worker thread
    [single]list [-?h] <expression> [count] [structname[.listnodemembername]]
                               - Chain display of LIST_ENTRY and SINGLE_LIST_ENTRY
    smb [-?hd] <expression>    - Display SMB structure from header
    strct [-?h] <structname/"load"/"unload"> [fieldname] [expression]
                               - Display member offset and structure data
    xpool [-?h] [address] | [modulename[tag][-flag]]
          -fill modulename
          -log [[recent] [modulename] | [address]]
          -map [flag]
                               - Dump information about managed pool blocks
    lastlivetime               - Display the last time of system activity
    stack                      - Do stack trace for specified thread
    s [-?h] [StartAddress] [EndAddress | [l Size]] [Value]
                               - Pattern search.
    ip [-?h] [Address]         - Display IPPacket information.


    疑~ 有 IDT 指令耶, 很好奇它能让我们知道哪些资讯吧

    记的在使用这些 Extension Command 时前面要加个惊叹号 "!" 来开头唷

    而 WinDBG 的内建指令 (Meta-Command) 要加上句号 "." 来开头, 也有人称它为点符号


    如有错误,请各位大侠帮忙指正一下, thx
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Windbg是一款用于Windows调试的工具,可以用来分析dmp文件。以下是使用Windbg的教程: 1. 下载Windbg:你可以从Windows 10 SDK中下载Windbg,或者在已安装Windows 10 SDK的情况下,在控制面板的程序中选择安装Debugging Tools For Windows。 2. 准备dmp文件:你可以通过使用Windows管理器的"创建转储文件"功能来生成dmp文件,或者使用Windbg附加到进程的方式,在程序运行到出错位置后生成dmp文件。 3. 打开dmp文件:你可以使用Windbg或者Visual Studio来打开dmp文件进行分析。如果是通过"创建转储文件"生成的dmp文件,可以使用Windbg或者Visual Studio打开。如果是通过Windbg附加到进程后生成的dmp文件,可以使用Windbg打开。 4. 分析dmp文件:使用Windbg打开dmp文件后,你可以使用各种Windbg命令来分析和调试程序。你可以参考相关的参考文章和教程来学习如何使用Windbg进行调试。 需要注意的是,使用Visual Studio打开通过Windbg附加到进程生成的dmp文件时可能会提示版本过旧无法打开。这是因为Visual Studio和Windbg使用的调试引擎不同。在这种情况下,建议使用Windbg来分析dmp文件。 希望这个教程对你有帮助! #### 引用[.reference_title] - *1* *2* *3* [windbg使用教程(调试异常及死锁等)](https://blog.csdn.net/baidu_38621657/article/details/110942007)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值