[PATCH 2/2] faultrep/tests: Check for registry virtualization

Alex Henrie alexhenrie24 at gmail.com
Sun Jan 2 01:11:44 CST 2022


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 at gmail.com>
---
 dlls/faultrep/tests/faultrep.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/dlls/faultrep/tests/faultrep.c b/dlls/faultrep/tests/faultrep.c
index 30664bd29be..c71db80cdbb 100644
--- a/dlls/faultrep/tests/faultrep.c
+++ b/dlls/faultrep/tests/faultrep.c
@@ -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
     {
-- 
2.34.1




More information about the wine-devel mailing list