Announcement

Collapse
No announcement yet.

NT Service on system shutdown

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NT Service on system shutdown

    Hi!

    Is there an equivalent to %SERVICE_STOP_PENDING for the
    %SERVICE_CONTROL_SHUTDOWN NT service control? Maybe something like
    %SERVICE_SHUTDOWN_PENDING? I'm trying to clean things up nicely
    in this service I'm writing when the OS shuts down and my
    service is still running. I'm getting through my %SERVICE_CONTROL_SHUTDOWN
    logic in my service handler, but the service automatically
    shuts down after about 20-21 seconds, even though it could
    take me up to 60 seconds to clean things up. I've tested this
    by looping for 60 seconds within this logic before continuuing
    but it still shuts down after 20 seconds. I've also tried setting
    the dwWaitHint value to 60 seconds.

    Thanks,
    Scott


    ------------------
    Scott Wolfington
    http://www.boogietools.com




    [This message has been edited by Scott Wolfington (edited March 05, 2003).]
    Scott Wolfington
    [url="http://www.boogietools.com"]http://www.boogietools.com[/url]

  • #2
    From win32 helpfile:
    When the user shuts down the system, all control handlers receive the
    SERVICE_CONTROL_SHUTDOWN control code. They are notified in the order that
    they appear in the database of installed services. By default, a service
    has approximately 20 seconds to perform cleanup tasks before the system
    shuts down. However, if the system is left in the shutdown state (not restarted
    or powered down) the service continues to run.
    You can change the time the system will wait for service shutdown by modifying
    the WaitToKillServiceTimeout value in the following registry key:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control


    ------------------
    Peter.
    mailto[email protected][email protected]</A>
    Regards,
    Peter

    Comment


    • #3
      Hi Peter,

      I saw that WaitToKillServiceTimeout reg setting too. I really
      want to refrain from making any registry changes though. Maybe
      I should just try to come up with a way to insure that my service has
      done everything it needs to do within that 20 second shutdown
      window. On most occassions (95-97% of the time) the service will
      be done wrapping things up within that 20 seconds. I'm still
      open to ideas though.

      Scott


      ------------------
      Scott Wolfington
      http://www.boogietools.com


      [This message has been edited by Scott Wolfington (edited March 05, 2003).]
      Scott Wolfington
      [url="http://www.boogietools.com"]http://www.boogietools.com[/url]

      Comment

      Working...
      X