Commit 1a38b7bf authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 15847196
...@@ -1475,6 +1475,52 @@ static void test_reg_delete_tree(void) ...@@ -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) ...@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment