http://bugs.winehq.org/show_bug.cgi?id=16189
--- Comment #6 from Rob Shearman robertshearman@gmail.com 2009-03-08 08:40:04 --- The interesting part of the log can be seen by grepping for "trace:service" (although the rest of the log gives the context for each of the messages). The debugs come from both a client process, services.exe and a service process, so I've annotated each line with "- C", "- S" and "-G" respectively.
trace:service:OpenSCManagerW ((null),(null),0x000f003f) - C trace:service:svcctl_OpenSCManagerW ((null), (null), f003f) - S trace:service:OpenSCManagerW returning 0x149038 - C trace:service:OpenServiceW 0x149038 L"gusvc" 36 - C trace:service:svcctl_OpenServiceW (L"gusvc", 0x24) - S trace:service:OpenServiceW returning 0x149100 - C trace:service:QueryServiceStatus 0x149100 0x33fd64 - C trace:service:QueryServiceStatusEx 0x149100 0 0x33fc84 36 0x33fca8 - C <client sees that service is running and requests it to stop:> trace:service:ControlService 0x149100 1 0x33fd64 - C trace:service:svcctl_ControlService (0x11ba90, 1, 0x84e810) - S <gusvc service sets its status to SERVICE_STOP_PENDING:> trace:service:SetServiceStatus 0x148ea8 10 3 1 0 0 0 0 - G trace:service:svcctl_SetServiceStatus (0x11b328, 0x11bb34) - S trace:service:svcctl_CloseServiceHandle (&0x11b220) - S <services process closes control pipe, causing the control dispatcher thread in the service to exit:> trace:service:service_run_main_thread control dispatcher exited, shutting down - C trace:service:QueryServiceStatus 0x149100 0x33fd64 - C trace:service:QueryServiceStatusEx 0x149100 0 0x33fc84 36 0x33fca8 -C <client process loops waiting for status to become SERVICE_STOPPED, but that never happens and it times out>
So the problem is that svcctl_ControlService causes the control_pipe to be closed before the service has chance to set its status to stopped. A second bug is that services.exe doesn't set the status of a service to stopped itself when a service (unexpectedly) exits.