summaryrefslogtreecommitdiffstats
path: root/src/common/impl/kmod_apple.c
diff options
context:
space:
mode:
authorsumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
committersumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
commit76424950e373d3b04ac3dd13019151bfba3e8423 (patch)
tree4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/common/impl/kmod_apple.c
Add the files
Diffstat (limited to 'src/common/impl/kmod_apple.c')
-rw-r--r--src/common/impl/kmod_apple.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/impl/kmod_apple.c b/src/common/impl/kmod_apple.c
new file mode 100644
index 0000000..82edc49
--- /dev/null
+++ b/src/common/impl/kmod_apple.c
@@ -0,0 +1,12 @@
+#include "common/kmod.h"
+#include "common/apple/cf_helpers.h"
+#include <IOKit/kext/KextManager.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+bool ffKmodLoaded(const char* modName) {
+ FF_CFTYPE_AUTO_RELEASE CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, modName, kCFStringEncodingUTF8);
+ FF_CFTYPE_AUTO_RELEASE CFArrayRef identifiers = CFArrayCreate(kCFAllocatorDefault, (const void**) &name, 1, &kCFTypeArrayCallBacks);
+ FF_CFTYPE_AUTO_RELEASE CFArrayRef keys = CFArrayCreate(kCFAllocatorDefault, NULL, 0, NULL);
+ FF_CFTYPE_AUTO_RELEASE CFDictionaryRef kextInfo = KextManagerCopyLoadedKextInfo(identifiers, keys);
+ return CFDictionaryContainsKey(kextInfo, name);
+}