I have a 32-bit C++ program that gathers diagnostic data to help troubleshoot our software. I'd like it to export a certain subtree of the registry - something like:
regedit.exe /e ExportResult.reg HKEY_LOCAL_MACHINE\SubTreeIWantToExport
The problem is Regedit will likely require priviledges elevation on Vista and above and the user running my program might not have enough rights for that but will likely have enough rights to read from that subtree. Also I foresee subtle problems with SysWOW64 on 64-bit systems. So running Regedit is a bad option.
Of course my program could read the registry itself and somehow produce an equivalent of a .reg file but implementing that functionality would be reinventing the wheel.
Is there some other way to read and export a Windows registry subtree from my program?