From a539875eccf01c6d0a5fb21649d10a23ad191b23 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 24 Aug 2008 19:19:57 +0000 Subject: Properly give the service specific exit code on failure to start. Now we just need to find out how to retrieve this git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10240 e03df62e-2008-0410-955e-edbf42e46eb7 --- win/win32service.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'win/win32service.cpp') diff --git a/win/win32service.cpp b/win/win32service.cpp index 5923c1458..42eaa998b 100644 --- a/win/win32service.cpp +++ b/win/win32service.cpp @@ -27,6 +27,9 @@ static int serviceCurrentStatus; */ typedef BOOL (CALLBACK* SETSERVDESC)(SC_HANDLE,DWORD,LPVOID); +BOOL UpdateSCMStatus (DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwServiceSpecificExitCode, DWORD dwCheckPoint, DWORD dwWaitHint); +void terminateService (int code, int wincode); + /* A commandline parameter handler for service specific commandline parameters */ typedef void (*CommandlineParameterHandler)(void); @@ -40,7 +43,7 @@ struct Commandline /* A function pointer for dynamic linking tricks */ SETSERVDESC ChangeServiceConf; -bool IsAService(); +bool IsAService() { USEROBJECTFLAGS uoflags; HWINSTA winstation = GetProcessWindowStation(); @@ -78,7 +81,7 @@ void SetServiceRunning() return; serviceCurrentStatus = SERVICE_RUNNING; - success = UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0, 0, 0); + BOOL success = UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0, 0, 0); if (!success) { terminateService(6, GetLastError()); @@ -141,7 +144,7 @@ void terminateService (int code, int wincode) } /* In windows we hook this to exit() */ -void newexit(int status) +void SetServiceStopped(int status) { if (!IsAService()) exit(status); @@ -355,7 +358,7 @@ int main(int argc, char** argv) * as a service so if this is true, we just run the non-service inspircd. */ if (!IsAService()) - return smain(argv, argc); + return smain(argc, argv); /* If we get here, we know the service is installed so we can start it */ -- cgit v1.2.3