]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/win32service.cpp
Merge pull request #184 from SaberUK/insp20-copy-all-configs
[user/henk/code/inspircd.git] / win / win32service.cpp
index e75b2eeba73e6533953c5c937adbb885ddb3d6ae..1d4cbad3bb6a7a85893e53e990d03113b03df036 100644 (file)
@@ -1,17 +1,25 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *   Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc>
  *
- * This program is free but copyrighted software; see
- *         the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
+
 #include "inspircd_config.h"
 #include "inspircd.h"
+#include "exitcodes.h"
 #include <windows.h>
 #include <stdlib.h>
 #include <string.h>
@@ -43,6 +51,7 @@ struct Commandline
 /* A function pointer for dynamic linking tricks */
 SETSERVDESC ChangeServiceConf;
 
+/* Returns true if this program is running as a service, false if it is running interactive */
 bool IsAService()
 {
        USEROBJECTFLAGS uoflags;
@@ -68,8 +77,8 @@ DWORD WINAPI WorkerThread(LPDWORD param)
 {
        char modname[MAX_PATH];
        GetModuleFileName(NULL, modname, sizeof(modname));
-       char* argv[] = { modname, "--nofork", "--debug" };
-       smain(3, argv);
+       char* argv[] = { modname, "--nofork" };
+       smain(2, argv);
        KillService();
        return 0;
 }
@@ -143,7 +152,7 @@ void terminateService(int code, int wincode)
        return;
 }
 
-/* In windows we hook this to exit() */
+/* In windows we hook this to InspIRCd::Exit() */
 void SetServiceStopped(int status)
 {
        if (!IsAService())
@@ -179,7 +188,6 @@ VOID ServiceCtrlHandler(DWORD controlCode)
 VOID ServiceMain(DWORD argc, LPTSTR *argv)
 {
        BOOL success;
-       DWORD type=0, size=0;
 
        serviceStatusHandle = RegisterServiceCtrlHandler("InspIRCd", (LPHANDLER_FUNCTION)ServiceCtrlHandler);
        if (!serviceStatusHandle)