diff --git a/Changelog.md b/Changelog.md index b5e2de1..f8179bc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ RestrictEvents Changelog #### v1.0.8 - Added constants for macOS 13 support - Do not enable Memory and PCI UI patching on real Macs in `auto` mode +- Added `MacPro7,1` memory patch for macOS 13 `System Settings`->`General`->`About` #### v1.0.7 - Fixed detecting CPU core count on Intel CPU with altered topology diff --git a/RestrictEvents/RestrictEvents.cpp b/RestrictEvents/RestrictEvents.cpp index 910e392..8a03370 100644 --- a/RestrictEvents/RestrictEvents.cpp +++ b/RestrictEvents/RestrictEvents.cpp @@ -39,6 +39,7 @@ static const char *binPathSystemInformation; static const char binPathSystemInformationLegacy[] = "/Applications/Utilities/System Information.app/Contents/MacOS/System Information"; static const char binPathSystemInformationCatalina[] = "/System/Applications/Utilities/System Information.app/Contents/MacOS/System Information"; static const char binPathSPMemoryReporter[] = "/System/Library/SystemProfiler/SPMemoryReporter.spreporter/Contents/MacOS/SPMemoryReporter"; +static const char binPathAboutExtension[] = "/System/Library/ExtensionKit/Extensions/AboutExtension.appex/Contents/MacOS/AboutExtension"; static const char binPathDiskArbitrationAgent[] = "/System/Library/Frameworks/DiskArbitration.framework/Versions/A/Support/DiskArbitrationAgent"; @@ -120,7 +121,12 @@ struct RestrictEventsPolicy { // Mavericks has the MacBookAir/MacBookPro10 whitelist in System Information and SPMemoryReporter. // Yosemite and newer have the MacBookAir/MacBookPro10 whitelist in System Information, SPMemoryReporter, and AppleSystemInfo.framework. // - if (modelFindPatch != nullptr && UNLIKELY(strcmp(path, binPathSystemInformation) == 0)) { + if (modelFindPatch != nullptr && getKernelVersion() >= KernelVersion::Ventura && UNLIKELY(strcmp(path, binPathAboutExtension) == 0)) { + if (UNLIKELY(KernelPatcher::findAndReplace(const_cast(data), size, modelFindPatch, modelFindSize, modelReplPatch, modelFindSize))) { + DBGLOG("rev", "patched %s in AboutExtension", reinterpret_cast(modelFindPatch)); + return; + } + } else if (modelFindPatch != nullptr && UNLIKELY(strcmp(path, binPathSystemInformation) == 0)) { if (UNLIKELY(KernelPatcher::findAndReplace(const_cast(data), size, modelFindPatch, modelFindSize, modelReplPatch, modelFindSize))) { DBGLOG("rev", "patched %s in System Information.app", reinterpret_cast(modelFindPatch)); return; @@ -461,9 +467,11 @@ PluginConfiguration ADDPR(config) { if (enableMemoryUiPatching | enablePciUiPatching) { // Rename existing values to invalid ones to avoid matching. if (strcmp(di.modelIdentifier, "MacPro7,1") == 0) { - modelFindPatch = "MacPro7,1"; - modelReplPatch = "HacPro7,1"; - modelFindSize = sizeof("MacPro7,1"); + // on 13.0 MacPro7,1 string literal is inlined, but "MacPro7," will do the matching. + modelFindPatch = "MacPro7,"; + modelReplPatch = "HacPro7,"; + // partial matching, thus exclude '\0'. + modelFindSize = sizeof("MacPro7,") - 1; DBGLOG("rev", "detected MP71"); } else if (strncmp(di.modelIdentifier, "MacBookAir", strlen("MacBookAir")) == 0) { needsMemPatch = true;