Allows a virtual device to monitor keyboard input and either modify or reject keyboard keystrokes. To monitor keyboard input, a virtual device must hook this service. The virtual device sets the carry flag to reject a keystroke , or clears the carry flag to continue processing the keystroke. Uses Flags.
Returns the scan code of the keystroke in CL, if if the carry flag is clear.
代码示例:
1. hook:
BeginProc HookKeyboardFilter
cmp _hKbdHook, 0
jne @F ; already installed
mov eax, @@VKD_Filter_Keyboard_Input
mov esi, OFFSET32 KbdHookProc ; Your hook procedure VMMcall Hook_Device_Service
jc @F
mov [_hKbdHook], esi
@@: ret
EndProc HookKeyboardFilter
2. hook procedure:
BeginProc KbdHookProc, PUBLIC, HIGH_FREQ, HOOK_PROC, _hKbdHook, LOCKED
; your own code here
; STC for reject
; CLC for accept
jmp [_hKbdHook]
EndProc KbdHookProc