On 16 Jun 2015, at 1:23 pm, John C. Welch <
email@hidden> wrote:
I am really sick of the kextstat loop dance.
I'm not sure what the problem there is, but this is a good case for using a Cocoa superclass. I cover in my book how to make a basic Cocoa class and make your AS class a subclass of it (chapter 16). You could just copy ClassWithExtras.h and ClassWithExtras.m to your project as is, and change the AS class's parent property.
Then in the .m file after the existing #import line, add:
#import <IOKit/kext/KextManager.h>
If you're running an older version of the OS, you need to add IOKit.framework to the project as well.
Then somewhere after the @implementation line, add:
- (NSDictionary *)loadedKextInfo
{
NSDictionary *dict = CFBridgingRelease(KextManagerCopyLoadedKextInfo(NULL, NULL));
return dict;
}
Call it in your AS like this:
set theRecord to loadedKextInfo()