[PATCH] advapi32, ntdll: Skip test_redirection tests if there is not enough privileges

Bartosz gang65 at poczta.onet.pl
Tue Feb 16 02:19:58 CST 2016


During run Conformance Tests on Windows 7, I observed that some tests are
failing, when there is not enough privileges to write to Windows Register (HKLM):
http://test.winehq.org/data/b190a72bfe53a41a83ae55d75de8327c24512bee/win7_win7sp1/advapi32:registry.html
http://test.winehq.org/data/b190a72bfe53a41a83ae55d75de8327c24512bee/win7_win7sp1/ntdll:reg.html
To fix that, the tests should be skipped if rights to writing to register
is not granted.
---
 dlls/advapi32/tests/registry.c | 6 ++++++
 dlls/ntdll/tests/reg.c         | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index ef5d989..bee1792 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -2369,6 +2369,12 @@ static void test_redirection(void)
         }
     }
 
+    if (limited_user)
+    {
+        skip("not enough privileges to modify HKEY_LOCAL_MACHINE\n");
+        return;
+    }
+
     err = RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine", 0, NULL, 0,
                            KEY_WOW64_64KEY | KEY_ALL_ACCESS, NULL, &root64, NULL );
     ok( err == ERROR_SUCCESS, "RegCreateKeyExA failed: %u\n", err );
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index d00a496..b659c47 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -1357,7 +1357,13 @@ static void test_redirection(void)
 
     pRtlInitUnicodeString( &str, wine64W );
     status = pNtCreateKey( &root64, KEY_WOW64_64KEY | KEY_ALL_ACCESS, &attr, 0, 0, 0, 0 );
-    ok( status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08x\n", status );
+    ok( status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED, "NtCreateKey failed: 0x%08x\n", status );
+    if (status == STATUS_ACCESS_DENIED)
+    {
+        win_skip("Can't write to registry. Not enough privileges\n");
+        return;
+    }
+
 
     pRtlInitUnicodeString( &str, wine32W );
     status = pNtCreateKey( &root32, KEY_WOW64_32KEY | KEY_ALL_ACCESS, &attr, 0, 0, 0, 0 );
-- 
2.5.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-advapi32-ntdll-Skip-test_redirection-tests-if-there-.patch
Type: text/x-patch
Size: 2293 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20160216/c9a06ff5/attachment.bin>


More information about the wine-patches mailing list