registry: order of insertion of values

James Hawkins truiken at gmail.com
Sun Apr 3 16:33:21 CDT 2005


Hi,

I've been fixing tests that fail on all of Win9x/XP/2003, and I've
found a difference between the way we insert new values.  What happens
in advapi32/tests/registry.c - test_enum_value is that we already have
3 values created under the key Wine\\Test before the test starts. 
Then we make four calls to RegSetValueExA with 'Test' as the name of
the value to set.  Since this value does not exist, it is created. 
After these four calls, here are all the values under the test key:

Environment Variables:
%LONGSYSTEMVAR% = "bar"
%FOO% = "ImARatherLongButIndeedNeededString"

value: Test
  type: REG_SZ
  data: foobar
  data_count: 7, strlen("foobar") + 1

value: Test1
  type: REG_EXPAND_SZ
  data: %LONGSYSTEMVAR%\subdir1
  data_count: 24, same as above

value: Test2
  type: REG_SZ
  data: %LONGSYSTEMVAR%\subdir1
  data_count: 24

value: Test3
  type: REG_EXPAND_SZ
  data: %FOO%\subdir1
  data_count: 14


We then go on to query RegEnumValueA with value index 0.  In wine the
key that is queried is Test because we insert new keys in alphabetical
order and Test is before Test1..3.  On all versions of windows,
querying value index 0 returns information for Test1.  I added another
RegEnumValueA with value index 3 and it turns out that this is the
index for Test, leading me to believe that windows just inserts the
keys in order of creation.

It says on msdn that "because values are not ordered, any new value
will have an arbitrary index", but should we also store new values in
creation order?

If you remove the initial RegSetValueEx calls creating the 'Test'
value and match the results of wine with those from windows, all the
tests pass of wine and windows.  I will be sending a patch to remove
these RegSetValueEx tests, because they really should be in their own
test (as seen by this bug), but it did give me the chance to raise the
question of whether we should store new values in creation order or
not.  What's the verdict?

-- 
James Hawkins



More information about the wine-devel mailing list