diff --git a/Changes b/Changes index cb6b33066..08b9acd35 100644 --- a/Changes +++ b/Changes @@ -1824,3 +1824,29 @@ MOTDs - Fixed typo in new module build switch - Added a Config -advanced prompt for --with-moduleswhich= - Small fix in s_conf.c and Velcro +- Implementing #0003239 suggested by Siyavash, patched by Trocotronic, patch + details: + added -n parameter to unreal.exe. So, if you want, you could specify a +name of service. It will receive all command. For example: + +unreal install -n Deimos + +It will install a service called UnrealIRCd-Deimos. Then, the configfile +must be named unrealircd-deimos.conf. This way gave you chance to install +more than one service on the same machine using only one installation. + +unreal start -n Deimos // it will start service with +unrealircd-deimos.conf file +unreal uninstall -n Deimos + +Although, -n parameter is optional, so you can use "unreal install" as +usual. + +If you run service from console (double click to wircd.exe for example), +it will only start one service, main service, called UnrealIRCd (install +without -n). If you only install services with name (-n), double click will +start wircd.exe as usual (window mode). +-n will affect to all command (install, uninstall, start, stop, etc) + +Remember to use different listening ports (or interfaces) on every +unrealircd-*.conf files. diff --git a/include/config.h b/include/config.h index 90d96d2c0..8ca413603 100644 --- a/include/config.h +++ b/include/config.h @@ -200,7 +200,11 @@ * these are only the recommened names and paths. Change as needed. * You must define these to something, even if you don't really want them. */ +#ifndef _WIN32 #define CPATH "unrealircd.conf" /* server configuration file */ +#else +extern char CPATH[262]; +#endif #define MPATH "ircd.motd" /* server MOTD file */ #define SMPATH "ircd.smotd" /* short MOTD file */ #define RPATH "ircd.rules" /* server rules file */ diff --git a/src/win32/gui.c b/src/win32/gui.c index 27b1387da..b9801595e 100644 --- a/src/win32/gui.c +++ b/src/win32/gui.c @@ -105,6 +105,7 @@ FARPROC lpfnOldWndProc; HMENU hContext; OSVERSIONINFO VerInfo; char OSName[256]; +char CPATH[262]; #ifdef USE_LIBCURL extern char *find_loaded_remote_include(char *url); #endif @@ -216,13 +217,14 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&VerInfo); GetOSName(VerInfo, OSName); + strlcpy(CPATH, "unrealircd.conf", sizeof(CPATH)); if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) { SC_HANDLE hService, hSCManager = OpenSCManager(NULL, NULL, GENERIC_EXECUTE); + StartServiceCtrlDispatcher(DispatchTable); if ((hService = OpenService(hSCManager, "UnrealIRCd", GENERIC_EXECUTE))) { int save_err = 0; - StartServiceCtrlDispatcher(DispatchTable); if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) { SERVICE_STATUS status; diff --git a/src/win32/service.c b/src/win32/service.c index 3ac88858f..cfc281e13 100644 --- a/src/win32/service.c +++ b/src/win32/service.c @@ -100,7 +100,7 @@ VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv) { WSADATA WSAData; DWORD error = 0; - char path[MAX_PATH], *folder; + char path[MAX_PATH], *folder, *c; IsService = TRUE; @@ -117,9 +117,13 @@ VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv) folder = strrchr(path, '\\'); *folder = 0; chdir(path); + + _snprintf(CPATH, sizeof(CPATH)-1, "%s.conf", lpszArgv[0]); + for (c = CPATH; !BadPtr(c); c++) + *c = tolower(*c); /* Register the service controller */ - IRCDStatusHandle = RegisterServiceCtrlHandler("UnrealIRCd", IRCDCtrlHandler); + IRCDStatusHandle = RegisterServiceCtrlHandler(lpszArgv[0], IRCDCtrlHandler); VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&VerInfo); diff --git a/src/win32/unreal.c b/src/win32/unreal.c index d85420b40..5da4ebcd9 100644 --- a/src/win32/unreal.c +++ b/src/win32/unreal.c @@ -27,7 +27,8 @@ UCHANGESERVICECONFIG2 uChangeServiceConfig2; #define IRCD_SERVICE_CONTROL_REHASH 128 void show_usage() { - fprintf(stderr, "unreal start|stop|rehash|restart|install|uninstall|config