问题
HHOOK WINAPI SetWindowsHookEx(
_In_ int idHook,
_In_ HOOKPROC lpfn,
_In_ HINSTANCE hMod,
_In_ DWORD dwThreadId
);
On MSDN listed available idHook values, there are:
- WH_CALLWNDPROC
- WH_CALLWNDPROCRET
- WH_CBT WH_DEBUG
- WH_FOREGROUNDIDLE
- WH_GETMESSAGE
- WH_JOURNALPLAYBACK
- WH_JOURNALRECORD
- WH_KEYBOARD
- WH_KEYBOARD_LL
- WH_MOUSE
- WH_MOUSE_LL
- WH_MSGFILTER
- WH_SHELL
- WH_SYSMSGFILTER
So, what idHook should be used for hook DeviceIOControl function (for console application)? Or may i'd use some other hook method?
回答1:
DeviceIOControl
is for interacting with drivers, and non of the hooks windows provides in user mode allow hooking driver interaction, instead you best best would be to write a filter using the windows DDK/WDK/Windows SDK (depending what windows version you are targeting).
来源:https://stackoverflow.com/questions/12278529/setwindowshookex-for-deviceiocontrol-what-hookid-to-be-used