Can't unload the class filter driver dynamically using the ControlService

Hi All,

I have an installation application to install/uninstall my keyboard class filter driver. The application intents to calll the CreateService/StartService to load the driver and ControlService(SERVICE_CONTROL_STOP)/StopService to unload the driver. But it’s bad that calling ControlService(SERVICE_CONTROL_STOP) always return error code 1052(ERROR_INVALID_SERVICE_CONTROL). The application is based on the WDK sample code of the ioctl/kmdf/exe. I feel that the API can’t be applied to the kernel mode driver service.

Does anybody here know how to fix this issue?

Thanks,
Marshall

You can’t manage this type of driver with the service control manager.

Mm
On Oct 27, 2011 9:36 PM, wrote:

> Hi All,
>
> I have an installation application to install/uninstall my keyboard class
> filter driver. The application intents to calll the
> CreateService/StartService to load the driver and
> ControlService(SERVICE_CONTROL_STOP)/StopService to unload the driver. But
> it’s bad that calling ControlService(SERVICE_CONTROL_STOP) always return
> error code 1052(ERROR_INVALID_SERVICE_CONTROL). The application is based on
> the WDK sample code of the ioctl/kmdf/exe. I feel that the API can’t be
> applied to the kernel mode driver service.
>
> Does anybody here know how to fix this issue?
>
> Thanks,
> Marshall
>
> —
> NTDEV is sponsored by OSR
>
> 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
>

You just plain cannot restart the PS/2 keyboard in any possible way. So, always require a reboot and get rid of any stopping attempts.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi All,
>
> I have an installation application to install/uninstall my keyboard class filter driver. The application intents to calll the CreateService/StartService to load the driver and ControlService(SERVICE_CONTROL_STOP)/StopService to unload the driver. But it’s bad that calling ControlService(SERVICE_CONTROL_STOP) always return error code 1052(ERROR_INVALID_SERVICE_CONTROL). The application is based on the WDK sample code of the ioctl/kmdf/exe. I feel that the API can’t be applied to the kernel mode driver service.
>
> Does anybody here know how to fix this issue?
>
> Thanks,
> Marshall
>

You’re right that it can be simply solved by requiring reboot. But requiring reboot leaves bad experience to the end users.

For PS2 devices, we have no way to avoid reboot but there are not many PS2 devices except those on the laptop nowadays which we can live up with. If the connected devices are all USB type, then we should avoid to require reboot which I’m trying to figure out.

Can other commands of the application devcon work for this purpose? I tried devcon remove =keyboard but we can’t delete the driver service afterwards.

Why do you need to add/remove the class filter dynamically? What bigger problem you’re trying to solve?

xxxxx@hotmail.com wrote:

You’re right that it can be simply solved by requiring reboot. But requiring reboot leaves bad experience to the end users.

For PS2 devices, we have no way to avoid reboot but there are not many PS2 devices except those on the laptop nowadays which we can live up with. If the connected devices are all USB type, then we should avoid to require reboot which I’m trying to figure out.

Can other commands of the application devcon work for this purpose? I tried devcon remove =keyboard but we can’t delete the driver service afterwards.

You don’t want to remove the keyboards. You just need to disable them
all and then re-enable them. That tears down the device stacks and
rebuilds them with the new filter set.


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