From: Mike Carlisle on
Hi,

I'm new to driver development, and having some problems. I wrote my first
driver using the ddk and by following the sysinternals ctrl2cap example.

I'm now trying to figure out how to wire up the kmdf\kbFiltr example to call
the KbFilter_ServiceCallback method so I see some prints in the debuger, and
then port my own code.

I figure I need to add this in the DriverEntry method like in the Ctrl2Cap
example on the ddk framework?

Is this the right thinking? And if so what's the equivilent of the following
in the kmdf?

DriverObject->MajorFunction[IRP_MJ_READ] = Filter_DispatchRead;

I could really do with Ctrl2Cap for the kmdf, as the kbfiltr by itself
doesn't really help as nothing appears to be wired in.

Thanks,

Mike
From: Mike Carlisle on
Ok finally got this working, maybe this will help someone else, hopefully it
won't confuse them more.

The DDk example of kbfiltr doesn't work on vista, if you install it your
keybaord stops functioning.

It's actually very easy to port Ctrl2Cap to kmdf, the trick is the install
process.
when CtrlToCap writes it's UpperFilters key to the registry in appends the
driver name, however in the kbfiltr example it needs to prepend the name
before kbdclass. Soon as you do this and reboot you find
KbFilter_ServiceCallback is called.

You can then filter the keys as in the ctrl2cap example in a slightly neater
way. Enum the keys as follows:

for (i = 0; i < (ULONG)(InputDataEnd-InputDataStart); i++)
{
if (InputDataEnd[i].MakeCode == CAPS_LOCK)
{
InputDataEnd[i].MakeCode = LCONTROL;
}
}

I haven't yet managed to install with the Inf file, seems to fail for me, I
need to learn more about this.

The cool thing about using kmdf kbfiltr example is the kbdtest sample that
goes with it and shows how to interface with your driver from a seperate app.
I'll be getting stuck on this next.

"Mike Carlisle" wrote:

> Hi,
>
> I'm new to driver development, and having some problems. I wrote my first
> driver using the ddk and by following the sysinternals ctrl2cap example.
>
> I'm now trying to figure out how to wire up the kmdf\kbFiltr example to call
> the KbFilter_ServiceCallback method so I see some prints in the debuger, and
> then port my own code.
>
> I figure I need to add this in the DriverEntry method like in the Ctrl2Cap
> example on the ddk framework?
>
> Is this the right thinking? And if so what's the equivilent of the following
> in the kmdf?
>
> DriverObject->MajorFunction[IRP_MJ_READ] = Filter_DispatchRead;
>
> I could really do with Ctrl2Cap for the kmdf, as the kbfiltr by itself
> doesn't really help as nothing appears to be wired in.
>
> Thanks,
>
> Mike
From: Doron Holan [MS] on
the kmdf kbfiltr example does work on vista. how did you install it?

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Mike Carlisle" <MikeCarlisle(a)discussions.microsoft.com> wrote in message
news:D49EB8E8-4C63-4C7E-8AE1-9DF4B277C219(a)microsoft.com...
> Ok finally got this working, maybe this will help someone else, hopefully
> it
> won't confuse them more.
>
> The DDk example of kbfiltr doesn't work on vista, if you install it your
> keybaord stops functioning.
>
> It's actually very easy to port Ctrl2Cap to kmdf, the trick is the install
> process.
> when CtrlToCap writes it's UpperFilters key to the registry in appends the
> driver name, however in the kbfiltr example it needs to prepend the name
> before kbdclass. Soon as you do this and reboot you find
> KbFilter_ServiceCallback is called.
>
> You can then filter the keys as in the ctrl2cap example in a slightly
> neater
> way. Enum the keys as follows:
>
> for (i = 0; i < (ULONG)(InputDataEnd-InputDataStart); i++)
> {
> if (InputDataEnd[i].MakeCode == CAPS_LOCK)
> {
> InputDataEnd[i].MakeCode = LCONTROL;
> }
> }
>
> I haven't yet managed to install with the Inf file, seems to fail for me,
> I
> need to learn more about this.
>
> The cool thing about using kmdf kbfiltr example is the kbdtest sample that
> goes with it and shows how to interface with your driver from a seperate
> app.
> I'll be getting stuck on this next.
>
> "Mike Carlisle" wrote:
>
>> Hi,
>>
>> I'm new to driver development, and having some problems. I wrote my first
>> driver using the ddk and by following the sysinternals ctrl2cap example.
>>
>> I'm now trying to figure out how to wire up the kmdf\kbFiltr example to
>> call
>> the KbFilter_ServiceCallback method so I see some prints in the debuger,
>> and
>> then port my own code.
>>
>> I figure I need to add this in the DriverEntry method like in the
>> Ctrl2Cap
>> example on the ddk framework?
>>
>> Is this the right thinking? And if so what's the equivilent of the
>> following
>> in the kmdf?
>>
>> DriverObject->MajorFunction[IRP_MJ_READ] = Filter_DispatchRead;
>>
>> I could really do with Ctrl2Cap for the kmdf, as the kbfiltr by itself
>> doesn't really help as nothing appears to be wired in.
>>
>> Thanks,
>>
>> Mike


