Another Newbie problem…
I am trying to call device driver for the keyboard from my kernel mode
driver. In my kernel mode driver, i was just rying to query for
KEYBOARD_ATTRIBUTES… I followed the following procedure
PDEVICE_OBJECT pKbdDeviceObject = NULL;
PKEYBOARD_ATTRIBUTES pKeyBoardAttribs;
RtlInitUnicodeString(&uszDeviceName, L"\DosDevices\KeyboardClass0");
nStatus = IoGetDeviceObjectPointer(
&uszDeviceName,
FILE_READ_ATTRIBUTES,
&fileObject,
&pKbdDeviceObject
);
irp = IoBuildDeviceIoControlRequest
(
IOCTL_KEYBOARD_QUERY_ATTRIBUTES,
pKbdDeviceObject,
&pKeyBoardAttribs,
sizeof(PKEYBOARD_ATTRIBUTES),
&pKeyBoardAttribs,
sizeof (PKEYBOARD_ATTRIBUTES),
FALSE,
&event,
&ioStatusBlock
);
istatus = IoCallDriver(
pKbdDeviceObject,
irp
);
The call fails at IoCallDriver function.
Is this the right approach to call the keyboard driver? Is the hard coded
value of KeyboardClass0 for device name correct. USing WinObj i picked up
this name from Device node.
Could someone please help me in finding the problem?
Thanks!
Naveen
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi Naveen,
The buffers length of output buffer of IRP should be
sizeof(KEYBOARD_ATTRIBUTES) and not sizeof(PKEYBOARD_ATTRIBUTES).
Also would be useful if you could also give the error code found (In this
case I guess it is STATUS_BUFFER_TOO_SMALL)
Regards
Jeseem
mailto:xxxxx@hotmail.com
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Monday, April 09, 2001 6:27 PM
Subject: [ntdev] How to call Keyboard device driver from another Kernel Mode
Driver
> Another Newbie problem…
> I am trying to call device driver for the keyboard from my kernel mode
> driver. In my kernel mode driver, i was just rying to query for
> KEYBOARD_ATTRIBUTES… I followed the following procedure
>
> PDEVICE_OBJECT pKbdDeviceObject = NULL;
> PKEYBOARD_ATTRIBUTES pKeyBoardAttribs;
>
> RtlInitUnicodeString(&uszDeviceName, L"\DosDevices\KeyboardClass0");
>
> nStatus = IoGetDeviceObjectPointer(
> &uszDeviceName,
> FILE_READ_ATTRIBUTES,
> &fileObject,
> &pKbdDeviceObject
> );
>
> irp = IoBuildDeviceIoControlRequest
> (
> IOCTL_KEYBOARD_QUERY_ATTRIBUTES,
> pKbdDeviceObject,
> &pKeyBoardAttribs,
> sizeof(PKEYBOARD_ATTRIBUTES),
> &pKeyBoardAttribs,
> sizeof (PKEYBOARD_ATTRIBUTES),
> FALSE,
> &event,
> &ioStatusBlock
> );
>
> istatus = IoCallDriver(
> pKbdDeviceObject,
> irp
> );
>
> The call fails at IoCallDriver function.
>
> Is this the right approach to call the keyboard driver? Is the hard coded
> value of KeyboardClass0 for device name correct. USing WinObj i picked up
> this name from Device node.
>
> Could someone please help me in finding the problem?
>
> Thanks!
> Naveen
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com