Re: How to call Keyboard device driver from another K- ernel Mode Driver

Thanks Jojan & Jeseem…
Size of the buffer was the problem. I did not realize that i was passing
junk pointers :slight_smile:

IS there an API like GetLastError that i frequently use in PlatformSDK or a
function like FormatMessage to get the exact description of error?

Naveen

-----Original Message-----
From: JOJAN [mailto:xxxxx@nestec.net]
Sent: Tuesday, April 10, 2001 7:46 AM
To: NT Developers Interest List
Subject: [ntdev] Re: How to call Keyboard device driver from another K
ernel Mode Driver

PKEYBOARD_ATTRIBUTES pKeyBoardAttribs;

This is a junk pointer. Should use

KEYBOARD_ATTRIBUTES KeyBoardAttribs and pass the address of KeyBoardAttribs
to IoBuildDeviceIoControlRequest.

jojan

NeST,
Technopark,
Trivandrum

-----Original Message-----
From: Jeseem S [mailto:xxxxx@hotmail.com]
Sent: Tuesday, April 10, 2001 2:08 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to call Keyboard device driver from another
Kernel Mode Driver

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: xxxxx@nestec.net
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@pumatech.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