Hugh McMaster : reg/tests: Check for elevated privileges before cleaning up the Windows 3.1 test key and running unit tests.
Alexandre Julliard
julliard at winehq.org
Mon Feb 22 15:43:20 CST 2021
Module: wine
Branch: master
Commit: add814af3eb7368961fe5b37a66c616e4bd97e4b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=add814af3eb7368961fe5b37a66c616e4bd97e4b
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Mon Feb 22 17:29:56 2021 +1100
reg/tests: Check for elevated privileges before cleaning up the Windows 3.1 test key and running unit tests.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/reg/tests/reg.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c
index afba8424c1a..4be9e635ed7 100644
--- a/programs/reg/tests/reg.c
+++ b/programs/reg/tests/reg.c
@@ -4204,14 +4204,11 @@ static void test_import_31(void)
{
LONG err;
HKEY hkey;
- DWORD r;
-
- err = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
- ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "RegDeleteKeyA failed: %d\n", err);
+ DWORD dispos, r;
/* Check if reg.exe is running with elevated privileges */
err = RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ|KEY_SET_VALUE, NULL, &hkey, NULL);
+ KEY_READ|KEY_SET_VALUE, NULL, &hkey, &dispos);
if (err == ERROR_ACCESS_DENIED)
{
win_skip("reg.exe is not running with elevated privileges; "
@@ -4219,6 +4216,9 @@ static void test_import_31(void)
return;
}
+ if (dispos == REG_OPENED_EXISTING_KEY)
+ delete_value(hkey, NULL);
+
/* Test simple value */
test_import_str("REGEDIT\r\n"
"HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n", &r);
More information about the wine-cvs
mailing list