So I’m now getting proper returns from KextManagerCopyLoadedKextInfo (THANK YOU SHANE!)
And I’m trying to do some conversions with the returned data. The weirdness is in that I’m sometimes successful, sometimes not. For example this is the current main body of the code:
on applicationWillFinishLaunching_(aNotification)
--this executest the method n kextlister2.m, which is returned as an NSDictionary, but coerced into
--a record for easier use
set theResult to (my loadedKextInfoWithIdentifiers:listOfIdentifiers infoKeys:listOfInfoKeys) as record
set theKextList to theResult as list --this is necessary, as otherwise, it's still a record of records, and
-- for our needs, a list of records is better.
repeat with x in theKextList --replace meaningless numbers with useful text.
set theItem to x
try --we wrap it in a try because not every entry has an OSBundleCPUType. This avoids crashing out when
--that happens
if (OSBundleCPUType of theItem as text) is "16777223" then
set OSBundleCPUType of x to "x86_64"
else if OSBundleCPUType of theItem is 16777234 then
set OSBundleCPUType of x to "PPC-64"
else if OSBundleCPUType of theItem is 18 then
set OSBundleCPUType of x to "PPC-32"
else if OSBundleCPUType of theItem is 7 then
set OSBundleCPUType of x to "i386-32"
end
if (OSKernelResource of theItem as text) is "0" then
log "false"
set OSKernelResource of theItem to "false"
else if OSKernelResource of theItem is 1 then
log "true"
set OSKernelResource of theItem to "true"
end if
on error --in this case, we don't care about the error, so we throw it away.
end try
--log theKextList
end
end applicationWillFinishLaunching_
{
CFBundleIdentifier = "com.apple.driver.AppleACPIPlatform";
CFBundleVersion = "4.0";
OSBundleCPUType = "x86_64";
OSBundleLoadSize = 393216;
OSBundlePath = "/System/Library/Extensions/AppleACPIPlatform.kext";
OSKernelResource = 0;
}
)
Which is partially correct. For example, sometimes, the code to change the OSBundleCPUType works as above, but other times, it does not:
{
CFBundleIdentifier = "com.apple.AppleFSCompression.AppleFSCompressionTypeZlib";
CFBundleVersion = "1.0.0";
OSBundleCPUType = 16777223;
OSBundleLoadSize = 24576;
OSBundlePath = "/System/Library/Extensions/AppleFSCompressionTypeZlib.kext";
OSKernelResource = 0;
},
And I’ve yet to hit the secret sauce for the OSKernelResource to fire. If it was completely NOT working then that would make some sense. But it’s only sort of working.