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?
On Apr 3, 2005 4:33 PM, James Hawkins truiken@gmail.com wrote:
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.
I see what's happening now. The original author of test_enum_value either didn't know about the 3 existing keys (maybe they were added later) or he thought they wouldn't have an effect on the outcome of the tests. What I will do now is make a new, clean subdirectory in which to run the tests with the new value. This way the test will pass on windows and wine. The question is still up in the air though about the order of insertion of new values.
Hi James,
On Sunday 03 Apr 2005 22:43, James Hawkins wrote:
On Apr 3, 2005 4:33 PM, James Hawkins truiken@gmail.com wrote: I see what's happening now. The original author of test_enum_value either didn't know about the 3 existing keys (maybe they were added later) or he thought they wouldn't have an effect on the outcome of the tests. What I will do now is make a new, clean subdirectory in which to run the tests with the new value.
By the look of it, the bug is that create_test_entries() creates the three TestN keys (N=1..3), but doesn't clean them after.
The question is still up in the air though about the order of insertion of new values.
I suspect the usual answer applies: if it can be demonstrated that an application depends on this behaviour, then we should support it.
HTH,
Paul
On Apr 3, 2005 5:17 PM, Paul Millar p.millar@physics.gla.ac.uk wrote:
By the look of it, the bug is that create_test_entries() creates the three TestN keys (N=1..3), but doesn't clean them after.
We use the values created in create_test_entries() throughout the whole test so this is the correct behaviour. They are cleaned up in the final call to delete_key(hkey_main).
Hi James,
On Sunday 03 Apr 2005 23:57, you wrote:
On Apr 3, 2005 5:17 PM, Paul Millar p.millar@physics.gla.ac.uk wrote:
By the look of it, the bug is that create_test_entries() creates the three TestN keys (N=1..3), but doesn't clean them after.
We use the values created in create_test_entries() throughout the whole test [...] They are cleaned up in the final call to delete_key(hkey_main).
OK, I missed that from a casual glance through the code.
so this is the correct behaviour.
... if you insist.
The issue is either one of name-space ("Test" isn't a fantastic choice), or of scope: do all the Test1, Test2, Test3 tests inside one top-level function call that also cleans up.
So, two ways of fixing the problem.
HTH,
Paul.
On Apr 4, 2005 4:26 AM, Paul Millar p.millar@physics.gla.ac.uk wrote:
Hi James,
On Sunday 03 Apr 2005 23:57, you wrote:
On Apr 3, 2005 5:17 PM, Paul Millar p.millar@physics.gla.ac.uk wrote:
By the look of it, the bug is that create_test_entries() creates the three TestN keys (N=1..3), but doesn't clean them after.
We use the values created in create_test_entries() throughout the whole test [...] They are cleaned up in the final call to delete_key(hkey_main).
OK, I missed that from a casual glance through the code.
so this is the correct behaviour.
... if you insist.
The issue is either one of name-space ("Test" isn't a fantastic choice), or of scope: do all the Test1, Test2, Test3 tests inside one top-level function call that also cleans up.
So, two ways of fixing the problem.
I whole-heartedly agree that using 'Test' as a value when we have 'Test1..3' is not a wise choice, but I didn't write it :)
I sent a patch that creates a subkey and places the 'Test' value in that subkey so the conflict disappears and all the functions pass (except for Load/SaveKey but I have the fix for that to send in). I think it's a good idea to leave 'Test1...3' available through the whole function, because they are pertinent to almost all Reg* tests. For example we can delete a key with values under it as long as there are no subkeys. That's a pretty weak example, but we should leave them in for testing sake. With the patch I sent for 'Test', all concerned tests pass on windows and wine now.