mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 12:08:55 +00:00
[WINESYNC] reg/tests: Comprehensively check for elevated privileges before starting Windows 3.1 import tests.
The existing check fails to adequately determine the program's elevation status on systems where the test key already exists. This can cause all Windows 3.1 import tests to fail on systems with a standard user account. Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 17023a8100a62852bbad342e5e7c705cafae9a1f by Hugh McMaster <hugh.mcmaster@outlook.com>
This commit is contained in:
parent
2161165dca
commit
0b6ea9f2d7
2 changed files with 16 additions and 7 deletions
|
@ -3468,25 +3468,34 @@ static void test_import_win31(void)
|
|||
{
|
||||
LONG err;
|
||||
HKEY hkey;
|
||||
DWORD dispos, r;
|
||||
DWORD 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, &dispos);
|
||||
err = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
|
||||
if (err == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
win_skip("reg.exe is not running with elevated privileges; "
|
||||
"skipping Windows 3.1 import tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dispos == REG_OPENED_EXISTING_KEY)
|
||||
delete_value(hkey, NULL);
|
||||
if (err == ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
if (RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE,
|
||||
KEY_READ, NULL, &hkey, NULL))
|
||||
{
|
||||
win_skip("reg.exe is not running with elevated privileges; "
|
||||
"skipping Windows 3.1 import tests\n");
|
||||
return;
|
||||
}
|
||||
RegCloseKey(hkey);
|
||||
RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
|
||||
}
|
||||
|
||||
/* Test simple value */
|
||||
test_import_str("REGEDIT\r\n"
|
||||
"HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n", &r);
|
||||
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
|
||||
open_key(HKEY_CLASSES_ROOT, KEY_BASE, KEY_SET_VALUE, &hkey);
|
||||
verify_reg(hkey, "", REG_SZ, "Value0", 7, 0);
|
||||
|
||||
/* Test proper handling of spaces and equals signs */
|
||||
|
|
|
@ -4,4 +4,4 @@ directories:
|
|||
files:
|
||||
programs/reg/resource.h: base/applications/cmdutils/reg/resource.h
|
||||
tags:
|
||||
wine: b369af9ac5861f0ec49933ef657a53feeafefc21
|
||||
wine: 17023a8100a62852bbad342e5e7c705cafae9a1f
|
||||
|
|
Loading…
Reference in a new issue