Skip to content

Commit

Permalink
Expose raw service handle
Browse files Browse the repository at this point in the history
  • Loading branch information
NuSkooler committed Jan 16, 2024
1 parent d754b99 commit 96bebe1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "windows-service"
version = "0.6.0"
version = "0.6.1"
description = "A crate that provides facilities for management and implementation of windows services"
readme = "README.md"
authors = ["Mullvad VPN"]
Expand Down
5 changes: 5 additions & 0 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use windows_sys::{
Win32::{
Foundation::{ERROR_SERVICE_SPECIFIC_ERROR, NO_ERROR},
Storage::FileSystem,
Security,
System::{Power, RemoteDesktop, Services, SystemServices, Threading::INFINITE},
UI::WindowsAndMessaging,
},
Expand Down Expand Up @@ -1843,6 +1844,10 @@ impl Service {
}
}

pub fn raw_service_handle(&self) -> Security::SC_HANDLE {
self.service_handle.raw_handle()
}

/// Private helper to send the control commands to the system.
fn send_control_command(&self, command: ServiceControl) -> crate::Result<ServiceStatus> {
let mut raw_status = unsafe { mem::zeroed::<Services::SERVICE_STATUS>() };
Expand Down

0 comments on commit 96bebe1

Please sign in to comment.