From: VM on
Hello all.

I am a newbie working with the KbFiltr sample provided with the
Windows Server 2003 ver 3790.1830 on Windows XP SP3.

What I would like to know is what does the third parameter
(InputDataEnd) do ? I have tried printing the InputDataEnd->MakeCode
member variable but it always prints out to 0 no matter which key or
key combinations are pressed. Also I would like to know what does
InputDataConsumed does it remove the scancode from the queue ?

VOID KbFilter_ServiceCallback
(
IN PDEVICE_OBJECT DeviceObject,
IN PKEYBOARD_INPUT_DATA InputDataStart,
IN PKEYBOARD_INPUT_DATA InputDataEnd,
IN OUT PULONG InputDataConsumed
)
/*++

Routine Description:

Called when there are keyboard packets to report to the RIT. You
can do
anything you like to the packets. For instance:

o Drop a packet altogether
o Mutate the contents of a packet
o Insert packets into the stream

Arguments:

DeviceObject - Context passed during the connect IOCTL

InputDataStart - First packet to be reported

InputDataEnd - One past the last packet to be reported. Total
number of
packets is equal to InputDataEnd - InputDataStart

InputDataConsumed - Set to the total number of packets consumed by
the RIT
(via the function pointer we replaced in the
connect
IOCTL)

Return Value:

Status is returned.

--*/
{
PDEVICE_EXTENSION devExt;
}
devExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

(*(PSERVICE_CALLBACK_ROUTINE) devExt->UpperConnectData.ClassService)(
devExt->UpperConnectData.ClassDeviceObject,
InputDataStart,
InputDataEnd,
InputDataConsumed);
}
From: Maxim S. Shatskih on
> What I would like to know is what does the third parameter
> (InputDataEnd) do ?

Your filter is provided with the array of the "input data" structures, InputDataEnd is the end of this array.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com

From: Doron Holan [MSFT] on
InputDataEnd is one past the the end of the array, this lets you use pointer
math to loop over the entries. for instance

KEYBOARD_INPUT_DATA data[3].
<fill in data with valid info>

KbFilter_ServiceCallback(devobj, &data[0], &data[3], ...);

so you can write a loop like this

while (InputDataStart < InputDataEnd) {
// do something
InputDataStart++;
}

setting InputDataConsumed tells the caller who invoked your callback how
many KEYBOARD_INPUT_DATAs were consumed by the call so that the caller can
then reuse that memory if needed

d

--

This posting is provided "AS IS" with no warranties, and confers no rights.


"VM" <eh936(a)hotmail.com> wrote in message
news:d34fc3f0-7180-4fcc-9d31-e67b2af0ae88(a)19g2000yqu.googlegroups.com...
> Hello all.
>
> I am a newbie working with the KbFiltr sample provided with the
> Windows Server 2003 ver 3790.1830 on Windows XP SP3.
>
> What I would like to know is what does the third parameter
> (InputDataEnd) do ? I have tried printing the InputDataEnd->MakeCode
> member variable but it always prints out to 0 no matter which key or
> key combinations are pressed. Also I would like to know what does
> InputDataConsumed does it remove the scancode from the queue ?
>
> VOID KbFilter_ServiceCallback
> (
> IN PDEVICE_OBJECT DeviceObject,
> IN PKEYBOARD_INPUT_DATA InputDataStart,
> IN PKEYBOARD_INPUT_DATA InputDataEnd,
> IN OUT PULONG InputDataConsumed
> )
> /*++
>
> Routine Description:
>
> Called when there are keyboard packets to report to the RIT. You
> can do
> anything you like to the packets. For instance:
>
> o Drop a packet altogether
> o Mutate the contents of a packet
> o Insert packets into the stream
>
> Arguments:
>
> DeviceObject - Context passed during the connect IOCTL
>
> InputDataStart - First packet to be reported
>
> InputDataEnd - One past the last packet to be reported. Total
> number of
> packets is equal to InputDataEnd - InputDataStart
>
> InputDataConsumed - Set to the total number of packets consumed by
> the RIT
> (via the function pointer we replaced in the
> connect
> IOCTL)
>
> Return Value:
>
> Status is returned.
>
> --*/
> {
> PDEVICE_EXTENSION devExt;
> }
> devExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
>
> (*(PSERVICE_CALLBACK_ROUTINE) devExt->UpperConnectData.ClassService)(
> devExt->UpperConnectData.ClassDeviceObject,
> InputDataStart,
> InputDataEnd,
> InputDataConsumed);
> }

