Commit 5115e51a authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg/tests: Verify key opening and key deletion in delete_tree().

parent 7995d686
......@@ -154,7 +154,7 @@ void delete_key_(const char *file, unsigned line, HKEY root, const char *path, R
}
}
LONG delete_tree(HKEY root, const char *path, REGSAM sam)
LONG delete_tree_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
{
HKEY hkey;
LONG ret;
......@@ -163,6 +163,7 @@ LONG delete_tree(HKEY root, const char *path, REGSAM sam)
static const char empty[1];
ret = RegOpenKeyExA(root, path, 0, KEY_READ|sam, &hkey);
lok(!ret || ret == ERROR_FILE_NOT_FOUND, "RegOpenKeyExA failed, got error %d\n", ret);
if (ret) return ret;
ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &max_subkey_len,
......@@ -184,7 +185,7 @@ LONG delete_tree(HKEY root, const char *path, REGSAM sam)
ret = RegEnumKeyExA(hkey, 0, subkey_name, &subkey_len, NULL, NULL, NULL, NULL);
if (ret == ERROR_NO_MORE_ITEMS) break;
if (ret) goto cleanup;
ret = delete_tree(hkey, subkey_name, sam);
ret = delete_tree_(file, line, hkey, subkey_name, sam);
if (ret) goto cleanup;
}
......@@ -193,6 +194,8 @@ LONG delete_tree(HKEY root, const char *path, REGSAM sam)
else
ret = RegDeleteKeyExA(hkey, empty, sam, 0);
lok(!ret, "Failed to delete registry key, got error %d\n", ret);
cleanup:
HeapFree(GetProcessHeap(), 0, subkey_name);
RegCloseKey(hkey);
......
......@@ -64,7 +64,8 @@ void add_key_(const char *file, unsigned line, const HKEY root, const char *path
#define delete_key(r,p,s) delete_key_(__FILE__,__LINE__,r,p,s)
void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
LONG delete_tree(HKEY root, const char *path, REGSAM sam);
#define delete_tree(r,p,s) delete_tree_(__FILE__,__LINE__,r,p,s)
LONG delete_tree_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam);
#define add_value(k,n,t,d,s) add_value_(__FILE__,__LINE__,k,n,t,d,s)
void add_value_(const char *file, unsigned line, HKEY hkey, const char *name,
......
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