T
Tim Gorgs
Hi all,
I have some problems with stopping a certain service on my Windows
2000 system. I want to automatically stop the service and then copy a
new version of the service executable over the existing one.
Steps I do to implement this functionality:
Connect to SCM
Connect to service
Send stop request to service via ControlService
Loop QueryServiceStatus until service status changed from
SERVICE_RUNNING to SERVICE_STOPPED
Copy the new service executable over the old one
Restart service
Everything SHOULD be fine as a receive the SERVICE_STOPPED status
after I sent the stop request, but I still can't overwrite the
executable. If I add an additional Sleep() with as less as just a 100
milliseconds, I can overwrite the file. It definately has nothing to
do with filesystem- / user-access rights, the problem just seems to be
that my service reports it's been stopped too quickly.
I've done a lot of research on this topic but unfortunately I couldn't
find anything about it.
Any help is greatly appreciated, thank you!
Tim
I have some problems with stopping a certain service on my Windows
2000 system. I want to automatically stop the service and then copy a
new version of the service executable over the existing one.
Steps I do to implement this functionality:
Connect to SCM
Connect to service
Send stop request to service via ControlService
Loop QueryServiceStatus until service status changed from
SERVICE_RUNNING to SERVICE_STOPPED
Copy the new service executable over the old one
Restart service
Everything SHOULD be fine as a receive the SERVICE_STOPPED status
after I sent the stop request, but I still can't overwrite the
executable. If I add an additional Sleep() with as less as just a 100
milliseconds, I can overwrite the file. It definately has nothing to
do with filesystem- / user-access rights, the problem just seems to be
that my service reports it's been stopped too quickly.
I've done a lot of research on this topic but unfortunately I couldn't
find anything about it.
Any help is greatly appreciated, thank you!
Tim