| 616 | } |
| 617 | |
| 618 | Service getService(const QString& name) |
| 619 | { |
| 620 | // service manager |
| 621 | const LocalPtr<SC_HANDLE> scm( |
| 622 | OpenSCManager(NULL, NULL, SERVICE_QUERY_STATUS | SERVICE_QUERY_CONFIG)); |
| 623 | |
| 624 | if (!scm) { |
| 625 | const auto e = GetLastError(); |
| 626 | log::error("OpenSCManager() failed, {}", formatSystemMessage(e)); |
| 627 | return Service(name); |
| 628 | } |
| 629 | |
| 630 | // service |
| 631 | const LocalPtr<SC_HANDLE> s(OpenService(scm.get(), name.toStdWString().c_str(), |
| 632 | SERVICE_QUERY_STATUS | SERVICE_QUERY_CONFIG)); |
| 633 | |
| 634 | if (!s) { |
| 635 | const auto e = GetLastError(); |
| 636 | log::error("OpenService() failed for '{}', {}", name, formatSystemMessage(e)); |
| 637 | return Service(name); |
| 638 | } |
| 639 | |
| 640 | const auto startType = getServiceStartType(s.get(), name); |
| 641 | const auto status = getServiceStatus(s.get(), name); |
| 642 | |
| 643 | return {name, startType, status}; |
| 644 | } |
| 645 | |
| 646 | std::optional<QString> getAssocString(const QFileInfo& file, ASSOCSTR astr) |
| 647 | { |
nothing calls this directly
no test coverage detected