installing driver "FROM" a Service during startup

G

Guest

Guest
Archived from groups: microsoft.public.development.device.drivers,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.device_driver.dev (More info?)

Calling OpenSCManager() to install a driver from a service that is
automatially starting during system start appears to "block" after the SCM
has determined that the Service has hung. Why is this? What can I do to
install a driver at service * system start time.

DETAILS:

I have a service that is automatically started on system startup. During
service start it installs and creates a driver. This works fine starting and
stopping the driver using the MCC Service manager. However, it "blocks"
during system startup but does load successfully -- placing a number of
eventlog entries in the Service I see:

Service starting (time x)
Service ready to call OpenSCManager() to load driver (time x+1 second)
SCM reporting Service "Hung" (time x+10 seconds)
Service finishes call to OpenSCManager() and successfully loads driver
(time x + 11seconds to 1 minute!!!)
Service started

When starting under MCC Service manager it starts in a second or two. Under
system start the Service components all start very quickly, except the call
to OpenSCManager does not complete until the SCM loading the Service
declares the Service Hung. What gives?
 
G

Guest

Guest
Archived from groups: microsoft.public.development.device.drivers,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.device_driver.dev (More info?)

Actually, what is happening here is the OpenSCManager() is not blocking, but
the call to CreateService() that creates the driver service.
So, why is CreateService blocking? Would SCM locking cause this?


"mlc" <mc100ftj@yahoo.com> wrote in message
news:mAthd.14748$KJ6.12881@newsread1.news.pas.earthlink.net...
> Calling OpenSCManager() to install a driver from a service that is
> automatially starting during system start appears to "block" after the SCM
> has determined that the Service has hung. Why is this? What can I do to
> install a driver at service * system start time.
>
> DETAILS:
>
> I have a service that is automatically started on system startup. During
> service start it installs and creates a driver. This works fine starting
and
> stopping the driver using the MCC Service manager. However, it "blocks"
> during system startup but does load successfully -- placing a number of
> eventlog entries in the Service I see:
>
> Service starting (time x)
> Service ready to call OpenSCManager() to load driver (time x+1 second)
> SCM reporting Service "Hung" (time x+10 seconds)
> Service finishes call to OpenSCManager() and successfully loads driver
> (time x + 11seconds to 1 minute!!!)
> Service started
>
> When starting under MCC Service manager it starts in a second or two.
Under
> system start the Service components all start very quickly, except the
call
> to OpenSCManager does not complete until the SCM loading the Service
> declares the Service Hung. What gives?
>
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.development.device.drivers,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.device_driver.dev (More info?)

it's very likely that this is the problem.

why wouldn't your driver be installed along with your service?

-p

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"mlc" <mc100ftj@yahoo.com> wrote in message
news:Nlvhd.14816$KJ6.7453@newsread1.news.pas.earthlink.net...
> Actually, what is happening here is the OpenSCManager() is not blocking,
> but
> the call to CreateService() that creates the driver service.
> So, why is CreateService blocking? Would SCM locking cause this?
>
>
> "mlc" <mc100ftj@yahoo.com> wrote in message
> news:mAthd.14748$KJ6.12881@newsread1.news.pas.earthlink.net...
>> Calling OpenSCManager() to install a driver from a service that is
>> automatially starting during system start appears to "block" after the
>> SCM
>> has determined that the Service has hung. Why is this? What can I do to
>> install a driver at service * system start time.
>>
>> DETAILS:
>>
>> I have a service that is automatically started on system startup. During
>> service start it installs and creates a driver. This works fine starting
> and
>> stopping the driver using the MCC Service manager. However, it "blocks"
>> during system startup but does load successfully -- placing a number of
>> eventlog entries in the Service I see:
>>
>> Service starting (time x)
>> Service ready to call OpenSCManager() to load driver (time x+1 second)
>> SCM reporting Service "Hung" (time x+10 seconds)
>> Service finishes call to OpenSCManager() and successfully loads driver
>> (time x + 11seconds to 1 minute!!!)
>> Service started
>>
>> When starting under MCC Service manager it starts in a second or two.
> Under
>> system start the Service components all start very quickly, except the
> call
>> to OpenSCManager does not complete until the SCM loading the Service
>> declares the Service Hung. What gives?
>>
>>
>>
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.development.device.drivers,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.device_driver.dev (More info?)

> Actually, what is happening here is the OpenSCManager() is not blocking, but
> the call to CreateService() that creates the driver service.
> So, why is CreateService blocking? Would SCM locking cause this?

Some deadlock inside SCM. Probably it is not possible to call OpenSCManager
from the service's init path.

I would suggest installing the driver once forever during the installation in
Manual start mode, and then starting it from the service (not from the init
paths).

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
 
G

Guest

Guest
Archived from groups: microsoft.public.development.device.drivers,microsoft.public.win32.programmer.kernel,microsoft.public.windowsxp.device_driver.dev (More info?)

From MSDN help for StartService:


"A service cannot call StartService during initialization. The reason
is that the SCM locks the service control database during
initialization, so a call to StartService will block. Once the service
reports to the SCM that it has successfully started, it can call
StartService."

HTH.
Soumik.


"mlc" <mc100ftj@yahoo.com> wrote in message news:<mAthd.14748$KJ6.12881@newsread1.news.pas.earthlink.net>...
> Calling OpenSCManager() to install a driver from a service that is
> automatially starting during system start appears to "block" after the SCM
> has determined that the Service has hung. Why is this? What can I do to
> install a driver at service * system start time.
>
> DETAILS:
>
> I have a service that is automatically started on system startup. During
> service start it installs and creates a driver. This works fine starting and
> stopping the driver using the MCC Service manager. However, it "blocks"
> during system startup but does load successfully -- placing a number of
> eventlog entries in the Service I see:
>
> Service starting (time x)
> Service ready to call OpenSCManager() to load driver (time x+1 second)
> SCM reporting Service "Hung" (time x+10 seconds)
> Service finishes call to OpenSCManager() and successfully loads driver
> (time x + 11seconds to 1 minute!!!)
> Service started
>
> When starting under MCC Service manager it starts in a second or two. Under
> system start the Service components all start very quickly, except the call
> to OpenSCManager does not complete until the SCM loading the Service
> declares the Service Hung. What gives?