AddFilter DDK sample

I have a filter driver that acts as either an Upper or Lower Device Filter
for a storage class driver (tape, cdrom, changer, etc.). In fact, the
filter driver is almost identical to that found in the Toaster driver
framework in the Windows Server 2003 DDK. I was able to install it as an
Upper or Lower Device Filter by modifying the INF file for my device’s class
driver in the same way as that shown in the Toaster framework. It works
great. The driver starts, handles PnP, and does all the good stuff that it
should do. Again, just to reiterate, the source code for this driver is
almost identical to the Toaster filter driver sample in the Windows Server
2003 DDK, with the minor exception that I just added a new DbgPrint
statement so that I could see what SCSI commands were coming down through
the driver.

My question has to do with the AddFilter sample in the DDK. The
documentation says that this sample shows how to add filter drivers, but it
does not seem to work for me. I tried using it, and I did the right thing
by first modifying the list of Class GUIDs to include my device class. When
I run it, the registry gets modified to reflect that a filter is indeed
installed (OSR FilterMan shows the filter is installed), but the filter
driver and/or class driver does not start. A yellow exclamation point
appears next to the device in the Device Manager, and it says that the
device is not started.

Does anyone know how to use the AddFilter sample in the DDK in order to get
it to successfully add and start a filter driver?

Thanks,

Don

What’s the numeric code of the yellow bang? Does the
driverentry get call when you restart the stack?


Calvin Guan Windows DDK MVP
Staff SW Engineer, NetXtreme MINIPORT
Enterprise Network Controller Engineering
Broadcom Corporation www.broadcom.com

— Don Matthews wrote:

>
>
> I have a filter driver that acts as either an Upper
> or Lower Device Filter
> for a storage class driver (tape, cdrom, changer,
> etc.). In fact, the
> filter driver is almost identical to that found in
> the Toaster driver
> framework in the Windows Server 2003 DDK. I was
> able to install it as an
> Upper or Lower Device Filter by modifying the INF
> file for my device’s class
> driver in the same way as that shown in the Toaster
> framework. It works
> great. The driver starts, handles PnP, and does all
> the good stuff that it
> should do. Again, just to reiterate, the source
> code for this driver is
> almost identical to the Toaster filter driver sample
> in the Windows Server
> 2003 DDK, with the minor exception that I just added
> a new DbgPrint
> statement so that I could see what SCSI commands
> were coming down through
> the driver.
>
>
>
> My question has to do with the AddFilter sample in
> the DDK. The
> documentation says that this sample shows how to add
> filter drivers, but it
> does not seem to work for me. I tried using it, and
> I did the right thing
> by first modifying the list of Class GUIDs to
> include my device class. When
> I run it, the registry gets modified to reflect that
> a filter is indeed
> installed (OSR FilterMan shows the filter is
> installed), but the filter
> driver and/or class driver does not start. A yellow
> exclamation point
> appears next to the device in the Device Manager,
> and it says that the
> device is not started.
>
>
>
>
> Does anyone know how to use the AddFilter sample in
> the DDK in order to get
> it to successfully add and start a filter driver?
>
>
>
> Thanks,
>
> Don
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.ca
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

The message reads:

“The device is not working properly because Windows cannot load
the drivers required for the device. (Code 31)”

As for whether the DriverEntry routine gets called, the answer is no, but an
artifact of AddFilter is that you must restart the system after adding a filter.
And since at this time I am only using OSR DebugMon to monitor debug
statements, not WinDbg, I cannot tell for sure if the filter’s DriverEntry is
being called during the re-boot. I’m pretty sure it is not. When the system
re-boots, the result in Device Manager is the same. Yellow bang with the
same message as above.

I’ve looked at the source for AddFilter, and the main thing it does here is
to call SetupDiSetDeviceRegistryProperty(). Is that all it needs to do?
I have placed my filter in the system32\drivers directory, so the system
should be able to find it. Yet it acts like it can’t find the driver.

Any other ideas? Has anyone actually used the AddFilter utility? Maybe
I’m just not using it right. I’ve tried both of the following, although I think
the first one is the correct syntax.

AddFilter /add FilterName
AddFilter /add FilterName.sys

Thanks,
Don

