WinRegistryConfiguration enumeration

Please post support and help requests here.
Posts: 42
Joined: 02 Dec 2011, 20:45

WinRegistryConfiguration enumeration

Postby gandriotakis » 17 May 2012, 14:21

I apparently do not understand the intended usage of WinRegistryConfiguration.

I have a registry tree I would to enumerate.

I first create a WinRegistryConfiguration object at the root of the tree I am interested in.

I then call keys on that object and get all of the key and value names at that level. All is well and good at this point.

Iterating though that list, if the key is a property I do something and if it is not I call keys again with key as the subkey. This always returns the keys at the root level the object was constructed with.

The problem appears to be in ConvertToRegFormat which returns an empty string that is appended to _rootPath so that the returned range is always at the root.

Where would I find an example that demonstrates waht I am trying to do?

Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: WinRegistryConfiguration enumeration

Postby alex » 17 May 2012, 17:14

It would be easier to answer if the code was posted, prose does not convey information so well. As a first troubleshooting step, I suggest to read the ConvertToRegFormat documentation:

POCO Documentation wrote:takes a key in the format of A.B.C and converts it to registry format A\B\C, the last entry is the keyName, the rest is returned as path

On our side, we probably should make ConvertToRegFormat member function static to make clear it does not operate on the root path (if that is what you expect).

Posts: 42
Joined: 02 Dec 2011, 20:45

Re: WinRegistryConfiguration enumeration

Postby gandriotakis » 18 May 2012, 20:53

The simplest case would be:

AutoPtr<WinRegistryConfiguration> rConf(new WinRegistryConfiguration("HKEY_LOCAL_MACHINE\\Software\\abc"));

AbstractConfiguration::Keys keys;
rConf->keys("", keys);

keys contains the root keys (HKEY_LOCAL_MACHINE etc.). I would expect the keys at the level the configuration was constructed at.

If I pass in any other base e.g.
rConf->keys("base", keys);

It returns the all keys at the "HKEY_LOCAL_MACHINE\\Software\\abc" level whether or not "base" exists.

Note that this works as expected with PropertyFileConfiguration.

Return to “Support”

Who is online

Users browsing this forum: No registered users and 2 guests