| 352 | } |
| 353 | |
| 354 | bool CServiceTable::CompareItems(const WinSys::ServiceInfo& s1, const WinSys::ServiceInfo& s2, int col, bool asc) { |
| 355 | |
| 356 | switch (static_cast<ServiceColumn>(col)) |
| 357 | { |
| 358 | case ServiceColumn::Name: |
| 359 | return SortHelper::SortStrings(s1.GetName(), s2.GetName(), asc); |
| 360 | case ServiceColumn::DisplayName: |
| 361 | return SortHelper::SortStrings(s1.GetDisplayName(), s2.GetDisplayName(), asc); |
| 362 | case ServiceColumn::State: |
| 363 | return SortHelper::SortStrings( |
| 364 | ServiceStateToString(s1.GetStatusProcess().CurrentState), |
| 365 | ServiceStateToString(s2.GetStatusProcess().CurrentState), |
| 366 | asc); |
| 367 | case ServiceColumn::Type: |
| 368 | return SortHelper::SortNumbers(s1.GetStatusProcess().Type, s2.GetStatusProcess().Type, asc); |
| 369 | case ServiceColumn::PID: |
| 370 | return SortHelper::SortNumbers(s1.GetStatusProcess().ProcessId, s2.GetStatusProcess().ProcessId, asc); |
| 371 | case ServiceColumn::ProcessName: |
| 372 | return SortHelper::SortStrings( |
| 373 | m_ProcMgr.GetProcessNameById(s1.GetStatusProcess().ProcessId), |
| 374 | m_ProcMgr.GetProcessNameById(s2.GetStatusProcess().ProcessId), |
| 375 | asc); |
| 376 | case ServiceColumn::StartType: |
| 377 | return SortHelper::SortStrings( |
| 378 | ServiceStartTypeToString(*GetServiceInfoEx(s1.GetName()).GetConfiguration()), |
| 379 | ServiceStartTypeToString(*GetServiceInfoEx(s2.GetName()).GetConfiguration()), |
| 380 | asc |
| 381 | ); |
| 382 | case ServiceColumn::BinaryPath: |
| 383 | return SortHelper::SortStrings( |
| 384 | GetServiceInfoEx(s1.GetName()).GetConfiguration()->BinaryPathName, |
| 385 | GetServiceInfoEx(s2.GetName()).GetConfiguration()->BinaryPathName, |
| 386 | asc |
| 387 | ); |
| 388 | case ServiceColumn::AccountName: |
| 389 | return SortHelper::SortStrings( |
| 390 | GetServiceInfoEx(s1.GetName()).GetConfiguration()->AccountName, |
| 391 | GetServiceInfoEx(s2.GetName()).GetConfiguration()->AccountName, |
| 392 | asc |
| 393 | ); |
| 394 | case ServiceColumn::ErrorControl: |
| 395 | return SortHelper::SortNumbers( |
| 396 | GetServiceInfoEx(s1.GetName()).GetConfiguration()->ErrorControl, |
| 397 | GetServiceInfoEx(s2.GetName()).GetConfiguration()->ErrorControl, |
| 398 | asc |
| 399 | ); |
| 400 | case ServiceColumn::Description: |
| 401 | return SortHelper::SortStrings( |
| 402 | GetServiceInfoEx(s1.GetName()).GetDescription(), |
| 403 | GetServiceInfoEx(s2.GetName()).GetDescription(), |
| 404 | asc |
| 405 | ); |
| 406 | case ServiceColumn::Privileges: |
| 407 | return SortHelper::SortStrings( |
| 408 | GetServiceInfoEx(s1.GetName()).GetPrivileges(), |
| 409 | GetServiceInfoEx(s2.GetName()).GetPrivileges(), |
| 410 | asc |
| 411 | ); |
nothing calls this directly
no test coverage detected