[PATCH 1/9] reg/tests: Check for elevated privileges before cleaning up the Windows 3.1 test key and running unit tests
Hugh McMaster
hugh.mcmaster at outlook.com
Mon Feb 22 00:29:56 CST 2021
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
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);
--
2.30.1
More information about the wine-devel
mailing list