2021-02-06 18:16:46 +01:00
|
|
|
/*
|
|
|
|
* KERNEL_AND_KEXT_PATCHES.cpp
|
|
|
|
*
|
|
|
|
* Created on: 4 Feb 2021
|
|
|
|
* Author: jief
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "KERNEL_AND_KEXT_PATCHES.h"
|
|
|
|
#include "MacOsVersion.h"
|
|
|
|
|
2021-09-28 15:54:31 +02:00
|
|
|
XBool ABSTRACT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build)
|
2021-02-06 18:16:46 +01:00
|
|
|
{
|
2021-09-28 10:28:45 +02:00
|
|
|
XBool ret = false;
|
2021-02-06 18:16:46 +01:00
|
|
|
|
|
|
|
if (MatchBuild.isEmpty() || Build.isEmpty()) {
|
2021-09-28 10:28:45 +02:00
|
|
|
return true; //undefined matched corresponds to old behavior
|
2021-02-06 18:16:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
XString8Array mos = Split<XString8Array>(MatchBuild, ","_XS8).trimEachString();
|
|
|
|
|
|
|
|
if ( mos[0] == "All"_XS8) {
|
2021-09-28 10:28:45 +02:00
|
|
|
return true;
|
2021-02-06 18:16:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < mos.size(); ++i) {
|
|
|
|
// dot represent MatchOS
|
|
|
|
MacOsVersion mosv = mos[i];
|
2021-12-24 19:22:53 +01:00
|
|
|
MsgLog("\n check matchBuild %s\n", mos[i].c_str());
|
2021-02-06 18:16:46 +01:00
|
|
|
if ( mos[i].contains(Build) ) { // MatchBuild
|
|
|
|
//DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]);
|
2021-09-28 10:28:45 +02:00
|
|
|
ret = true;
|
2021-02-06 18:16:46 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-28 15:54:31 +02:00
|
|
|
XBool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS)
|
2021-02-06 18:16:46 +01:00
|
|
|
{
|
2021-09-28 10:28:45 +02:00
|
|
|
XBool ret = false;
|
2021-02-06 18:16:46 +01:00
|
|
|
|
|
|
|
if (MatchOS.isEmpty() || CurrOS.isEmpty()) {
|
2021-09-28 10:28:45 +02:00
|
|
|
return true; //undefined matched corresponds to old behavior
|
2021-02-06 18:16:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
XString8Array mos = Split<XString8Array>(MatchOS, ","_XS8).trimEachString();
|
|
|
|
|
|
|
|
if ( mos[0] == "All"_XS8) {
|
2021-09-28 10:28:45 +02:00
|
|
|
return true;
|
2021-02-06 18:16:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < mos.size(); ++i) {
|
|
|
|
// dot represent MatchOS
|
|
|
|
MacOsVersion mosv = mos[i];
|
2021-12-24 19:22:53 +01:00
|
|
|
MsgLog("\n check MatchOS %s\n", mos[i].c_str());
|
2021-02-06 18:16:46 +01:00
|
|
|
if ( CurrOS.match(mos[i]) ) {
|
|
|
|
//DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]);
|
2021-09-28 10:28:45 +02:00
|
|
|
ret = true;
|
2021-02-06 18:16:46 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2021-09-28 15:54:31 +02:00
|
|
|
//XBool KERNEL_AND_KEXT_PATCHES::IsPatchEnabledByBuildNumber(const XString8& Build)
|
2021-02-06 18:16:46 +01:00
|
|
|
//{
|
2021-09-28 10:28:45 +02:00
|
|
|
// XBool ret = false;
|
2021-02-06 18:16:46 +01:00
|
|
|
//
|
|
|
|
// if (MatchBuild.isEmpty() || Build.isEmpty()) {
|
2021-09-28 10:28:45 +02:00
|
|
|
// return true; //undefined matched corresponds to old behavior
|
2021-02-06 18:16:46 +01:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// XString8Array mos = Split<XString8Array>(MatchBuild, ","_XS8).trimEachString();
|
|
|
|
//
|
|
|
|
// if ( mos[0] == "All"_XS8) {
|
2021-09-28 10:28:45 +02:00
|
|
|
// return true;
|
2021-02-06 18:16:46 +01:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// for (size_t i = 0; i < mos.size(); ++i) {
|
|
|
|
// // dot represent MatchOS
|
|
|
|
// MacOsVersion mosv = mos[i];
|
|
|
|
// if ( mos[i].contains(Build) ) { // MatchBuild
|
|
|
|
// //DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]);
|
2021-09-28 10:28:45 +02:00
|
|
|
// ret = true;
|
2021-02-06 18:16:46 +01:00
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return ret;
|
|
|
|
//}
|