Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some missing flags and expose service handle #115

Merged
merged 5 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use windows_sys::{
core::GUID,
Win32::{
Foundation::{ERROR_SERVICE_SPECIFIC_ERROR, NO_ERROR},
Security,
Storage::FileSystem,
System::{Power, RemoteDesktop, Services, SystemServices, Threading::INFINITE},
UI::WindowsAndMessaging,
Expand Down Expand Up @@ -80,6 +81,9 @@ bitflags::bitflags! {

/// Can use user-defined control codes
const USER_DEFINED_CONTROL = Services::SERVICE_USER_DEFINED_CONTROL;

/// Full access to the service object
const ALL_ACCESS = Services::SERVICE_ALL_ACCESS;
faern marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -1438,6 +1442,11 @@ impl Service {
Service { service_handle }
}

/// Provides access to the underlying system service handle
pub fn raw_handle(&self) -> Security::SC_HANDLE {
self.service_handle.raw_handle()
}

/// Start the service.
///
/// # Example
Expand Down
3 changes: 3 additions & 0 deletions src/service_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ bitflags::bitflags! {

/// Can enumerate services or receive notifications.
const ENUMERATE_SERVICE = Services::SC_MANAGER_ENUMERATE_SERVICE;

/// Includes all possible access rights.
const ALL_ACCESS = Services::SC_MANAGER_ALL_ACCESS;
faern marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Loading