CF_EXPORT CFArrayRef CFPlugInFindFactoriesForPlugInType(CFUUIDRef typeID) { CFArrayRef array = _CFPFactoryFindCopyForType(typeID); CFMutableArrayRef result = NULL; if (array) { SInt32 i, c = CFArrayGetCount(array); result = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, &kCFTypeArrayCallBacks); for (i = 0; i < c; i++) { CFUUIDRef factoryId = _CFPFactoryCopyFactoryID((_CFPFactoryRef)CFArrayGetValueAtIndex(array, i)); if (factoryId) { CFArrayAppendValue(result, factoryId); CFRelease(factoryId); } } CFRelease(array); } return result; }
CF_EXPORT CFStringRef CFPlugInInstanceGetFactoryName(CFPlugInInstanceRef instance) { // This function leaks, but it's the only safe way to access the factory name CFUUIDRef factoryId = _CFPFactoryCopyFactoryID(instance->factory); return (CFStringRef)factoryId; }