advapi32/tests: Test for enumeration order preservation of reg keys.

This commit is contained in:
Nikolay Sivov 2009-01-15 05:04:31 +03:00 committed by Alexandre Julliard
parent 1584719604
commit 1a38b7bf5e
1 changed files with 47 additions and 0 deletions

View File

@ -1475,6 +1475,52 @@ static void test_reg_delete_tree(void)
"Expected ERROR_FILE_NOT_FOUND, got %d\n", ret); "Expected ERROR_FILE_NOT_FOUND, got %d\n", ret);
} }
static void test_rw_order(void)
{
HKEY hKey;
DWORD dw = 0;
static char keyname[] = "test_rw_order";
char value_buf[2];
DWORD values, value_len, value_name_max_len;
LSTATUS ret;
RegDeleteKeyA(HKEY_CURRENT_USER, keyname);
ret = RegCreateKeyA(HKEY_CURRENT_USER, keyname, &hKey);
if(ret != ERROR_SUCCESS) {
skip("Couldn't create key. Skipping.\n");
return;
}
ok(!RegSetValueExA(hKey, "A", 0, REG_DWORD, (LPBYTE)&dw, sizeof(dw)),
"RegSetValueExA for value \"A\" failed\n");
ok(!RegSetValueExA(hKey, "C", 0, REG_DWORD, (LPBYTE)&dw, sizeof(dw)),
"RegSetValueExA for value \"C\" failed\n");
ok(!RegSetValueExA(hKey, "D", 0, REG_DWORD, (LPBYTE)&dw, sizeof(dw)),
"RegSetValueExA for value \"D\" failed\n");
ok(!RegSetValueExA(hKey, "B", 0, REG_DWORD, (LPBYTE)&dw, sizeof(dw)),
"RegSetValueExA for value \"B\" failed\n");
ok(!RegQueryInfoKeyA(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &values,
&value_name_max_len, NULL, NULL, NULL), "RegQueryInfoKeyA failed\n");
ok(values == 4, "Expected 4 values, got %u\n", values);
/* Value enumeration preserves RegSetValueEx call order */
value_len = 2;
ok(!RegEnumValueA(hKey, 0, value_buf, &value_len, NULL, NULL, NULL, NULL), "RegEnumValueA failed\n");
ok(strcmp(value_buf, "A") == 0, "Expected name \"A\", got %s\n", value_buf);
value_len = 2;
ok(!RegEnumValueA(hKey, 1, value_buf, &value_len, NULL, NULL, NULL, NULL), "RegEnumValueA failed\n");
todo_wine ok(strcmp(value_buf, "C") == 0, "Expected name \"C\", got %s\n", value_buf);
value_len = 2;
ok(!RegEnumValueA(hKey, 2, value_buf, &value_len, NULL, NULL, NULL, NULL), "RegEnumValueA failed\n");
todo_wine ok(strcmp(value_buf, "D") == 0, "Expected name \"D\", got %s\n", value_buf);
value_len = 2;
ok(!RegEnumValueA(hKey, 3, value_buf, &value_len, NULL, NULL, NULL, NULL), "RegEnumValueA failed\n");
todo_wine ok(strcmp(value_buf, "B") == 0, "Expected name \"B\", got %s\n", value_buf);
ok(!RegDeleteKey(HKEY_CURRENT_USER, keyname), "Failed to delete key\n");
}
START_TEST(registry) START_TEST(registry)
{ {
/* Load pointers for functions that are not available in all Windows versions */ /* Load pointers for functions that are not available in all Windows versions */
@ -1506,6 +1552,7 @@ START_TEST(registry)
} }
test_reg_delete_tree(); test_reg_delete_tree();
test_rw_order();
/* cleanup */ /* cleanup */
delete_key( hkey_main ); delete_key( hkey_main );