diff --git a/src/ui/serviceinfo/serviceinfo.h b/src/ui/serviceinfo/serviceinfo.h index e9daaf22..5eae207a 100644 --- a/src/ui/serviceinfo/serviceinfo.h +++ b/src/ui/serviceinfo/serviceinfo.h @@ -7,8 +7,9 @@ class ServiceInfo { public: enum State { - StateActive = 0x01, - StateInactive = 0x02, + StateActive = 0x01, // SERVICE_ACTIVE + StateInactive = 0x02, // SERVICE_INACTIVE + StateAlive = (StateActive | StateInactive), // SERVICE_STATE_ALL StateDeleted = 0x04, }; diff --git a/src/ui/serviceinfo/serviceinfomanager.cpp b/src/ui/serviceinfo/serviceinfomanager.cpp index 437481cb..5424e16b 100644 --- a/src/ui/serviceinfo/serviceinfomanager.cpp +++ b/src/ui/serviceinfo/serviceinfomanager.cpp @@ -34,7 +34,8 @@ QVector getServiceInfoList(SC_HANDLE mngr, DWORD state = SERVICE_ST const auto serviceName = QString::fromUtf16((const char16_t *) service->lpServiceName); const RegKey svcReg(servicesReg, serviceName); - if (!svcReg.contains("ServiceSidType")) + if (!svcReg.contains("ServiceSidType") + || svcReg.value("SvcHostSplitDisable").toInt() != 0) continue; const auto imagePath = svcReg.value("ImagePath").toString(); @@ -65,13 +66,13 @@ int ServiceInfoManager::groupIndexByName(const QString &name) const return m_serviceGroups.value(name, -1); } -QVector ServiceInfoManager::loadServiceInfoList() +QVector ServiceInfoManager::loadServiceInfoList(ServiceInfo::State state) { QVector list; const SC_HANDLE mngr = OpenSCManagerW(nullptr, nullptr, SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE); if (mngr) { - list = getServiceInfoList(mngr); + list = getServiceInfoList(mngr, state); CloseServiceHandle(mngr); } return list; diff --git a/src/ui/serviceinfo/serviceinfomanager.h b/src/ui/serviceinfo/serviceinfomanager.h index d21349a4..80ff9eaa 100644 --- a/src/ui/serviceinfo/serviceinfomanager.h +++ b/src/ui/serviceinfo/serviceinfomanager.h @@ -17,7 +17,8 @@ public: int groupIndexByName(const QString &name) const; - static QVector loadServiceInfoList(); + static QVector loadServiceInfoList( + ServiceInfo::State state = ServiceInfo::StateAlive); private: QHash m_serviceGroups;