From: Mike Carlisle on
Hi Doron,

Thanks for your help. I tried installing the ddk version via device manager,
and by right clicking on the inf file and selecting install. I also tried
adding the registry keys manually following the ctrl2cap example.

I found when I eventually installed it, the keyboard stopped working
altogether and locked me out of the pc. I had to use the onscreen keyboard to
get back in.

The only version I could get working was the kmdf version which again was
only by setting the keys manually, and by prepending the registry
upperfilters key before kbdclass (unlike ctrl2cap which is inserted after).
This took me ages to figure out.

I was wondering if the problems are because I need to sign the driver with a
cat file before I can install via the inf. This side of things is still a
little confusing to me, as to how I get the cat file, and what steps to go
through to use this for either dev or release. For now it seems easier to use
a custom installer, but I was intending to read up on this at some point.

Thanks,

Mike

"Doron Holan [MS]" wrote:

> the kmdf kbfiltr example does work on vista. how did you install it?
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Mike Carlisle" <MikeCarlisle(a)discussions.microsoft.com> wrote in message
> news:D49EB8E8-4C63-4C7E-8AE1-9DF4B277C219(a)microsoft.com...
> > Ok finally got this working, maybe this will help someone else, hopefully
> > it
> > won't confuse them more.
> >
> > The DDk example of kbfiltr doesn't work on vista, if you install it your
> > keybaord stops functioning.
> >
> > It's actually very easy to port Ctrl2Cap to kmdf, the trick is the install
> > process.
> > when CtrlToCap writes it's UpperFilters key to the registry in appends the
> > driver name, however in the kbfiltr example it needs to prepend the name
> > before kbdclass. Soon as you do this and reboot you find
> > KbFilter_ServiceCallback is called.
> >
> > You can then filter the keys as in the ctrl2cap example in a slightly
> > neater
> > way. Enum the keys as follows:
> >
> > for (i = 0; i < (ULONG)(InputDataEnd-InputDataStart); i++)
> > {
> > if (InputDataEnd[i].MakeCode == CAPS_LOCK)
> > {
> > InputDataEnd[i].MakeCode = LCONTROL;
> > }
> > }
> >
> > I haven't yet managed to install with the Inf file, seems to fail for me,
> > I
> > need to learn more about this.
> >
> > The cool thing about using kmdf kbfiltr example is the kbdtest sample that
> > goes with it and shows how to interface with your driver from a seperate
> > app.
> > I'll be getting stuck on this next.
> >
> > "Mike Carlisle" wrote:
> >
> >> Hi,
> >>
> >> I'm new to driver development, and having some problems. I wrote my first
> >> driver using the ddk and by following the sysinternals ctrl2cap example.
> >>
> >> I'm now trying to figure out how to wire up the kmdf\kbFiltr example to
> >> call
> >> the KbFilter_ServiceCallback method so I see some prints in the debuger,
> >> and
> >> then port my own code.
> >>
> >> I figure I need to add this in the DriverEntry method like in the
> >> Ctrl2Cap
> >> example on the ddk framework?
> >>
> >> Is this the right thinking? And if so what's the equivilent of the
> >> following
> >> in the kmdf?
> >>
> >> DriverObject->MajorFunction[IRP_MJ_READ] = Filter_DispatchRead;
> >>
> >> I could really do with Ctrl2Cap for the kmdf, as the kbfiltr by itself
> >> doesn't really help as nothing appears to be wired in.
> >>
> >> Thanks,
> >>
> >> Mike
>
>
>
From: Eliyas Yakub [MSFT] on
Ctrlcap filter is installed as a class filter. This filter was originally
written for NT4.0 by sysinternals and ported to Win2K. This filter doesn't
work well in scenarios - terminal server, SMS, etc, and I would strongly
discourage you from using this filter. This filter sits above the kbdclass
filter driver.

The filter driver present in the WDK (both WDF and WDM versions) is a device
filter. This filter is intended to filter just PS/2 device. It sits
between the kbdclass and i8042prt driver. You install such a filter a full
fledged pnp device INF. You cannot install a device filter by right
clicking on the INF file. The information about device filters is added to
the device enum key as opposed to class key for class filters. The sample
contains an INF that shows how to install this filter.

If you want your filter driver to filter all device types (USB, PS2, etc)
then you can install this filter as class filter using the install app
provided with the ctrlcap but as you figured out by prepending your filter
service before the kdbclass. That way your filter sits below the kbdclass
filter.

-Eliyas