none
Start / Stop Driver Installed Via CreateService() RRS feed

  • Question

  • Hello.

    I have a USB Host Controller  upper filter driver that I install via CreateService(). It is running, it does not appear in Service Control Manager, it appears in sc query type= drivers. It is reported as KERNEL_DRIVER, RUNNING, (STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN).

    How exactly can I stop my driver?

    sc stop MyDriver returns ControlService FAILED 1052: (The requested control is not valid for this service).

    ControlService(ServiceHandle,SERVICE_CONTROL_STOP,&ServiceStatus)) fails in code with 1052 also (As Administrator).

    1.) I am beginning to believe that I am unable to stop the driver due to the way I am installing it (via CreateService()). It there is no way to stop the service / driver in this scenario then I will try installting via the .inf/setup route.

    Am I correct? Is so is there any documentation anywhere covering this?

    Thanks.

    Wednesday, March 5, 2014 4:51 PM

Answers

  • if this is a device upper filter (not a class upper filter), you should use an INF to install it. Regardless of inf/CreateService, you can't use the SCM start/stop service calls to control the state of a pnp driver, unlike a legacy non pnp driver which can be unloaded/loaded with these APIs. a pnp driver can only be stopped and unloaded when all pnp stacks referencing it are unloaded. this means using devcon or device manager to disable all instances so that the driver unloads.

    why do you need to filter the USB HC?


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

    Wednesday, March 5, 2014 5:31 PM

All replies

  • if this is a device upper filter (not a class upper filter), you should use an INF to install it. Regardless of inf/CreateService, you can't use the SCM start/stop service calls to control the state of a pnp driver, unlike a legacy non pnp driver which can be unloaded/loaded with these APIs. a pnp driver can only be stopped and unloaded when all pnp stacks referencing it are unloaded. this means using devcon or device manager to disable all instances so that the driver unloads.

    why do you need to filter the USB HC?


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

    Wednesday, March 5, 2014 5:31 PM
  • Thanks.

    It is a upper class filter. What I am after is a way to not have to continually reboot and reinstall the filter during development. So you are saying if I unload all of the Host Controller's, I could stop my upper filter,Copy me new filter driver and overwrite my old (existing) driver, Restart the Host Controller and then restart my Upper class filter driver? I am of course aware that if anything goes wrong during the procedure I would loose my mouse and keyboard.

    Wednesday, March 5, 2014 5:40 PM
  • yes, that is correct. the act of re-enabling the HC will automatically load your filter driver as a part of building the stack. since the usb device class contains more than HCs (hubs, function stacks, etc) either your filter selectively figures out which stack to add itself to in AddDevice (and then disable that subset) or you must disable all devices in the device class if you are not selective in your attaching logic.

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

    Wednesday, March 5, 2014 8:10 PM