Hugh McMaster : regedit/tests: Check for elevated privileges before cleaning up the Windows 3.1 test key and running unit tests.
Alexandre Julliard
julliard at winehq.org
Tue Feb 23 15:54:46 CST 2021
Module: wine
Branch: master
Commit: 8a43d29ef494eca3a36c4202e494656982e47c1f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8a43d29ef494eca3a36c4202e494656982e47c1f
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Mon Feb 22 22:24:00 2021 +1100
regedit/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/regedit/tests/regedit.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c
index 66b95624455..de4ddfa76a3 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -1094,15 +1094,12 @@ static void test_basic_import_unicode(void)
static void test_basic_import_31(void)
{
HKEY hkey;
+ DWORD dispos;
LONG lr;
- lr = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
- ok(lr == ERROR_SUCCESS || lr == ERROR_FILE_NOT_FOUND,
- "RegDeleteKeyA failed: %d\n", lr);
-
/* Check if regedit.exe is running with elevated privileges */
lr = RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_READ, NULL, &hkey, NULL);
+ KEY_READ|KEY_SET_VALUE, NULL, &hkey, &dispos);
if (lr == ERROR_ACCESS_DENIED)
{
win_skip("regedit.exe is not running with elevated privileges; "
@@ -1110,6 +1107,9 @@ static void test_basic_import_31(void)
return;
}
+ if (dispos == REG_OPENED_EXISTING_KEY)
+ delete_value(hkey, NULL);
+
/* Test simple value */
exec_import_str("REGEDIT\r\n"
"HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n");
More information about the wine-cvs
mailing list