UI: Services: Fix list loading.

This commit is contained in:
Nodir Temirkhodjaev 2021-06-25 18:26:53 +03:00
parent f42fc60147
commit f42e9e1ecb
2 changed files with 6 additions and 3 deletions

View File

@ -20,6 +20,8 @@ ServicesPage::ServicesPage(OptionsController *ctrl, QWidget *parent) :
OptBasePage(ctrl, parent), m_serviceListModel(new ServiceListModel(this)) OptBasePage(ctrl, parent), m_serviceListModel(new ServiceListModel(this))
{ {
setupUi(); setupUi();
serviceListModel()->initialize();
} }
ServiceInfoManager *ServicesPage::serviceInfoManager() const ServiceInfoManager *ServicesPage::serviceInfoManager() const
@ -132,7 +134,7 @@ void ServicesPage::setupTableServiceListHeader()
header->setSectionResizeMode(1, QHeaderView::Stretch); header->setSectionResizeMode(1, QHeaderView::Stretch);
header->setSectionResizeMode(2, QHeaderView::Interactive); header->setSectionResizeMode(2, QHeaderView::Interactive);
header->resizeSection(0, 100); header->resizeSection(0, 250);
header->resizeSection(1, 350); header->resizeSection(1, 350);
header->resizeSection(2, 90); header->resizeSection(2, 90);
} }

View File

@ -16,8 +16,9 @@ QVector<ServiceInfo> getServiceInfoList(SC_HANDLE mngr)
DWORD resumePoint = 0; DWORD resumePoint = 0;
while (EnumServicesStatusExW(mngr, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_STATE_ALL, while (EnumServicesStatusExW(mngr, SC_ENUM_PROCESS_INFO, SERVICE_WIN32, SERVICE_STATE_ALL,
(LPBYTE) buffer, sizeof(buffer), &bytesRemaining, &serviceCount, &resumePoint, (LPBYTE) buffer, sizeof(buffer), &bytesRemaining, &serviceCount, &resumePoint,
nullptr)) { nullptr)
|| GetLastError() == ERROR_MORE_DATA) {
int infoIndex = infoList.size(); int infoIndex = infoList.size();
infoList.resize(infoIndex + serviceCount); infoList.resize(infoIndex + serviceCount);