Windows Driver Model

ProbeForRead()、ProbeForWrite()


最近Lucas、Spencer同事實在是太假認真了,司徒不得不在此分享這一篇文章,說明一下ProbeForRead()的一些錯誤用法,如果使用者認為這個API是用來偵測User Mode Memory是否可以讀取時,那你就需要繼續看下去。

首先看一下WinXP(x86) ntoskrnl.exe的逆向程式:

答案很明顯,ProbeForRead()是用來判斷Memory是否位於User Mode或者Kernel Mode位址,並非用來測試User Mode Memory是否可以被讀取。

Win7(x86) ntoskrnl.exe的逆向程式:

基本上,還是一樣用來偵測Memory是否位於Kernel Mode位址。

反觀ProbeForWrite(),它的用法就是用來偵測該User Mode Memory是否可以被寫入,如下WinXP(x86)逆向程式:


結論就是,微軟的API名字相當深奧,請仔細閱讀MSDN說明檔案,不要以API名字判斷它的用法。
ProbeForRead()
The ProbeForRead routine checks that a user-mode buffer actually resides in the user portion of the address space, and is correctly aligned.

ProbeForWrite()
The ProbeForWrite routine checks that a user-mode buffer actually resides in the user-mode portion of the address space, is writable, and is correctly aligned.


返回上一頁