Get full service details given an SCM handle and a service key name.
(scm: SC_HANDLE, service_name: &str)
| 510 | |
| 511 | /// Get full service details given an SCM handle and a service key name. |
| 512 | unsafe fn get_service_details(scm: SC_HANDLE, service_name: &str) -> Result<WindowsService, ServiceError> { |
| 513 | let name_wide = to_wide(service_name); |
| 514 | let service_handle = unsafe { |
| 515 | OpenServiceW( |
| 516 | scm, |
| 517 | PCWSTR(name_wide.as_ptr()), |
| 518 | SERVICE_QUERY_CONFIG | SERVICE_QUERY_STATUS, |
| 519 | ) |
| 520 | } |
| 521 | .map_err(|e| ServiceError::from(t!("export.openServiceFailed", name = service_name, error = e.to_string()).to_string()))?; |
| 522 | let service_handle = ScHandle(service_handle); |
| 523 | |
| 524 | unsafe { read_service_state(service_handle.0, service_name) } |
| 525 | } |
| 526 | |
| 527 | /// Match a string against a pattern supporting `*` wildcards. |
| 528 | /// If no wildcard is present, performs an exact case-insensitive comparison. |
no test coverage detected