faultrep/tests: Check for registry virtualization.

If registry virtualization is enabled, AddERExcludedApplicationA
succeeds on Windows 8 even if the user does not really have permission
to write to HKLM\Software. The behind-the-scenes writes to HLKM\Software
are treated like any other writes: They are silently redirected to
HKCU\Software\Classes\VirtualStore\Machine\Software. Since
AddERExcludedApplicationA still fails even with registry virtualization
enabled on Vista, 7, and 10, Windows 8's behavior is clearly broken.

Fixes a testbot failure on 32-bit Windows 8 with a non-elevated
administrator account.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2022-01-02 00:11:44 -07:00 committed by Alexandre Julliard
parent e69d218d57
commit 425098974a
1 changed files with 15 additions and 1 deletions

View File

@ -47,6 +47,19 @@ static BOOL is_process_limited(void)
return type == TokenElevationTypeLimited;
}
static BOOL is_registry_virtualization_enabled(void)
{
HANDLE token;
DWORD enabled = FALSE;
DWORD size;
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
GetTokenInformation(token, TokenVirtualizationEnabled, &enabled, sizeof(enabled), &size);
CloseHandle(token);
return enabled;
}
/* ###### */
@ -86,7 +99,8 @@ static void test_AddERExcludedApplicationA(void)
if (is_process_limited())
{
/* LastError is not set! */
ok(!res, "AddERExcludedApplicationA should have failed got %d\n", res);
ok(!res || broken(is_registry_virtualization_enabled()) /* win8 */,
"AddERExcludedApplicationA should have failed, got %d\n", res);
}
else
{