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@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
99fb4b17f3
commit
8a43d29ef4
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue