MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / IsPatchEnabled

Function IsPatchEnabled

rEFIt_UEFI/Platform/Settings.cpp:1380–1407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1378}
1379
1380BOOLEAN
1381IsPatchEnabled (const XString8& MatchOSEntry, const XString8& CurrOS)
1382{
1383 BOOLEAN ret = FALSE;
1384
1385 if (MatchOSEntry.isEmpty() || CurrOS.isEmpty()) {
1386 return TRUE; //undefined matched corresponds to old behavior
1387 }
1388
1389 XString8Array mos = Split<XString8Array>(MatchOSEntry, ","_XS8).trimEachString();
1390
1391 if ( mos[0] == "All"_XS8) {
1392 return TRUE;
1393 }
1394
1395 for (size_t i = 0; i < mos.size(); ++i) {
1396 // dot represent MatchOS
1397 if (
1398 ( mos[i].contains("."_XS8) && IsOSValid(mos[i], CurrOS)) || // MatchOS
1399 ( mos[i].contains(CurrOS) ) // MatchBuild
1400 ) {
1401 //DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]);
1402 ret = TRUE;
1403 break;
1404 }
1405 }
1406 return ret;
1407}
1408
1409
1410BOOLEAN IsOSValid(const XString8& MatchOS, const XString8& CurrOS)

Callers 3

FilterKextPatchesMethod · 0.85
FilterKernelPatchesMethod · 0.85
FilterBootPatchesMethod · 0.85

Calls 5

IsOSValidFunction · 0.85
trimEachStringMethod · 0.80
isEmptyMethod · 0.45
sizeMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected