evve
evve

Reputation: 2906

Best Way To Recurse Through Registry (C++)?

So long story short, I'm trying to create a diff of two registry hives located in binary .dat files.

After mounting the hives using the RegLoadAppKey, what is the best way to recurse through all keys and their values?

I looked at RegEnumKeyEx, but that only allows me to iterate through the sub keys of the root node returned by RegLoadAppKey and doesn't (as far as I know) return any sort of handle to the sub keys.

Also the reason I am using RegLoadAppKey is because this mini app needs be able to be run without admin privileges.

Upvotes: 0

Views: 490

Answers (1)

Jason De Arte
Jason De Arte

Reputation: 555

Not to be a wet blanket

From the MSDN docs on RegLoadAppKey http://msdn.microsoft.com/en-us/library/windows/desktop/ms724886(v=vs.85).aspx

Unlike RegLoadKey, RegLoadAppKey does not load the hive under HKEY_LOCAL_MACHINE or HKEY_USERS. Instead, the hive is loaded under a special root that cannot be enumerated. As a result, there is no way to enumerate hives currently loaded by RegLoadAppKey

In addition, you might run into roadblocks over some of the security settings you are trying to avoid

All keys inside the hive must have the same security descriptor, otherwise the function will fail. This security descriptor must grant the caller the access specified by the samDesired parameter or the function will fail. You cannot use the RegSetKeySecurity function on any key inside the hive.

Upvotes: 2

Related Questions