Tests: tst_confutil: Improve serviceSidsWriteRead()

This commit is contained in:
Nodir Temirkhodjaev 2024-10-29 20:40:09 +05:00
parent f884a27982
commit d93ac7503a

View File

@ -148,8 +148,47 @@ TEST_F(ConfUtilTest, serviceSidsWriteRead)
return si;
};
const QVector<ServiceInfo> services = { SVC("AJRouter"), SVC("Browser"), SVC("camsvc"),
SVC("Dhcp"), SVC("EventLog") };
const QVector<ServiceInfo> services = { SVC("AppIDSvc"), SVC("Appinfo"), SVC("AppMgmt"),
SVC("AppReadiness"), SVC("AppXSvc"), SVC("AudioEndpointBuilder"), SVC("AxInstSV"),
SVC("BFE"), SVC("BITS"), SVC("BrokerInfrastructure"), SVC("BTAGService"),
SVC("BthAvctpSvc"), SVC("bthserv"), SVC("camsvc"), SVC("CDPSvc"), SVC("CertPropSvc"),
SVC("ClipSVC"), SVC("CoreMessagingRegistrar"), SVC("DcomLaunch"),
SVC("DeviceAssociationService"), SVC("DeviceInstall"), SVC("DevQueryBroker"), SVC("Dhcp"),
SVC("DialogBlockingService"), SVC("DispBrokerDesktopSvc"), SVC("DisplayEnhancementService"),
SVC("dot3svc"), SVC("DPS"), SVC("DsmSvc"), SVC("DsSvc"), SVC("EapHost"),
SVC("embeddedmode"), SVC("EntAppSvc"), SVC("EventLog"), SVC("EventSystem"), SVC("fdPHost"),
SVC("FDResPub"), SVC("fhsvc"), SVC("FontCache"), SVC("FrameServer"), SVC("hidserv"),
SVC("icssvc"), SVC("IKEEXT"), SVC("iphlpsvc"), SVC("IpxlatCfgSvc"), SVC("KtmRm"),
SVC("LanmanServer"), SVC("LanmanWorkstation"), SVC("lfsvc"), SVC("LicenseManager"),
SVC("lltdsvc"), SVC("lmhosts"), SVC("LSM"), SVC("LxpSvc"), SVC("mpssvc"), SVC("MSiSCSI"),
SVC("MsKeyboardFilter"), SVC("NaturalAuthentication"), SVC("NcaSvc"), SVC("NcbService"),
SVC("NcdAutoSetup"), SVC("Netman"), SVC("netprofm"), SVC("NetSetupSvc"), SVC("NgcCtnrSvc"),
SVC("NgcSvc"), SVC("NlaSvc"), SVC("nsi"), SVC("PcaSvc"), SVC("PhoneSvc"), SVC("pla"),
SVC("PlugPlay"), SVC("PolicyAgent"), SVC("Power"), SVC("PrintDeviceConfigurationService"),
SVC("PrintScanBrokerService"), SVC("ProfSvc"), SVC("PushToInstall"), SVC("QWAVE"),
SVC("RasAuto"), SVC("RasMan"), SVC("RemoteAccess"), SVC("RemoteRegistry"), SVC("RmSvc"),
SVC("RpcEptMapper"), SVC("RpcSs"), SVC("SCardSvr"), SVC("ScDeviceEnum"), SVC("Schedule"),
SVC("SCPolicySvc"), SVC("seclogon"), SVC("SENS"), SVC("SensorService"), SVC("SensrSvc"),
SVC("SessionEnv"), SVC("SharedAccess"), SVC("ShellHWDetection"), SVC("shpamsvc"),
SVC("SmsRouter"), SVC("SSDPSRV"), SVC("SstpSvc"), SVC("StateRepository"), SVC("StorSvc"),
SVC("svsvc"), SVC("SysMain"), SVC("SystemEventsBroker"), SVC("TapiSrv"), SVC("TermService"),
SVC("TextInputManagementService"), SVC("Themes"), SVC("TimeBrokerSvc"), SVC("TokenBroker"),
SVC("TrkWks"), SVC("TroubleshootingSvc"), SVC("tzautoupdate"), SVC("UmRdpService"),
SVC("upnphost"), SVC("UserManager"), SVC("UsoSvc"), SVC("vmicguestinterface"),
SVC("vmicheartbeat"), SVC("vmickvpexchange"), SVC("vmicrdv"), SVC("vmicshutdown"),
SVC("vmictimesync"), SVC("vmicvmsession"), SVC("W32Time"), SVC("WaaSMedicSvc"),
SVC("WbioSrvc"), SVC("wcncsvc"), SVC("WdiServiceHost"), SVC("WdiSystemHost"),
SVC("WebClient"), SVC("webthreatdefsvc"), SVC("Wecsvc"), SVC("WEPHOSTSVC"),
SVC("wercplsupport"), SVC("WFDSConMgrSvc"), SVC("WiaRpc"), SVC("WinHttpAutoProxySvc"),
SVC("Winmgmt"), SVC("WinRM"), SVC("wisvc"), SVC("wlidsvc"), SVC("wlpasvc"), SVC("WManSvc"),
SVC("WPDBusEnum"), SVC("WpnService"), SVC("wuauserv"), SVC("WwanSvc"),
SVC("XblAuthManager"), SVC("XblGameSave"), SVC("XboxGipSvc"), SVC("XboxNetApiSvc"),
SVC("AarSvc"), SVC("BcastDVRUserService"), SVC("CaptureService"), SVC("cbdhsvc"),
SVC("CDPUserSvc"), SVC("ConsentUxUserSvc"), SVC("DeviceAssociationBrokerSvc"),
SVC("DevicePickerUserSvc"), SVC("DevicesFlowUserSvc"), SVC("MessagingService"),
SVC("NPSMSvc"), SVC("PimIndexMaintenanceSvc"), SVC("PrintWorkflowUserSvc"),
SVC("UdkUserSvc"), SVC("UnistoreSvc"), SVC("UserDataSvc"), SVC("webthreatdefusersvc"),
SVC("WpnUserService") };
ConfBuffer confBuf;
@ -163,18 +202,18 @@ TEST_F(ConfUtilTest, serviceSidsWriteRead)
PCFORT_SERVICE_SID_LIST service_sids = PCFORT_SERVICE_SID_LIST(buffer.data());
// Find Service Name by SID
{
const QLatin1String name("Dhcp");
const auto sid = StringUtil::serviceSid(name);
for (const auto &si : services) {
const auto sid = StringUtil::serviceSid(si.realServiceName);
const auto name = DriverCommon::confServiceSidNameFind(service_sids, sid);
ASSERT_EQ(sid.size(), FORT_SERVICE_SID_SIZE);
ASSERT_EQ(DriverCommon::confServiceSidNameFind(service_sids, sid), name);
ASSERT_EQ(name, si.serviceName.toLower());
}
// Can't Find Service Name by SID
// Find Invalid Service Name by SID
{
const auto sid = StringUtil::serviceSid("Bad");
ASSERT_EQ(sid.size(), FORT_SERVICE_SID_SIZE);
ASSERT_EQ(DriverCommon::confServiceSidNameFind(service_sids, sid), QString());
}
}