Skip to content

Commit

Permalink
Merge remote-tracking branch 'dilawar/subcom'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Jul 14, 2023
2 parents 6929c4b + 9241244 commit d42acdb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ edition = "2021"
default-target = "x86_64-pc-windows-msvc"

[target.'cfg(windows)'.dependencies]
bitflags = "1.3"
bitflags = "2.3"
widestring = "1"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.45.0"
version = "0.48.0"
features = [
"Win32_Foundation",
"Win32_Security",
Expand All @@ -27,6 +27,7 @@ features = [
"Win32_System_RemoteDesktop",
"Win32_System_Services",
"Win32_System_SystemServices",
"Win32_System_Threading",
"Win32_System_WindowsProgramming",
"Win32_UI_WindowsAndMessaging",
]
15 changes: 9 additions & 6 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use windows_sys::{
Win32::{
Foundation::{ERROR_SERVICE_SPECIFIC_ERROR, NO_ERROR},
Storage::FileSystem,
System::{Power, RemoteDesktop, Services, SystemServices, WindowsProgramming::INFINITE},
System::{Power, RemoteDesktop, Services, SystemServices, Threading::INFINITE},
UI::WindowsAndMessaging,
},
};
Expand All @@ -25,6 +25,7 @@ use crate::{double_nul_terminated, Error};

bitflags::bitflags! {
/// Enum describing the types of Windows services.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ServiceType: u32 {
/// File system driver service.
const FILE_SYSTEM_DRIVER = Services::SERVICE_FILE_SYSTEM_DRIVER;
Expand All @@ -51,6 +52,7 @@ bitflags::bitflags! {

bitflags::bitflags! {
/// Flags describing the access permissions when working with services
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ServiceAccess: u32 {
/// Can query the service status
const QUERY_STATUS = Services::SERVICE_QUERY_STATUS;
Expand Down Expand Up @@ -565,9 +567,9 @@ impl ServiceConfig {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(u32)]
pub enum HardwareProfileChangeParam {
ConfigChanged = SystemServices::DBT_CONFIGCHANGED,
QueryChangeConfig = SystemServices::DBT_QUERYCHANGECONFIG,
ConfigChangeCanceled = SystemServices::DBT_CONFIGCHANGECANCELED,
ConfigChanged = WindowsAndMessaging::DBT_CONFIGCHANGED,
QueryChangeConfig = WindowsAndMessaging::DBT_QUERYCHANGECONFIG,
ConfigChangeCanceled = WindowsAndMessaging::DBT_CONFIGCHANGECANCELED,
}

impl HardwareProfileChangeParam {
Expand Down Expand Up @@ -647,8 +649,8 @@ impl DisplayState {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(i32)]
pub enum UserStatus {
Present = SystemServices::PowerUserPresent,
Inactive = SystemServices::PowerUserInactive,
Present = Power::PowerUserPresent,
Inactive = Power::PowerUserInactive,
}

impl UserStatus {
Expand Down Expand Up @@ -1187,6 +1189,7 @@ impl<'a> From<&'a Services::SERVICE_STATUS_PROCESS> for ServiceExitCode {

bitflags::bitflags! {
/// Flags describing accepted types of service control events.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct ServiceControlAccept: u32 {
/// The service is a network component that can accept changes in its binding without being
/// stopped and restarted. This allows service to receive `ServiceControl::Netbind*`
Expand Down
1 change: 1 addition & 0 deletions src/service_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::{Error, Result};

bitflags::bitflags! {
/// Flags describing access permissions for [`ServiceManager`].
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Copy, Clone, Hash)]
pub struct ServiceManagerAccess: u32 {
/// Can connect to service control manager.
const CONNECT = Services::SC_MANAGER_CONNECT;
Expand Down

0 comments on commit d42acdb

Please sign in to comment.