Considering the following command:
sudo scutil
> list
I get the list of "pattern" or subkeys available:
subKey [0] = Plugin:...
subKey [1] = Setup:....
....
Programmatically in Objective-C, I am able to acces a specific key:
SCDynamicStoreRef ds = SCDynamicStoreCreate(nullptr, CFSTR("GetWorkgroup"), nullptr, nullptr);
NSLog(@"Config: %@", SCDynamicStoreCopyValue(ds, CFSTR("State:/Network/Global/IPv4")));
However I am struggling in getting all the list of available patterns.
Following program does NOT work:
SCDynamicStoreRef ds = SCDynamicStoreCreate(nullptr, CFSTR("GetWorkgroup"), nullptr, nullptr);
const auto list = SCDynamicStoreCopyKeyList(ds, CFSTR("State:/Network/Service/"));
const size_t keysNum = CFArrayGetCount(list);
std::cout << keysNum << std::endl;
for (size_t i = 0; i< keysNum; ++i)
{
auto property = static_cast<CFDictionaryRef>(SCDynamicStoreCopyValue(ds, static_cast<CFStringRef>(CFArrayGetValueAtIndex(list, i))));
NSLog(@"Key: %@", property);
}
I tried many codes without success. Searching on internet for SCDynamicStore list subKey
SCDynamicStore iterate patterns
or similar give little results.
Also, documentation on developer.apple.com, as usual, is useless: no examples, documentation which relay on you already knowing all about it, no #include/#import indication, etc. etc..
Question
How to list all available patterns in SCDynamicStore
?