Alexandre Julliard : advapi32/tests: Don' t bother running HKCR tests when the registry key doesn't exist.
Alexandre Julliard
julliard at winehq.org
Tue Oct 5 12:03:05 CDT 2010
Module: wine
Branch: master
Commit: 625bce13fb56c325c0af24e7c706a796adb9852e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=625bce13fb56c325c0af24e7c706a796adb9852e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Oct 5 10:58:45 2010 +0200
advapi32/tests: Don't bother running HKCR tests when the registry key doesn't exist.
---
dlls/advapi32/tests/registry.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index 8322d89..8b0dbee 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -1922,7 +1922,10 @@ static void test_classesroot(void)
/* create a key in the user's classes */
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Classes\\WineTestCls", &hkey ))
+ {
delete_key( hkey );
+ RegCloseKey( hkey );
+ }
if (RegCreateKeyExA( HKEY_CURRENT_USER, "Software\\Classes\\WineTestCls", 0, NULL, 0,
KEY_QUERY_VALUE|KEY_SET_VALUE, NULL, &hkey, NULL )) return;
@@ -1932,6 +1935,13 @@ static void test_classesroot(void)
todo_wine ok(res == ERROR_SUCCESS ||
broken(res == ERROR_FILE_NOT_FOUND /* Win9x */),
"test key not found in hkcr: %d\n", res);
+ if (res)
+ {
+ trace( "HKCR key merging not supported\n" );
+ delete_key( hkey );
+ RegCloseKey( hkey );
+ return;
+ }
/* set a value in user's classes */
res = RegSetValueExA(hkey, "val1", 0, REG_SZ, (const BYTE *)"user", sizeof("user"));
@@ -1939,31 +1949,22 @@ static void test_classesroot(void)
/* try to find the value in hkcr */
res = RegQueryValueExA(hkcr, "val1", NULL, &type, (LPBYTE)buffer, &size);
- todo_wine
- {
- ok(res == ERROR_SUCCESS ||
- broken(res == ERROR_BADKEY /* Win9x */) ||
- broken(res == ERROR_INVALID_HANDLE /* NT+ */),
- "RegQueryValueExA failed: %d, GLE=%x\n", res, GetLastError());
- ok(!strcmp( buffer, "user" ) || broken(!strcmp( buffer, "" ) /* Win9x */),
- "value set to '%s'\n", buffer );
- }
+ ok(res == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", res);
+ ok(!strcmp( buffer, "user" ), "value set to '%s'\n", buffer );
/* modify the value in hkcr */
res = RegSetValueExA(hkcr, "val1", 0, REG_SZ, (const BYTE *)"hkcr", sizeof("hkcr"));
- todo_wine ok(res == ERROR_SUCCESS ||
- broken(res == ERROR_BADKEY /* Win9x */) ||
- broken(res == ERROR_INVALID_HANDLE /* NT+ */),
- "RegSetValueExA failed: %d, GLE=%x\n", res, GetLastError());
+ ok(res == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", res);
/* check if the value is also modified in user's classes */
res = RegQueryValueExA(hkey, "val1", NULL, &type, (LPBYTE)buffer, &size);
ok(res == ERROR_SUCCESS, "RegQueryValueExA failed: %d, GLE=%x\n", res, GetLastError());
- todo_wine ok(!strcmp( buffer, "hkcr" ) || broken(!strcmp( buffer, "user" ) /* Win9x */),
- "value set to '%s'\n", buffer );
+ ok(!strcmp( buffer, "hkcr" ), "value set to '%s'\n", buffer );
/* cleanup */
delete_key( hkey );
+ RegCloseKey( hkey );
+ RegCloseKey( hkcr );
}
static void test_deleted_key(void)
More information about the wine-cvs
mailing list