Unloading a filter driver without reboot

Hi,

I use setupAPI to install a filter driver, and installation works fine. However, when I try to uninstall the driver, it seems that I cannot stop the service (ControlService returns 1052 (ERROR_INVALID_SERVICE_CONTROL), and the DeleteService does not delete the service.

What I am trying to do is to make sure install and uninstall work without a reboot. Any ideas?

Thanks,
AB

You cannot uninstall a filter once it is in the stack in most cases.
For all you know there is another driver above you referencing your
device object. If you need to remove the functionality of your filter,
have an IOCTL that causes the filter to treat all requests as pass
through (i.e. just send to the next driver).

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

xxxxx@gmail.com” wrote in message
news:xxxxx@ntdev:

> Hi,
>
> I use setupAPI to install a filter driver, and installation works fine. However, when I try to uninstall the driver, it seems that I cannot stop the service (ControlService returns 1052 (ERROR_INVALID_SERVICE_CONTROL), and the DeleteService does not delete the service.
>
> What I am trying to do is to make sure install and uninstall work without a reboot. Any ideas?
>
> Thanks,
> AB

You can’t use the scm. You must disable all stacks your filter is a part of and then pnp will unload your driver.

d

Bent from my phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?3/?16/?2013 6:49 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] Unloading a filter driver without reboot

Hi,

I use setupAPI to install a filter driver, and installation works fine. However, when I try to uninstall the driver, it seems that I cannot stop the service (ControlService returns 1052 (ERROR_INVALID_SERVICE_CONTROL), and the DeleteService does not delete the service.

What I am trying to do is to make sure install and uninstall work without a reboot. Any ideas?

Thanks,
AB


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Ok thanks guys. If I am a lower filter, I will need to disable all the drivers sitting on top of my driver… remove my filter driver, and once I enabled them again, they should come up without the filter driver as part of the stack, correct?

Disable the device stacks, not the driver services themselves , and, yes, if done properly your driver will unload and then you could reenable each of the stacks

d

Bent from my phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?3/?16/?2013 8:00 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Unloading a filter driver without reboot

Ok thanks guys. If I am a lower filter, I will need to disable all the drivers sitting on top of my driver… remove my filter driver, and once I enabled them again, they should come up without the filter driver as part of the stack, correct?


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hello Doran,

I’m curious to know how to disable the device stacks. Could you please
give me some pointers.

Many Thanks,
-Raj P.

On Sat, Mar 16, 2013 at 9:56 AM, Doron Holan wrote:

> Disable the device stacks, not the driver services themselves , and,
> yes, if done properly your driver will unload and then you could reenable
> each of the stacks
>
>
> d
>
> Bent from my phone
> ------------------------------
> From: xxxxx@gmail.com
> Sent: 3/16/2013 8:00 AM
>
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] Unloading a filter driver without reboot
>
> Ok thanks guys. If I am a lower filter, I will need to disable all the
> drivers sitting on top of my driver… remove my filter driver, and once I
> enabled them again, they should come up without the filter driver as part
> of the stack, correct?
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

On 17-Mar-2013 02:50, Rajinikanth Pandurangan wrote:

I’m curious to know how to disable the device stacks. Could you please
give me some pointers.

Just disable the device using whatever you like (device manager, devcon…)

– pa

Thanks Doron, will give it a go

Hi

I tried the following sequence

  1. Install filter driver (works fine)
  2. Disable the filtered devices (by right clicking the device icon on device manager then selecting disable)
  3. Uninstall filter driver using setupApi

Step 3) fails every time… However when I Unplug the device manually instead of step 2) above, it works. Any ideas what I am doing wrong?

Thanks,
AB

What is the error code? What does the log file say? When you disable, did it prompt for reboot or error out?

d

Bent from my phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?3/?17/?2013 8:16 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Unloading a filter driver without reboot

Hi

I tried the following sequence

1. Install filter driver (works fine)
2. Disable the filtered devices (by right clicking the device icon on device manager then selecting disable)
3. Uninstall filter driver using setupApi

Step 3) fails every time… However when I Unplug the device manually instead of step 2) above, it works. Any ideas what I am doing wrong?

Thanks,
AB


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi Doron

When I disable the device, and then uninstall the filter driver, the whole device vanishes from Device Manager. No, it does not ask about reboot. In a sense, this is strange because I cannot even enable back the device again.

Disable should ! out the device, not make it disappear. Are you choosing disable or uninstall? Scan for new HW will make it come back unless it is a root enumerated device

d

Bent from my phone


From: xxxxx@gmail.commailto:xxxxx
Sent: ?3/?17/?2013 10:59 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] Unloading a filter driver without reboot

Hi Doron

When I disable the device, and then uninstall the filter driver, the whole device vanishes from Device Manager. No, it does not ask about reboot. In a sense, this is strange because I cannot even enable back the device again.


NTDEV is sponsored by OSR

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi Doron

Disable not uninstall.

No disable doesn’t out the device, uninstallation of the filter driver does. Also, scan new hardware has no effect. However, when I reboot-machine/unplug-and-plug-back, it says new hardware found.

xxxxx@gmail.com wrote:

Ok thanks guys. If I am a lower filter, I will need to disable all the drivers sitting on top of my driver… remove my filter driver, and once I enabled them again, they should come up without the filter driver as part of the stack, correct?

There are two steps to this. One is to make sure your filter is not
being used. The other is to remove your filter.

For the first step, you need to remove yourself from the “LowerFilters”
registry value for all the devices (or classes) you are filtering. Then
you need to restart those devices. Those driver stacks will rebuild
without your filter.

Now you can remove your service and delete your files.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Rajinikanth Pandurangan wrote:

I’m curious to know how to disable the device stacks. Could you
please give me some pointers.

“devcon disable” or “devcon restart”, both of which call
SetupDiCallClassInstaller with DIF_PROPERTYCHANGE.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Ok guys… restarted the whole stack including the USB composite device and now works fine. Thank you.