Commit 2515ff77 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

Added beginnings of RegQueryValueEx tests.

parent 02b690db
......@@ -28,6 +28,9 @@
static HKEY hkey_main;
static const char * sTestpath1 = "%LONGSYSTEMVAR%\\subdir1";
static const char * sTestpath2 = "%FOO%\\subdir1";
/* delete key and all its subkeys */
static DWORD delete_key( HKEY hkey )
{
......@@ -57,6 +60,19 @@ static void setup_main_key(void)
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey_main, NULL ));
}
static void create_test_entries(void)
{
SetEnvironmentVariableA("LONGSYSTEMVAR", "bar");
SetEnvironmentVariableA("FOO", "ImARatherLongButIndeedNeededString");
ok(!RegSetValueExA(hkey_main,"Test1",0,REG_EXPAND_SZ, sTestpath1, strlen(sTestpath1)+1),
"RegSetValueExA failed\n");
ok(!RegSetValueExA(hkey_main,"Test2",0,REG_SZ, sTestpath1, strlen(sTestpath1)+1),
"RegSetValueExA failed\n");
ok(!RegSetValueExA(hkey_main,"Test3",0,REG_EXPAND_SZ, sTestpath2, strlen(sTestpath2)+1),
"RegSetValueExA failed\n");
}
static void test_enum_value(void)
{
DWORD res;
......@@ -227,10 +243,24 @@ CLEANUP:
RegDeleteValueA( hkey_main, "Test" );
}
static void test_query_value_ex()
{
DWORD ret;
DWORD size;
DWORD type;
ret = RegQueryValueExA(hkey_main, "Test2", NULL, &type, NULL, &size);
ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret);
ok(size == strlen(sTestpath1) + 1, "(%ld,%ld)\n", (DWORD)strlen(sTestpath1) + 1, size);
ok(type == REG_SZ, "type %ld is not REG_SZ\n", type);
}
START_TEST(registry)
{
setup_main_key();
create_test_entries();
test_enum_value();
test_query_value_ex();
/* cleanup */
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