“Calvin Guan” wrote in message news:xxxxx@ntdev…
> What’s the numeric code of the yellow bang? Does the
> driverentry get call when you restart the stack?
>
> -----------------------------------------
> Calvin Guan Windows DDK MVP
> Staff SW Engineer, NetXtreme MINIPORT
> Enterprise Network Controller Engineering
> Broadcom Corporation www.broadcom.com
>
>
> — Don Matthews wrote:
>
> >
> >
> > I have a filter driver that acts as either an Upper
> > or Lower Device Filter
> > for a storage class driver (tape, cdrom, changer,
> > etc.). In fact, the
> > filter driver is almost identical to that found in
> > the Toaster driver
> > framework in the Windows Server 2003 DDK. I was
> > able to install it as an
> > Upper or Lower Device Filter by modifying the INF
> > file for my device’s class
> > driver in the same way as that shown in the Toaster
> > framework. It works
> > great. The driver starts, handles PnP, and does all
> > the good stuff that it
> > should do. Again, just to reiterate, the source
> > code for this driver is
> > almost identical to the Toaster filter driver sample
> > in the Windows Server
> > 2003 DDK, with the minor exception that I just added
> > a new DbgPrint
> > statement so that I could see what SCSI commands
> > were coming down through
> > the driver.
> >
> >
> >
> > My question has to do with the AddFilter sample in
> > the DDK. The
> > documentation says that this sample shows how to add
> > filter drivers, but it
> > does not seem to work for me. I tried using it, and
> > I did the right thing
> > by first modifying the list of Class GUIDs to
> > include my device class. When
> > I run it, the registry gets modified to reflect that
> > a filter is indeed
> > installed (OSR FilterMan shows the filter is
> > installed), but the filter
> > driver and/or class driver does not start. A yellow
> > exclamation point
> > appears next to the device in the Device Manager,
> > and it says that the
> > device is not started.
> >
> >
> >
> >
> > Does anyone know how to use the AddFilter sample in
> > the DDK in order to get
> > it to successfully add and start a filter driver?
> >
> >
> >
> > Thanks,
> >
> > Don
> >
> >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as:
> > xxxxx@yahoo.ca
> > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

It sounds like you didn’t register your driver under
HKLM\SYSTEM\CurrentControlSet\Services. You can use OSRLoader for that (or
simply call CreateService() from your installation utility).
BTW, you don’t have to restart your machine inorder to start testing your
driver, you can simply disable and enable one of the devices and your driver
will be loaded (you should only do that on a device that is not in use,
otherwise you will be requested to restart). One more point - filter drivers
are regularily registered and “demand” start drivers, but since your driver
is registered as disk class filter it must be already started when disk
devices are enumerated - you must make sure it starts before the “System Bus
Extender” group start, otherwise you get a bugcheck with code 7B during
boot.

Good luck,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Matthews
Sent: Sunday, June 05, 2005 6:07 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] AddFilter DDK sample

The message reads:

“The device is not working properly because Windows cannot load the drivers
required for the device. (Code 31)”

As for whether the DriverEntry routine gets called, the answer is no, but an
artifact of AddFilter is that you must restart the system after adding a
filter.
And since at this time I am only using OSR DebugMon to monitor debug
statements, not WinDbg, I cannot tell for sure if the filter’s DriverEntry
is being called during the re-boot. I’m pretty sure it is not. When the
system re-boots, the result in Device Manager is the same. Yellow bang with
the same message as above.

I’ve looked at the source for AddFilter, and the main thing it does here is
to call SetupDiSetDeviceRegistryProperty(). Is that all it needs to do?
I have placed my filter in the system32\drivers directory, so the system
should be able to find it. Yet it acts like it can’t find the driver.

Any other ideas? Has anyone actually used the AddFilter utility? Maybe I’m
just not using it right. I’ve tried both of the following, although I think
the first one is the correct syntax.

AddFilter /add FilterName
AddFilter /add FilterName.sys

Thanks,
Don

“Calvin Guan” wrote in message news:xxxxx@ntdev…
> What’s the numeric code of the yellow bang? Does the driverentry get
> call when you restart the stack?
>
> -----------------------------------------
> Calvin Guan Windows DDK MVP
> Staff SW Engineer, NetXtreme MINIPORT
> Enterprise Network Controller Engineering
> Broadcom Corporation www.broadcom.com
>
>
> — Don Matthews wrote:
>
> >
> >
> > I have a filter driver that acts as either an Upper or Lower Device
> > Filter for a storage class driver (tape, cdrom, changer, etc.). In
> > fact, the filter driver is almost identical to that found in the
> > Toaster driver framework in the Windows Server 2003 DDK. I was able
> > to install it as an Upper or Lower Device Filter by modifying the
> > INF file for my device’s class driver in the same way as that shown
> > in the Toaster framework. It works great. The driver starts,
> > handles PnP, and does all the good stuff that it should do. Again,
> > just to reiterate, the source code for this driver is almost
> > identical to the Toaster filter driver sample in the Windows Server
> > 2003 DDK, with the minor exception that I just added a new DbgPrint
> > statement so that I could see what SCSI commands were coming down
> > through the driver.
> >
> >
> >
> > My question has to do with the AddFilter sample in the DDK. The
> > documentation says that this sample shows how to add filter drivers,
> > but it does not seem to work for me. I tried using it, and I did
> > the right thing by first modifying the list of Class GUIDs to
> > include my device class. When I run it, the registry gets modified
> > to reflect that a filter is indeed installed (OSR FilterMan shows
> > the filter is installed), but the filter driver and/or class driver
> > does not start. A yellow exclamation point appears next to the
> > device in the Device Manager, and it says that the device is not
> > started.
> >
> >
> >
> >
> > Does anyone know how to use the AddFilter sample in the DDK in order
> > to get it to successfully add and start a filter driver?
> >
> >
> >
> > Thanks,
> >
> > Don
> >
> >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as:
> > xxxxx@yahoo.ca
> > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@safend.com To unsubscribe
send a blank email to xxxxx@lists.osr.com

