I'm trying to find extension by name with following code:
static const char* dextIdentifier = "someDextName";
CFMutableDictionaryRef cfd = IOServiceNameMatching(dextIdentifier);
int nMatch = (int)CFDictionaryGetCount(cfd);
printf("nMatch=%d\n",nMatch);
const void *keys[nMatch], *values[nMatch];
CFDictionaryGetKeysAndValues(cfd, keys, values);
for(int e=0; e < nMatch; e++) {
char key[100] = "", value[100] = "";
if(CFStringGetCString(reinterpret_cast<CFStringRef>(keys[e]), key, sizeof(key), kCFStringEncodingASCII)) {
printf("Key: %s\n",key);
}
if(CFStringGetCString(reinterpret_cast<CFStringRef>(values[e]), value, sizeof(value), kCFStringEncodingASCII)) {
printf("Value: %s\n",key);
}
}
Regardless of dextIdentifier value IOServiceNameMatching always returns single record (nMatch = 1), where key = "IONameMatch" and value = <passed to IOServiceNameMatching parameter> It doesn't matter whether the specified extension name exists or not
There is the single extension in the system, according to 'systemextensionsctl list' command