I found the existing function, it's resolvePackageSetRegistry(const char *process, bool readonly).  It will return the tree for the PackageSet that matches your process.