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

Bump windows-sys version to 0.59 #133

Merged
merged 7 commits into from
Oct 23, 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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# but it should be mentioned in the changelog,
# and `rust-version` in Cargo.toml should be updated.
- target: x86_64-pc-windows-msvc
rust: 1.58.0
rust: 1.60.0

runs-on: windows-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Upgrade `windows-sys` dependency to 0.59 and bump the MSRV to 1.60.0


## [0.7.0] - 2024-04-12
Expand Down
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/mullvad/windows-service-rs"
license = "MIT OR Apache-2.0"
edition = "2021"
# Keep in sync with CI job in `build-and-test.yml`
rust-version = "1.58.0"
rust-version = "1.60.0"

[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
Expand All @@ -20,10 +20,9 @@ bitflags = "2.3"
widestring = "1"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.52.0"
version = "0.59.0"
features = [
"Win32_Foundation",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_System_Power",
"Win32_System_RemoteDesktop",
Expand Down
12 changes: 6 additions & 6 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);
/// A handle holder that wraps a low level [`Services::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 {
/// Returns underlying [`Services::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
Loading