diff options
| author | Dan Engelbrecht <[email protected]> | 2025-01-08 13:49:56 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2025-01-08 13:49:56 +0100 |
| commit | 995aec217bbb26c9c2a701cc77edb067ffbf8d36 (patch) | |
| tree | 2da2d3fd806547bd9f38bc190514abbf9fdb6361 /src/zenutil/include | |
| parent | check if service is already installed before attempting install (diff) | |
| download | zen-995aec217bbb26c9c2a701cc77edb067ffbf8d36.tar.xz zen-995aec217bbb26c9c2a701cc77edb067ffbf8d36.zip | |
add ServiceLevel for service processes: User, AllUsers and Service
Diffstat (limited to 'src/zenutil/include')
| -rw-r--r-- | src/zenutil/include/zenutil/service.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/zenutil/include/zenutil/service.h b/src/zenutil/include/zenutil/service.h index cd769b67b..1a0ebc235 100644 --- a/src/zenutil/include/zenutil/service.h +++ b/src/zenutil/include/zenutil/service.h @@ -6,8 +6,16 @@ namespace zen { +enum class ServiceLevel +{ + CurrentUser, + AllUsers, + SystemService +}; + struct ServiceSpec { + ServiceLevel ServiceLevel = ServiceLevel::CurrentUser; std::filesystem::path ExecutablePath; std::string CommandLineOptions; std::string DisplayName; @@ -26,6 +34,9 @@ enum class ServiceStatus Resuming }; +std::string_view ToString(ServiceLevel Level); +std::optional<ServiceLevel> FromString(const std::string& Level); + struct ServiceInfo { ServiceStatus Status; @@ -35,8 +46,8 @@ struct ServiceInfo std::string_view ToString(ServiceStatus Status); std::error_code InstallService(std::string_view ServiceName, const ServiceSpec& Spec); -std::error_code UninstallService(std::string_view ServiceName); +std::error_code UninstallService(std::string_view ServiceName, ServiceLevel Level); std::error_code QueryInstalledService(std::string_view ServiceName, ServiceInfo& OutInfo); -std::error_code StartService(std::string_view ServiceName); -std::error_code StopService(std::string_view ServiceName); +std::error_code StartService(std::string_view ServiceName, ServiceLevel Level); +std::error_code StopService(std::string_view ServiceName, ServiceLevel Level); } // namespace zen |