Francois Gouget : ole32/tests: Skip some tests if not allowed to modify the Classes registry key.

Alexandre Julliard julliard at winehq.org
Wed Sep 21 13:35:14 CDT 2011


Module: wine
Branch: master
Commit: 88ba9c32745fc295f8694661d138c7deab69850c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=88ba9c32745fc295f8694661d138c7deab69850c

Author: Francois Gouget <fgouget at free.fr>
Date:   Wed Sep 21 00:42:06 2011 +0200

ole32/tests: Skip some tests if not allowed to modify the Classes registry key.

---

 dlls/ole32/tests/marshal.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index 33e074c..c178912 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -2268,7 +2268,7 @@ static void test_freethreadedmarshaler(void)
     IMarshal_Release(pFTMarshal);
 }
 
-static void reg_unreg_wine_test_class(BOOL Register)
+static HRESULT reg_unreg_wine_test_class(BOOL Register)
 {
     HRESULT hr;
     char buffer[256];
@@ -2286,9 +2286,16 @@ static void reg_unreg_wine_test_class(BOOL Register)
     if (Register)
     {
         error = RegCreateKeyEx(HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, KEY_SET_VALUE, NULL, &hkey, &dwDisposition);
+        if (error == ERROR_ACCESS_DENIED)
+        {
+            skip("Not authorized to modify the Classes key\n");
+            return E_FAIL;
+        }
         ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %d\n", error);
+        if (error != ERROR_SUCCESS) hr = E_FAIL;
         error = RegSetValueEx(hkey, NULL, 0, REG_SZ, (const unsigned char *)"\"ole32.dll\"", strlen("\"ole32.dll\"") + 1);
         ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %d\n", error);
+        if (error != ERROR_SUCCESS) hr = E_FAIL;
         RegCloseKey(hkey);
     }
     else
@@ -2297,6 +2304,7 @@ static void reg_unreg_wine_test_class(BOOL Register)
         *strrchr(buffer, '\\') = '\0';
         RegDeleteKey(HKEY_CLASSES_ROOT, buffer);
     }
+    return hr;
 }
 
 static void test_inproc_handler(void)
@@ -2305,7 +2313,8 @@ static void test_inproc_handler(void)
     IUnknown *pObject;
     IUnknown *pObject2;
 
-    reg_unreg_wine_test_class(TRUE);
+    if (FAILED(reg_unreg_wine_test_class(TRUE)))
+        return;
 
     hr = CoCreateInstance(&CLSID_WineTest, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pObject);
     ok_ole_success(hr, "CoCreateInstance");
@@ -2386,7 +2395,8 @@ static void test_handler_marshaling(void)
     HANDLE thread;
     static const LARGE_INTEGER ullZero;
 
-    reg_unreg_wine_test_class(TRUE);
+    if (FAILED(reg_unreg_wine_test_class(TRUE)))
+        return;
     cLocks = 0;
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);




More information about the wine-cvs mailing list