]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Properly give the service specific exit code on failure to start. Now we just need...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 24 Aug 2008 19:19:57 +0000 (19:19 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 24 Aug 2008 19:19:57 +0000 (19:19 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10240 e03df62e-2008-0410-955e-edbf42e46eb7

src/server.cpp
win/configure.cpp
win/inspircdVC80.vcproj
win/inspircd_win32wrapper.h
win/win32service.cpp
win/win32service.h

index a87612449cff0c3f1818b0569e007bfdeadd035d..d8ab7642592a6f876bd877fb76b5c25a5f9cd1c7 100644 (file)
@@ -36,6 +36,7 @@ void InspIRCd::Exit(int status)
 #ifdef WINDOWS
        if (WindowsIPC)
                delete WindowsIPC;
+       SetServiceStopped(status);
 #endif
        if (this)
        {
index 91c68a227375152e7392df59dd17a3e32eac14fe..1bc6aba138c6eabd39c24eacaa8dac5fecfb673c 100644 (file)
@@ -13,6 +13,7 @@
 
 #define _CRT_SECURE_NO_DEPRECATE
 
+#define CONFIGURE_BUILD
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdio.h>
index aee4dcbde9eb656bc299e1bb41d91d4ec08d1d12..bfa8a16fc29dd7102f4b60ffe6b99a7d7f61edba 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\include\win32service.h"\r
+                               RelativePath=".\win32service.h"\r
                                >\r
                        </File>\r
                        <File\r
index 89309fbc92f5a4356cb6209f57ceacfbe28814f8..2935ba5c90a311d56f9779cbdcef15f982628f3a 100644 (file)
@@ -18,7 +18,9 @@
 #ifndef INSPIRCD_WIN32WRAPPER_H
 #define INSPIRCD_WIN32WRAPPER_H
 
+#ifndef CONFIGURE_BUILD
 #include "win32service.h"
+#endif
 
 /* Define the WINDOWS macro. This means we're building on windows to the rest of the server.
    I think this is more reasonable than using WIN32, especially if we're gonna be doing 64-bit compiles */
index 5923c1458cf2660f9ee0738343710105b0b8fb65..42eaa998b4b16061be4b5dc262f3f689f41af852 100644 (file)
@@ -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 */
 
index 93c9c8e09b731d9082410d86ddec8e3a89bd8389..162a7d66dd452998926825cf1be53cd5758d0dee 100644 (file)
@@ -2,8 +2,7 @@
 #define _WIN32SERVICE_H_\r
 
 /* Hook for win32service.cpp to exit properly with the service specific error code */
-#define exit(a) newexit(a)
-void newexit(int status);
+void SetServiceStopped(int status);
 \r
 /* Marks the service as running, not called until the config is parsed */\r
 void SetServiceRunning();\r