Check whether the service is configured for delayed automatic start.
(service_handle: SC_HANDLE)
| 278 | |
| 279 | /// Check whether the service is configured for delayed automatic start. |
| 280 | unsafe fn is_delayed_auto_start(service_handle: SC_HANDLE) -> bool { |
| 281 | let mut bytes_needed: u32 = 0; |
| 282 | let _ = unsafe { |
| 283 | QueryServiceConfig2W( |
| 284 | service_handle, |
| 285 | SERVICE_CONFIG_DELAYED_AUTO_START_INFO, |
| 286 | None, |
| 287 | &mut bytes_needed, |
| 288 | ) |
| 289 | }; |
| 290 | |
| 291 | if bytes_needed == 0 { |
| 292 | return false; |
| 293 | } |
| 294 | |
| 295 | let mut buffer = vec![0u8; bytes_needed as usize]; |
| 296 | if unsafe { |
| 297 | QueryServiceConfig2W( |
| 298 | service_handle, |
| 299 | SERVICE_CONFIG_DELAYED_AUTO_START_INFO, |
| 300 | Some(&mut buffer), |
| 301 | &mut bytes_needed, |
| 302 | ) |
| 303 | } |
| 304 | .is_ok() |
| 305 | { |
| 306 | let info = |
| 307 | unsafe { &*(buffer.as_ptr().cast::<SERVICE_DELAYED_AUTO_START_INFO>()) }; |
| 308 | info.fDelayedAutostart.as_bool() |
| 309 | } else { |
| 310 | false |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /// Query the service description string. |
| 315 | unsafe fn query_description(service_handle: SC_HANDLE) -> Option<String> { |
no outgoing calls
no test coverage detected