MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / getService

Function getService

src/env.cpp:618–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616}
617
618Service 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
646std::optional<QString> getAssocString(const QFileInfo& file, ASSOCSTR astr)
647{

Callers

nothing calls this directly

Calls 4

ServiceClass · 0.85
getServiceStartTypeFunction · 0.85
getServiceStatusFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected