As per this post, you can just use the CoreFoundation APIs: