From 5e843462eb0c5636f506ca6fcd402686ac68c47b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 11 May 2015 14:28:28 +0300 Subject: move service mgmt utils to libservice/utils/ --- utils/CMakeLists.txt | 13 ----------- utils/install_service.cpp | 32 ---------------------------- utils/libservice/CMakeLists.txt | 1 + utils/libservice/utils/CMakeLists.txt | 11 ++++++++++ utils/libservice/utils/install_service.cpp | 32 ++++++++++++++++++++++++++++ utils/libservice/utils/start_service.cpp | 32 ++++++++++++++++++++++++++++ utils/libservice/utils/stop_service.cpp | 32 ++++++++++++++++++++++++++++ utils/libservice/utils/uninstall_service.cpp | 32 ++++++++++++++++++++++++++++ utils/start_service.cpp | 32 ---------------------------- utils/stop_service.cpp | 32 ---------------------------- utils/uninstall_service.cpp | 32 ---------------------------- 11 files changed, 140 insertions(+), 141 deletions(-) delete mode 100644 utils/install_service.cpp create mode 100644 utils/libservice/utils/CMakeLists.txt create mode 100644 utils/libservice/utils/install_service.cpp create mode 100644 utils/libservice/utils/start_service.cpp create mode 100644 utils/libservice/utils/stop_service.cpp create mode 100644 utils/libservice/utils/uninstall_service.cpp delete mode 100644 utils/start_service.cpp delete mode 100644 utils/stop_service.cpp delete mode 100644 utils/uninstall_service.cpp diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 7b5c0bf..73b2498 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,16 +1,3 @@ project(windows_drivers_utils) add_subdirectory(libservice) - -add_executable(install_service install_service.cpp) -target_link_libraries(install_service libservice) - -add_executable(start_service start_service.cpp) -target_link_libraries(start_service libservice) - -add_executable(stop_service stop_service.cpp) -target_link_libraries(stop_service libservice) - -add_executable(uninstall_service uninstall_service.cpp) -target_link_libraries(uninstall_service libservice) - add_subdirectory(libnt_path_converter) diff --git a/utils/install_service.cpp b/utils/install_service.cpp deleted file mode 100644 index fd9e339..0000000 --- a/utils/install_service.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include "libservice/all.hpp" - -#include -#include - -int main(int argc, char* argv[]) -{ - if (argc != 3) - { - std::cout << "Usage: " << argv[0] << " NAME SYS_PATH\n"; - return 1; - } - - try - { - libservice::Service::install(libservice::ServiceManager::open(), argv[1], argv[2]); - } - catch (const std::exception& e) - { - std::cerr << e.what() << "\n"; - return 1; - } - return 0; -} diff --git a/utils/libservice/CMakeLists.txt b/utils/libservice/CMakeLists.txt index 169a641..ad9e065 100644 --- a/utils/libservice/CMakeLists.txt +++ b/utils/libservice/CMakeLists.txt @@ -6,3 +6,4 @@ add_library(${PROJECT_NAME} ${${PROJECT_NAME}_sources} target_include_directories(${PROJECT_NAME} PUBLIC include) add_subdirectory(test) +add_subdirectory(utils) diff --git a/utils/libservice/utils/CMakeLists.txt b/utils/libservice/utils/CMakeLists.txt new file mode 100644 index 0000000..061ab25 --- /dev/null +++ b/utils/libservice/utils/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable(install_service install_service.cpp) +target_link_libraries(install_service libservice) + +add_executable(start_service start_service.cpp) +target_link_libraries(start_service libservice) + +add_executable(stop_service stop_service.cpp) +target_link_libraries(stop_service libservice) + +add_executable(uninstall_service uninstall_service.cpp) +target_link_libraries(uninstall_service libservice) diff --git a/utils/libservice/utils/install_service.cpp b/utils/libservice/utils/install_service.cpp new file mode 100644 index 0000000..fd9e339 --- /dev/null +++ b/utils/libservice/utils/install_service.cpp @@ -0,0 +1,32 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include "libservice/all.hpp" + +#include +#include + +int main(int argc, char* argv[]) +{ + if (argc != 3) + { + std::cout << "Usage: " << argv[0] << " NAME SYS_PATH\n"; + return 1; + } + + try + { + libservice::Service::install(libservice::ServiceManager::open(), argv[1], argv[2]); + } + catch (const std::exception& e) + { + std::cerr << e.what() << "\n"; + return 1; + } + return 0; +} diff --git a/utils/libservice/utils/start_service.cpp b/utils/libservice/utils/start_service.cpp new file mode 100644 index 0000000..09b5b35 --- /dev/null +++ b/utils/libservice/utils/start_service.cpp @@ -0,0 +1,32 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include "libservice/all.hpp" + +#include +#include + +int main(int argc, char* argv[]) +{ + if (argc != 2) + { + std::cout << "Usage: " << argv[0] << " NAME\n"; + return 1; + } + + try + { + libservice::Service::open(libservice::ServiceManager::open(), argv[1]).start(); + } + catch (const std::exception& e) + { + std::cerr << e.what() << "\n"; + return 1; + } + return 0; +} diff --git a/utils/libservice/utils/stop_service.cpp b/utils/libservice/utils/stop_service.cpp new file mode 100644 index 0000000..48b4c92 --- /dev/null +++ b/utils/libservice/utils/stop_service.cpp @@ -0,0 +1,32 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include "libservice/all.hpp" + +#include +#include + +int main(int argc, char* argv[]) +{ + if (argc != 2) + { + std::cout << "Usage: " << argv[0] << " NAME\n"; + return 1; + } + + try + { + libservice::Service::open(libservice::ServiceManager::open(), argv[1]).stop(); + } + catch (const std::exception& e) + { + std::cerr << e.what() << "\n"; + return 1; + } + return 0; +} diff --git a/utils/libservice/utils/uninstall_service.cpp b/utils/libservice/utils/uninstall_service.cpp new file mode 100644 index 0000000..8497fbf --- /dev/null +++ b/utils/libservice/utils/uninstall_service.cpp @@ -0,0 +1,32 @@ +/** + * \file + * \author Egor Tensin + * \date 2015 + * \copyright This file is licensed under the terms of the MIT License. + * See LICENSE.txt for details. + */ + +#include "libservice/all.hpp" + +#include +#include + +int main(int argc, char* argv[]) +{ + if (argc != 2) + { + std::cout << "Usage: " << argv[0] << " NAME\n"; + return 1; + } + + try + { + libservice::Service::open(libservice::ServiceManager::open(), argv[1]).uninstall(); + } + catch (const std::exception& e) + { + std::cerr << e.what() << "\n"; + return 1; + } + return 0; +} diff --git a/utils/start_service.cpp b/utils/start_service.cpp deleted file mode 100644 index 09b5b35..0000000 --- a/utils/start_service.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include "libservice/all.hpp" - -#include -#include - -int main(int argc, char* argv[]) -{ - if (argc != 2) - { - std::cout << "Usage: " << argv[0] << " NAME\n"; - return 1; - } - - try - { - libservice::Service::open(libservice::ServiceManager::open(), argv[1]).start(); - } - catch (const std::exception& e) - { - std::cerr << e.what() << "\n"; - return 1; - } - return 0; -} diff --git a/utils/stop_service.cpp b/utils/stop_service.cpp deleted file mode 100644 index 48b4c92..0000000 --- a/utils/stop_service.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include "libservice/all.hpp" - -#include -#include - -int main(int argc, char* argv[]) -{ - if (argc != 2) - { - std::cout << "Usage: " << argv[0] << " NAME\n"; - return 1; - } - - try - { - libservice::Service::open(libservice::ServiceManager::open(), argv[1]).stop(); - } - catch (const std::exception& e) - { - std::cerr << e.what() << "\n"; - return 1; - } - return 0; -} diff --git a/utils/uninstall_service.cpp b/utils/uninstall_service.cpp deleted file mode 100644 index 8497fbf..0000000 --- a/utils/uninstall_service.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** - * \file - * \author Egor Tensin - * \date 2015 - * \copyright This file is licensed under the terms of the MIT License. - * See LICENSE.txt for details. - */ - -#include "libservice/all.hpp" - -#include -#include - -int main(int argc, char* argv[]) -{ - if (argc != 2) - { - std::cout << "Usage: " << argv[0] << " NAME\n"; - return 1; - } - - try - { - libservice::Service::open(libservice::ServiceManager::open(), argv[1]).uninstall(); - } - catch (const std::exception& e) - { - std::cerr << e.what() << "\n"; - return 1; - } - return 0; -} -- cgit v1.2.3