PRB: Service Does Not Receive SERVICE_CONTROL_SHUTDOWN Event

Last reviewed: March 17, 1998
Article ID: Q182561
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

    - Microsoft Windows NT 4.0

SYMPTOMS

A Service does not receive the SERVICE_CONTROL_SHUTDOWN event. This could cause a Service to not properly cleanup before the system shuts down.

CAUSE

The Service Control Manager sends the SERVICE_CONTROL_SHTUDOWN event synchronously to all Services one at a time. A Service only receives the event when all Services that received the event ahead of it have finished processing the event. A Service has processed the event when it returns from its control handler function. If the previous Service does not process the event, the following Services will never receive the event. The system may shutdown before a Service receives the event, which causes a Service to not execute code in its SERVICE_CONTROL_SHUTDOWN event handler.

RESOLUTION

If you install a Console Control Handler, you can circumvent this problem. The handler can intercept the CTRL_SHUTDOWN_EVENT. This event is sent asynchronously to all processes with a registered Console Control Handler. Please refer to the Platform SDK Documentation for more information.

STATUS

Microsoft has confirmed this to be a problem in Windows NT version 4.0. A supported hotfix is now available, but it has not been fully regression tested and should be applied only to systems experiencing this specific problem. Unless you are severely affected by this specific problem, Microsoft recommends that you wait for the next Service Pack that contains this fix. Contact Microsoft Technical Support for more information.

Keywords          : BseService
Version           : WINNT:4.0
Platform          : winnt
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 17, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.