Thank you. That did it for me. I was not registering my driver. I was under the mistaken impression
that AddFilter was a standalone program that was going to take care of the entire process of installing
a Filter Driver. I now see that it only handles part of the installation, that is, specifically the part related
to modifying the registry.

Thanks,
Don

“Shahar Talmi” wrote in message news:xxxxx@ntdev…
> It sounds like you didn’t register your driver under
> HKLM\SYSTEM\CurrentControlSet\Services. You can use OSRLoader for that (or
> simply call CreateService() from your installation utility).
> BTW, you don’t have to restart your machine inorder to start testing your
> driver, you can simply disable and enable one of the devices and your driver
> will be loaded (you should only do that on a device that is not in use,
> otherwise you will be requested to restart). One more point - filter drivers
> are regularily registered and “demand” start drivers, but since your driver
> is registered as disk class filter it must be already started when disk
> devices are enumerated - you must make sure it starts before the “System Bus
> Extender” group start, otherwise you get a bugcheck with code 7B during
> boot.
>
> Good luck,
> Shahar
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Don Matthews
> Sent: Sunday, June 05, 2005 6:07 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] AddFilter DDK sample
>
>
> The message reads:
>
> “The device is not working properly because Windows cannot load the drivers
> required for the device. (Code 31)”
>
> As for whether the DriverEntry routine gets called, the answer is no, but an
> artifact of AddFilter is that you must restart the system after adding a
> filter.
> And since at this time I am only using OSR DebugMon to monitor debug
> statements, not WinDbg, I cannot tell for sure if the filter’s DriverEntry
> is being called during the re-boot. I’m pretty sure it is not. When the
> system re-boots, the result in Device Manager is the same. Yellow bang with
> the same message as above.
>
> I’ve looked at the source for AddFilter, and the main thing it does here is
> to call SetupDiSetDeviceRegistryProperty(). Is that all it needs to do?
> I have placed my filter in the system32\drivers directory, so the system
> should be able to find it. Yet it acts like it can’t find the driver.
>
> Any other ideas? Has anyone actually used the AddFilter utility? Maybe I’m
> just not using it right. I’ve tried both of the following, although I think
> the first one is the correct syntax.
>
> AddFilter /add FilterName
> AddFilter /add FilterName.sys
>
> Thanks,
> Don
>
>
>
>
>
> “Calvin Guan” wrote in message news:xxxxx@ntdev…
>> What’s the numeric code of the yellow bang? Does the driverentry get
>> call when you restart the stack?
>>
>> -----------------------------------------
>> Calvin Guan Windows DDK MVP
>> Staff SW Engineer, NetXtreme MINIPORT
>> Enterprise Network Controller Engineering
>> Broadcom Corporation www.broadcom.com
>>
>>
>> — Don Matthews wrote:
>>
>> >
>> >
>> > I have a filter driver that acts as either an Upper or Lower Device
>> > Filter for a storage class driver (tape, cdrom, changer, etc.). In
>> > fact, the filter driver is almost identical to that found in the
>> > Toaster driver framework in the Windows Server 2003 DDK. I was able
>> > to install it as an Upper or Lower Device Filter by modifying the
>> > INF file for my device’s class driver in the same way as that shown
>> > in the Toaster framework. It works great. The driver starts,
>> > handles PnP, and does all the good stuff that it should do. Again,
>> > just to reiterate, the source code for this driver is almost
>> > identical to the Toaster filter driver sample in the Windows Server
>> > 2003 DDK, with the minor exception that I just added a new DbgPrint
>> > statement so that I could see what SCSI commands were coming down
>> > through the driver.
>> >
>> >
>> >
>> > My question has to do with the AddFilter sample in the DDK. The
>> > documentation says that this sample shows how to add filter drivers,
>> > but it does not seem to work for me. I tried using it, and I did
>> > the right thing by first modifying the list of Class GUIDs to
>> > include my device class. When I run it, the registry gets modified
>> > to reflect that a filter is indeed installed (OSR FilterMan shows
>> > the filter is installed), but the filter driver and/or class driver
>> > does not start. A yellow exclamation point appears next to the
>> > device in the Device Manager, and it says that the device is not
>> > started.
>> >
>> >
>> >
>> >
>> > Does anyone know how to use the AddFilter sample in the DDK in order
>> > to get it to successfully add and start a filter driver?
>> >
>> >
>> >
>> > Thanks,
>> >
>> > Don
>> >
>> >
>> >
>> >
>> >
>> > —
>> > Questions? First check the Kernel Driver FAQ at
>> > http://www.osronline.com/article.cfm?id=256
>> >
>> > You are currently subscribed to ntdev as:
>> > xxxxx@yahoo.ca
>> > To unsubscribe send a blank email to
>> > xxxxx@lists.osr.com
>> >
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@safend.com To unsubscribe
> send a blank email to xxxxx@lists.osr.com
>
>