diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-09-15 12:40:54 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-09-16 17:32:28 +0200 |
commit | 7972d45a869a176442f570356737f596879df710 (patch) | |
tree | 7ebc93493a5dd97f99ac6ad7f7f4c165e7e7c026 /src/server/worldserver/Main.cpp | |
parent | b0b87aeea1a324af3a8c16be4b87bed05929de4e (diff) |
Core/Common: Compile ServiceWin32 as part of common project instead of directly adding its source files to both server executables
(cherry picked from commit 052f2d0a81460ba484c27d05fe34673cf467c75e)
Diffstat (limited to 'src/server/worldserver/Main.cpp')
-rw-r--r-- | src/server/worldserver/Main.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 9743580d74b..5f846d79f59 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -79,7 +79,7 @@ namespace fs = boost::filesystem; #define _TRINITY_CORE_CONFIG_DIR "worldserver.conf.d" #endif -#ifdef _WIN32 +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include "ServiceWin32.h" #include <tchar.h> TCHAR serviceName[] = _T("worldserver"); @@ -132,7 +132,7 @@ struct ShutdownCLIThread { void operator()(std::thread* cliThread) const; }; variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, fs::path& configDir, std::string& winServiceAction); /// Launch the Trinity server -extern int main(int argc, char** argv) +int main(int argc, char** argv) { signal(SIGABRT, &Trinity::AbortHandler); @@ -156,12 +156,13 @@ extern int main(int argc, char** argv) auto protobufHandle = Trinity::make_unique_ptr_with_deleter(&dummy, [](void*) { google::protobuf::ShutdownProtobufLibrary(); }); #ifdef _WIN32 + Trinity::Service::Init(serviceLongName, serviceName, serviceDescription, &main, &m_ServiceStatus); if (winServiceAction == "install") - return WinServiceInstall() ? 0 : 1; + return Trinity::Service::Install(); if (winServiceAction == "uninstall") - return WinServiceUninstall() ? 0 : 1; + return Trinity::Service::Uninstall(); if (winServiceAction == "run") - return WinServiceRun() ? 0 : 1; + return Trinity::Service::Run(); Optional<UINT> newTimerResolution; boost::system::error_code dllError; |