Tech Support > Microsoft Windows > Drivers > Raw Keyboard Input
Raw Keyboard Input
Posted by Asa Yeamans on September 20th, 2003


Is their *any* way at all using ONLY Function calls in
NTDLL.DLL, documented or undocumented, to read keyboard
input.

I was thinking along the lines of:
RtlInitUnicodeString
(&ustrFileName,L"\\Device\\KeyboardClass0");
InitializeObjectAttributes(&oa, &ustrFileName,
OBJ_CASE_INSENSITIVE, NULL, NULL);

ntStatus = NtCreateFile(&hKeyboard, GENERIC_READ,
&oa, &iosb, 0, FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN,
FILE_DIRECTORY_FILE, NULL, 0);

to obtain a handle to the keyboard, then:
ntStatus = NtReadFile(hKeyboard, 0, NULL, NULL, &iosb,
buf, bufLen, 0, NULL);

to read the events from the keyboard driver, however when
i do this, all i get is STATUS_INVALID_PARAMETER. Can
anyone help me???

thanks
asa yeamans

Posted by marian on September 20th, 2003


Hi asa yeamans,

KbdClass driver creates device objects named
\\Device\\KeyboardClassX, (X = 0, 1, ...) but it doesn't
create symbolic link for these objects.

You must update Upper Keyboard Driver Filter located in
DDK: src\input\KbFiltr using Microsoft Knowledge Base
Article - 262305 "HOWTO: Send IOCTLs to a Filter Driver".
Then you may communicate with Upper Keyboard Driver Filter
through Control Device Object and Upper Keyboard Driver
Filter may control i8042 and KbdClass Driver.

Good Luck.


Posted by Doron Holan [MS] on September 20th, 2003


even if you were successful in opening the device, you can't open it for
read access. kbdclass only allows one reader (the raw input thread) for its
data. you should install an upper keyboard filter driver, see the kbdfiltr
example in the ddk.

d

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Asa Yeamans" <enigma2e@rivin.net> wrote in message
news:081001c37f14$5abb8ca0$a401280a@phx.gbl...



Similar Posts