一. 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] [count] [structname[.listnodemembername]]
- chain display of list_entry and single_list_entry
smb [-?hd] - display smb structure from header
strct [-?h] [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
windbg使用技巧
dt v dms server datarow 376c4b58 8 轉存出資料結構 dt s 4c n dms server 查詢結構體大小 回答本文標題中的問題,步驟如下 第一步,開啟日誌記錄 logopen d output.txt 第二步,執行你想要輸出到文字檔案中的命令 第三步,關閉日誌記...
windbg使用技巧
一 64位系統下分析32位程式 windbg版本 跟windbg的版本無關 32位 or 64位 崩潰程式 32位 system型別 64位 此時需要轉到x86模式下,命令如下 1 load wow64exts 2 sw 二 自動分析命令 analyze v 三 symbol path 作業系統 四...
WinDbg使用基礎
啟動windbg後發現以一般的軟體並沒有什麼差別,選單工具欄,客戶區,狀態列都有,估計作用也差不多 為了學習windbg,讓整個過程盡量可控,我們自己編寫被除錯程式 生成release版本的exe檔案,為模擬一般情況下的除錯我們將exe檔案拷貝到乙個單獨的路徑上。通過windbg的file open...