Microsoft KB Archive/182561

{|
 * width="100%"|

Service Does Not Receive SERVICE_CONTROL_SHUTDOWN Event

 * }

Q182561

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * the operating system: Microsoft Windows NT 4.0
 * Microsoft Windows NT Server version 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
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 : kbWinNT400sp4fix kbKernBase kbService kbDSupport kbGrpDSKernBase

Issue type : kbbug

Technology : kbAudDeveloper kbWin32sSearch kbWin32API