windows - How to obtain the handle to keyboard device? -
i trying hook keyboard isr, can't open device because createfile
returns 0000007bh error_invalid_name
. have done incorrectly?
invoke definedosdevice,[raw],filename1,devicename lea rcx,[filename2] invoke createfilea,rcx,generic_all,file_share_write or file_share_read,0,3,0,0 ret section '.data' data writeable readable devicename db '\\device\\keyboardclass0',0 filename1 db 'keyboard',0 filename2 db '\\.\keyboard',0 raw dq 1
this flat assembler syntax, should pass devicename
without escaping slashes:
devicename db '\device\keyboardclass0',0
there's tutorial source code in c how access keyboard device in windows. might find interesting.
translating assembly, you'll want like
include 'include\win64ax.inc' .code start: invoke definedosdevice, 1, kbdfilename, kbddevicename mov rcx, kbdpath invoke createfile, rcx, generic_write, 0, 0, open_existing, 0, 0 mov [hkbd], rax ;. . . invoke exitprocess, 0 .end start .data kbddevicename db '\device\keyboardclass0',0 kbdfilename db 'kbd',0 kbdpath db '\\.\kbd',0 hkbd dq ?
Comments
Post a Comment