From: Victor43 on


"Maxim S. Shatskih" wrote:

> > What I would like to know is what does the third parameter
> > (InputDataEnd) do ?
>
> Your filter is provided with the array of the "input data" structures, InputDataEnd is the end of this array.
>
> --
> Maxim S. Shatskih
> Windows DDK MVP
> maxim(a)storagecraft.com
> http://www.storagecraft.com
>
> .
>
Thanks Maxim for the reply. I do have some questions about this same issue.
You said that my filter driver is provided with an array of input data ? How
do locate the size of the input data array ?Secondly how do I access each
scan code from these array of data. What does InputDataConsumed do ? If you
were to set this variable to 0 does that mean no key codes will be passed
onto the next filter driver in the device stack ?
From: Victor43 on


"Doron Holan [MSFT]" wrote:

> InputDataEnd is one past the the end of the array, this lets you use pointer
> math to loop over the entries. for instance
>
> KEYBOARD_INPUT_DATA data[3].
> <fill in data with valid info>
>
> KbFilter_ServiceCallback(devobj, &data[0], &data[3], ...);
>
> so you can write a loop like this
>
> while (InputDataStart < InputDataEnd) {
> // do something
> InputDataStart++;
> }
>
> setting InputDataConsumed tells the caller who invoked your callback how
> many KEYBOARD_INPUT_DATAs were consumed by the call so that the caller can
> then reuse that memory if needed
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "VM" <eh936(a)hotmail.com> wrote in message
> news:d34fc3f0-7180-4fcc-9d31-e67b2af0ae88(a)19g2000yqu.googlegroups.com...
> > Hello all.
> >
> > I am a newbie working with the KbFiltr sample provided with the
> > Windows Server 2003 ver 3790.1830 on Windows XP SP3.
> >
> > What I would like to know is what does the third parameter
> > (InputDataEnd) do ? I have tried printing the InputDataEnd->MakeCode
> > member variable but it always prints out to 0 no matter which key or
> > key combinations are pressed. Also I would like to know what does
> > InputDataConsumed does it remove the scancode from the queue ?
> >
> > VOID KbFilter_ServiceCallback
> > (
> > IN PDEVICE_OBJECT DeviceObject,
> > IN PKEYBOARD_INPUT_DATA InputDataStart,
> > IN PKEYBOARD_INPUT_DATA InputDataEnd,
> > IN OUT PULONG InputDataConsumed
> > )
> > /*++
> >
> > Routine Description:
> >
> > Called when there are keyboard packets to report to the RIT. You
> > can do
> > anything you like to the packets. For instance:
> >
> > o Drop a packet altogether
> > o Mutate the contents of a packet
> > o Insert packets into the stream
> >
> > Arguments:
> >
> > DeviceObject - Context passed during the connect IOCTL
> >
> > InputDataStart - First packet to be reported
> >
> > InputDataEnd - One past the last packet to be reported. Total
> > number of
> > packets is equal to InputDataEnd - InputDataStart
> >
> > InputDataConsumed - Set to the total number of packets consumed by
> > the RIT
> > (via the function pointer we replaced in the
> > connect
> > IOCTL)
> >
> > Return Value:
> >
> > Status is returned.
> >
> > --*/
> > {
> > PDEVICE_EXTENSION devExt;
> > }
> > devExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
> >
> > (*(PSERVICE_CALLBACK_ROUTINE) devExt->UpperConnectData.ClassService)(
> > devExt->UpperConnectData.ClassDeviceObject,
> > InputDataStart,
> > InputDataEnd,
> > InputDataConsumed);
> > }
>
> .
>
Doron many thanks to you reply.

Its starting to make more sense now. Appreciate the reply. Victor.