Skip to content

Commit

Permalink
Bump windows-sys version
Browse files Browse the repository at this point in the history
  • Loading branch information
zaddach committed Oct 22, 2024
1 parent 96efa4e commit a2a5c67
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bitflags = "2.3"
widestring = "1"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.52.0"
version = "0.59.0"
features = [
"Win32_Foundation",
"Win32_Security",
Expand Down
8 changes: 4 additions & 4 deletions src/sc_handle.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use windows_sys::Win32::{Security, System::Services};
use windows_sys::Win32::System::Services;

/// A handle holder that wraps a low level [`Security::SC_HANDLE`].
pub(crate) struct ScHandle(Security::SC_HANDLE);
pub(crate) struct ScHandle(Services::SC_HANDLE);

impl ScHandle {
pub(crate) unsafe fn new(handle: Security::SC_HANDLE) -> Self {
pub(crate) unsafe fn new(handle: Services::SC_HANDLE) -> Self {
ScHandle(handle)
}

/// Returns underlying [`Security::SC_HANDLE`].
pub(crate) fn raw_handle(&self) -> Security::SC_HANDLE {
pub(crate) fn raw_handle(&self) -> Services::SC_HANDLE {
self.0
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ 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 @@ -1454,7 +1453,7 @@ impl Service {
}

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

Expand Down
2 changes: 1 addition & 1 deletion src/service_control_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ where
)
};

if status_handle == 0 {
if status_handle.is_null() {
// Release the `event_handler` in case of an error.
let _: Box<F> = unsafe { Box::from_raw(context) };
Err(Error::Winapi(io::Error::last_os_error()))
Expand Down
6 changes: 3 additions & 3 deletions src/service_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl ServiceManager {
)
};

if handle == 0 {
if handle.is_null() {
Err(Error::Winapi(io::Error::last_os_error()))
} else {
Ok(ServiceManager {
Expand Down Expand Up @@ -168,7 +168,7 @@ impl ServiceManager {
)
};

if service_handle == 0 {
if service_handle.is_null() {
Err(Error::Winapi(io::Error::last_os_error()))
} else {
Ok(Service::new(unsafe { ScHandle::new(service_handle) }))
Expand Down Expand Up @@ -209,7 +209,7 @@ impl ServiceManager {
)
};

if service_handle == 0 {
if service_handle.is_null() {
Err(Error::Winapi(io::Error::last_os_error()))
} else {
Ok(Service::new(unsafe { ScHandle::new(service_handle) }))
Expand Down

0 comments on commit a2a5c67

Please sign in to comment.