Service Does Not Receive SERVICE_CONTROL_SHUTDOWN Event

ID: Q182561


The information in this article applies to:


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

To resolve this problem, obtain the latest service pack for Windows NT 4.0. For additional information, please see the following article in the Microsoft Knowledge Base:

Q152734 How to Obtain the Latest Windows NT 4.0 Service Pack


WORKAROUND

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. This problem was first corrected in Windows NT version 4.0 Service Pack 4.

Additional query words:


Keywords          : NT4SP4Fix kbbug4.00 kbfix4.00 kbKernBase kbService kbGrpKernBase 
Version           : winnt:4.0
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: July 2, 1999