From 985b385c2b78664fb47d3f6a367507530a25fd79 Mon Sep 17 00:00:00 2001 From: Kento Oki Date: Thu, 21 Dec 2023 04:03:59 +0900 Subject: [PATCH 1/4] add `SystemStart` and `BootStart` start types --- src/service.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/service.rs b/src/service.rs index b7ef62a..596a673 100644 --- a/src/service.rs +++ b/src/service.rs @@ -93,6 +93,10 @@ pub enum ServiceStartType { OnDemand = Services::SERVICE_DEMAND_START, /// Disabled service Disabled = Services::SERVICE_DISABLED, + /// Start on system startup + SystemStart = Services::SERVICE_SYSTEM_START, + /// Start on OS boot + BootStart = Services::SERVICE_BOOT_START, } impl ServiceStartType { @@ -105,6 +109,8 @@ impl ServiceStartType { x if x == ServiceStartType::AutoStart.to_raw() => Ok(ServiceStartType::AutoStart), x if x == ServiceStartType::OnDemand.to_raw() => Ok(ServiceStartType::OnDemand), x if x == ServiceStartType::Disabled.to_raw() => Ok(ServiceStartType::Disabled), + x if x == ServiceStartType::SystemStart.to_raw() => Ok(ServiceStartType::SystemStart), + x if x == ServiceStartType::BootStart.to_raw() => Ok(ServiceStartType::BootStart), _ => Err(ParseRawError::InvalidInteger(raw)), } } From 6f9cd4f498aa3ed74f6bddf7f6d95d4e92e94486 Mon Sep 17 00:00:00 2001 From: Kento Oki Date: Thu, 21 Dec 2023 05:06:42 +0900 Subject: [PATCH 2/4] more precise docs comment --- src/service.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/service.rs b/src/service.rs index 596a673..eac2532 100644 --- a/src/service.rs +++ b/src/service.rs @@ -93,9 +93,11 @@ pub enum ServiceStartType { OnDemand = Services::SERVICE_DEMAND_START, /// Disabled service Disabled = Services::SERVICE_DISABLED, - /// Start on system startup + /// Driver start on system startup. + /// This start type is only applicable to driver services. SystemStart = Services::SERVICE_SYSTEM_START, - /// Start on OS boot + /// Driver start on OS boot. + /// This start type is only applicable to driver services. BootStart = Services::SERVICE_BOOT_START, } From 81331bced5f8d2fe4df071cad2409c859303f46d Mon Sep 17 00:00:00 2001 From: Kento Oki Date: Fri, 22 Dec 2023 09:44:04 +0900 Subject: [PATCH 3/4] add ` #[non_exhaustive]` attribute for backwards compatibility --- src/service.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/service.rs b/src/service.rs index eac2532..02b25b7 100644 --- a/src/service.rs +++ b/src/service.rs @@ -86,6 +86,7 @@ bitflags::bitflags! { /// Enum describing the start options for windows services. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[repr(u32)] +#[non_exhaustive] pub enum ServiceStartType { /// Autostart on system startup AutoStart = Services::SERVICE_AUTO_START, From d450630322e9c5897855dd10f3040cedffa77a77 Mon Sep 17 00:00:00 2001 From: Kento Oki Date: Wed, 27 Dec 2023 20:51:53 +0900 Subject: [PATCH 4/4] remove `#[non_exhaustive]` from `ServiceStartType` --- src/service.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/service.rs b/src/service.rs index 02b25b7..eac2532 100644 --- a/src/service.rs +++ b/src/service.rs @@ -86,7 +86,6 @@ bitflags::bitflags! { /// Enum describing the start options for windows services. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[repr(u32)] -#[non_exhaustive] pub enum ServiceStartType { /// Autostart on system startup AutoStart = Services::SERVICE_AUTO_START,