Detlef Riekenberg : shlwapi/tests: Replace RegDeleteTreeW to run the tests again.

Alexandre Julliard julliard at winehq.org
Mon Oct 20 08:00:59 CDT 2008


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

Author: Detlef Riekenberg <wine.dev at web.de>
Date:   Fri Oct 17 16:38:55 2008 +0200

shlwapi/tests: Replace RegDeleteTreeW to run the tests again.

---

 dlls/shlwapi/tests/assoc.c |   59 +++++++++++++++++++------------------------
 1 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/dlls/shlwapi/tests/assoc.c b/dlls/shlwapi/tests/assoc.c
index 2e383bb..aa01814 100644
--- a/dlls/shlwapi/tests/assoc.c
+++ b/dlls/shlwapi/tests/assoc.c
@@ -32,19 +32,6 @@ static const WCHAR dotBad[] = { '.','b','a','d',0 };
 static const WCHAR open[] = { 'o','p','e','n',0 };
 static const WCHAR invalid[] = { 'i','n','v','a','l','i','d',0 };
 
-/* copied from libs/wine/string.c */
-WCHAR *strstrW(const WCHAR *str, const WCHAR *sub)
-{
-    while (*str)
-    {
-        const WCHAR *p1 = str, *p2 = sub;
-        while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
-        if (!*p2) return (WCHAR *)str;
-        str++;
-    }
-    return NULL;
-}
-
 static void test_getstring_bad(void)
 {
     HRESULT hr;
@@ -145,57 +132,63 @@ static void test_getstring_no_extra(void)
     LONG ret;
     HKEY hkey;
     HRESULT hr;
-    static const WCHAR dotWinetest[] = {
+    static const CHAR dotWinetest[] = {
         '.','w','i','n','e','t','e','s','t',0
     };
-    static const WCHAR winetestfile[] = {
+    static const CHAR winetestfile[] = {
         'w','i','n','e','t','e','s','t', 'f','i','l','e',0
     };
-    static const WCHAR winetestfileAction[] = {
+    static const CHAR winetestfileAction[] = {
         'w','i','n','e','t','e','s','t','f','i','l','e',
         '\\','s','h','e','l','l',
         '\\','f','o','o',
         '\\','c','o','m','m','a','n','d',0
     };
-    static const WCHAR action[] = {
+    static const CHAR action[] = {
         'n','o','t','e','p','a','d','.','e','x','e',0
     };
-    WCHAR buf[MAX_PATH];
+    CHAR buf[MAX_PATH];
     DWORD len = MAX_PATH;
 
-    ret = RegCreateKeyW(HKEY_CLASSES_ROOT, dotWinetest, &hkey);
-    if (ret != ERROR_SUCCESS)
+    buf[0] = '\0';
+    ret = RegCreateKeyA(HKEY_CLASSES_ROOT, dotWinetest, &hkey);
+    if (ret != ERROR_SUCCESS) {
         skip("failed to create dotWinetest key\n");
-    ret = RegSetValueW(hkey, NULL, REG_SZ, winetestfile,
-                       lstrlenW(winetestfile));
+        return;
+    }
+
+    ret = RegSetValueA(hkey, NULL, REG_SZ, winetestfile, lstrlenA(winetestfile));
     RegCloseKey(hkey);
     if (ret != ERROR_SUCCESS)
     {
-        RegDeleteTreeW(HKEY_CLASSES_ROOT, dotWinetest);
         skip("failed to set dotWinetest key\n");
+        goto cleanup;
     }
 
-    ret = RegCreateKeyW(HKEY_CLASSES_ROOT, winetestfileAction, &hkey);
+    ret = RegCreateKeyA(HKEY_CLASSES_ROOT, winetestfileAction, &hkey);
     if (ret != ERROR_SUCCESS)
     {
-        RegDeleteTreeW(HKEY_CLASSES_ROOT, dotWinetest);
         skip("failed to create winetestfileAction key\n");
+        goto cleanup;
     }
-    ret = RegSetValueW(hkey, NULL, REG_SZ, action, lstrlenW(action));
+
+    ret = RegSetValueA(hkey, NULL, REG_SZ, action, lstrlenA(action));
     RegCloseKey(hkey);
     if (ret != ERROR_SUCCESS)
     {
-        RegDeleteTreeW(HKEY_CLASSES_ROOT, dotWinetest);
-        RegDeleteTreeW(HKEY_CLASSES_ROOT, winetestfile);
         skip("failed to set winetestfileAction key\n");
+        goto cleanup;
     }
 
-    hr = AssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotWinetest, NULL,
-                           buf, &len);
+    hr = AssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, NULL, buf, &len);
     expect_hr(S_OK, hr);
-    ok(strstrW(buf, action) != NULL, "exe path does not contain notepad\n");
-    RegDeleteTreeW(HKEY_CLASSES_ROOT, dotWinetest);
-    RegDeleteTreeW(HKEY_CLASSES_ROOT, winetestfile);
+    ok(strstr(buf, action) != NULL,
+        "got '%s' (Expected result to include 'notepad.exe')\n", buf);
+
+cleanup:
+    SHDeleteKeyA(HKEY_CLASSES_ROOT, dotWinetest);
+    SHDeleteKeyA(HKEY_CLASSES_ROOT, winetestfile);
+
 }
 
 START_TEST(assoc)




More information about the wine-cvs mailing list