shlwapi/tests: Skip some tests if not allowed to modify the registry.

Francois Gouget fgouget at free.fr
Tue Sep 20 17:40:08 CDT 2011


---

On Windows 7, if not running the tests with elevated privileges some 
registry keys/values cannot be modified. This fixes the test on my 
Windows 7 VM.

 dlls/shlwapi/tests/ordinal.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index cde3378..8316112 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -2853,13 +2853,18 @@ static void test_SHGetShellKey(void)
     hkey = pSHGetShellKey(SHKEY_Root_HKLM, WineTestW, FALSE);
     ok(hkey == NULL, "hkey != NULL\n");
 
-    hkey = pSHGetShellKey(SHKEY_Root_HKLM, WineTestW, TRUE);
-    ok(hkey != NULL, "Can't create key\n");
+    hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
+    ok(hkey != NULL, "Can't open key\n");
+    ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delte key\n");
     RegCloseKey(hkey);
 
-    hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
+    hkey = pSHGetShellKey(SHKEY_Root_HKLM, WineTestW, TRUE);
+    if (!hkey && GetLastError() == ERROR_ACCESS_DENIED)
+    {
+        skip("Not authorized to create keys\n");
+        return;
+    }
     ok(hkey != NULL, "Can't create key\n");
-    ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delte key\n");
     RegCloseKey(hkey);
 
     if (!pSKGetValueW || !pSKSetValueW || !pSKDeleteValueW || !pSKAllocValueW)
-- 
1.7.5.4



More information about the wine-patches mailing list