From 3671ed806d7371fb6b14a5909451b20e54a1b14a Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 3 Aug 2003 12:38:18 +0000 Subject: [PATCH] Keep Windows happy. --- src/process.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/process.c b/src/process.c index 547c51ad..2ec0bcd3 100644 --- a/src/process.c +++ b/src/process.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: process.c,v 1.1.2.61 2003/08/02 20:50:38 guus Exp $ + $Id: process.c,v 1.1.2.62 2003/08/03 12:38:18 guus Exp $ */ #include "system.h" @@ -165,6 +165,11 @@ DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) { return ERROR_CALL_NOT_IMPLEMENTED; } + if(!running) { + status.dwCurrentState = SERVICE_STOP_PENDING; + SetServiceStatus(statushandle, &status); + } + return NO_ERROR; } @@ -175,7 +180,6 @@ VOID WINAPI run_service(DWORD argc, LPTSTR* argv) status.dwServiceType = SERVICE_WIN32; - status.dwCurrentState = SERVICE_RUNNING; status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; status.dwWin32ExitCode = 0; status.dwServiceSpecificExitCode = 0; @@ -188,13 +192,16 @@ VOID WINAPI run_service(DWORD argc, LPTSTR* argv) logger(LOG_ERR, _("System call `%s' failed: %s"), "RegisterServiceCtrlHandlerEx", winerror(GetLastError())); err = 1; } else { + status.dwCurrentState = SERVICE_START_PENDING; + SetServiceStatus(statushandle, &status); + + status.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(statushandle, &status); err = main2(argc, argv); status.dwCurrentState = SERVICE_STOPPED; - status.dwWin32ExitCode = err; - + //status.dwWin32ExitCode = err; SetServiceStatus(statushandle, &status); } -- 2.39.5