天天看點

在 WinDbg 腳本中使用參數

WinDbg 6.7.5.0 版本運作腳本時多了一個新的指令 <b>$$&gt;a&lt;</b>,可以給腳本傳遞參數。下面是一個簡單的例子,示範了參數的用法。

$$

$$ calc v0.0.1

$$ by 2007.06.08

.if(@@c++(${/d:$arg1} &amp;&amp; ${/d:$arg2}))

{

    .printf "/n%d + %d = %d/n", ${$arg1}, ${$arg2}, ${$arg1} + ${$arg2}

    .printf "%d - %d = %d/n", ${$arg1}, ${$arg2}, ${$arg1} - ${$arg2}

    .printf "%d * %d = %d/n", ${$arg1}, ${$arg2}, ${$arg1} * ${$arg2}

    .printf "%d / %d = %d/n", ${$arg1}, ${$arg2}, ${$arg1} / ${$arg2}

}

.else

    .printf "/nusage: $$&gt;a&lt; &lt;path&gt;/calc.txt arg1 arg2/n/n"

運作一下:

0:000&gt; <b>$$&gt;a&lt; d:/windbg/scripts/calc.txt @eax 4</b>

1580724 + 4 = 1580728

1580724 - 4 = 1580720

1580724 * 4 = 6322896

1580724 / 4 = 395181

幾個腳本

http://blogs.msdn.com/debuggingtoolbox/default.aspx

rootkit 的 blog 

http://www.rootkit.com/blog.php?user=buri

繼續閱讀