advapi32[2/3]: exit the service process when the last service thread stops

Mikolaj Zalewski mikolajz at
Wed Sep 26 15:20:08 CDT 2007

It turns out it is not necessary for Photoshop CS2 when other things
works but if e.g. the lpServiceStartName is wrong Photoshop will try
to stop the service change the configuration and restart it. This will
hang as after a stop the license manager service won't close the named
pipe but relies on termination of the service to have it closed.

Currently the service_run_threads waits for all the
service_control_dispatch threads to finish but that's dead code as
service_control_dispatch thread runs "while (1)" and finishes only if
there is a protocol error on the named pipe. Also the idea of
service_control_dispatch finishing one after another is wrong as if we
will have many services sharing a single process we will want to have
all the dispatchers running as long as the process is running for the
user to be able to start other services.

In this patch I make service_thread maintain the number of running
services and if it goes to zero to mark an event that causes
service_run_threads to stop. The service_control_dispatch threads are
not finished as they are usually waiting on ConnectNamedPipe.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0002-advapi32-exit-the-service-process-when-the-last-service-thread-stops.txt

More information about the wine-patches mailing list