Service and Callout driver load issue RRS feed

  • Question

  • Hi,
    I have created a WFP callout driver which I load it from user mode via Service Control Manager and it works as it should.
    But I am experiencing problems when I load it from a service which is set to start automatically. The problem is that the call to OpenService(...) blocks and in some cases up to 100 seconds. I need to load and start the driver when the service starts and send some data to it and this kind of delay is not acceptable. I have checked that Base Filtering Engine is started before my service. After the delay everything is alright and StartService succeeds.

    What can be causing such a delay?

    Thursday, June 11, 2009 1:03 PM


All replies

  • Are you calling OpenService() from the ServiceMain() of your other service? I am not sure that's supported (though I am not an expert on Service Control Manager design).

    Have you tried making your callout servcie a dependent service of your other service? That way starting that service would load your callout service automatically.

    Other than that, do you know when was the 100 seconds being spent? If it is not spent inside your callout service's ServiceMain(), is the time being spent before your ServiceMain() gains control? or after?

    Tuesday, June 23, 2009 4:00 AM

  • Hi,
    thanks for your feedback! This is a callout driver and doesn't have a ServiceMain, it has DriverEntry instead. But your note on calling OpenService from ServiceMain made me look for the information and actually this is the case. Until the service hasn't reported SERVICE_RUNNING status to the service control manager the control manager is locked and all calls block (with some timeout, thankfully). Moving the service functionality into a different thread and exiting the ServiceMain did the job! This is actually how services should work on every windows after NT4.

    Tuesday, June 23, 2009 12:22 PM
  • cool. thanks for sharing the findings.
    Wednesday, June 24, 2009 2:17 AM