[SHLWAPI_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
authorAmine Khaldi <amine.khaldi@reactos.org>
Mon, 23 Nov 2015 09:43:14 +0000 (09:43 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Mon, 23 Nov 2015 09:43:14 +0000 (09:43 +0000)
svn path=/trunk/; revision=70059

rostests/winetests/shlwapi/ordinal.c
rostests/winetests/shlwapi/path.c
rostests/winetests/shlwapi/shreg.c

index 1348e15..c045cc7 100755 (executable)
@@ -1639,21 +1639,19 @@ static void test_SHPropertyBag_ReadLONG(void)
 
     out = 0xfeedface;
     rc = pSHPropertyBag_ReadLONG(NULL, szName1, &out);
-    ok(rc == E_INVALIDARG || broken(rc == 0), "incorrect return %x\n",rc);
+    ok(rc == E_INVALIDARG || broken(rc == S_OK), "incorrect return %x\n",rc);
     ok(out == 0xfeedface, "value should not have changed\n");
     rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, NULL, &out);
-    ok(rc == E_INVALIDARG || broken(rc == 0) || broken(rc == 1), "incorrect return %x\n",rc);
+    ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
     ok(out == 0xfeedface, "value should not have changed\n");
     rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, szName1, NULL);
-    ok(rc == E_INVALIDARG || broken(rc == 0) || broken(rc == 1), "incorrect return %x\n",rc);
+    ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
     rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, szName1, &out);
-    ok(rc == DISP_E_BADVARTYPE || broken(rc == 0) || broken(rc == 1), "incorrect return %x\n",rc);
+    ok(rc == DISP_E_BADVARTYPE || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
     ok(out == 0xfeedface  || broken(out == 0xfeedfa00), "value should not have changed %x\n",out);
     IUnknown_Release((IUnknown*)pb);
 }
 
-
-
 static void test_SHSetWindowBits(void)
 {
     HWND hwnd;
index 9483350..0ff10eb 100755 (executable)
@@ -32,8 +32,8 @@
 #include <shlwapi.h>
 #include <wininet.h>
 
-static HRESULT (WINAPI *pPathIsValidCharA)(char,DWORD);
-static HRESULT (WINAPI *pPathIsValidCharW)(WCHAR,DWORD);
+static BOOL (WINAPI *pPathIsValidCharA)(char,DWORD);
+static BOOL (WINAPI *pPathIsValidCharW)(WCHAR,DWORD);
 static LPWSTR  (WINAPI *pPathCombineW)(LPWSTR, LPCWSTR, LPCWSTR);
 static HRESULT (WINAPI *pPathCreateFromUrlA)(LPCSTR, LPSTR, LPDWORD, DWORD);
 static HRESULT (WINAPI *pPathCreateFromUrlW)(LPCWSTR, LPWSTR, LPDWORD, DWORD);
@@ -1644,6 +1644,19 @@ static void test_PathIsRelativeW(void)
     }
 }
 
+static void test_PathStripPathA(void)
+{
+    const char const_path[] = "test";
+    char path[] = "short//path\\file.txt";
+
+    PathStripPathA(path);
+    ok(!strcmp(path, "file.txt"), "path = %s\n", path);
+
+    /* following test should not crash */
+    /* LavView 2013 depends on that behaviour */
+    PathStripPathA((char*)const_path);
+}
+
 START_TEST(path)
 {
     HMODULE hShlwapi = GetModuleHandleA("shlwapi.dll");
@@ -1689,4 +1702,5 @@ START_TEST(path)
     test_PathUnExpandEnvStrings();
     test_PathIsRelativeA();
     test_PathIsRelativeW();
+    test_PathStripPathA();
 }
index 80d161e..a175e31 100755 (executable)
@@ -42,6 +42,8 @@ static DWORD (WINAPI *pSHCopyKeyA)(HKEY,LPCSTR,HKEY,DWORD);
 static DWORD (WINAPI *pSHRegGetPathA)(HKEY,LPCSTR,LPCSTR,LPSTR,DWORD);
 static LSTATUS (WINAPI *pSHRegGetValueA)(HKEY,LPCSTR,LPCSTR,SRRF,LPDWORD,LPVOID,LPDWORD);
 static LSTATUS (WINAPI *pSHRegCreateUSKeyW)(LPCWSTR,REGSAM,HUSKEY,PHUSKEY,DWORD);
+static LSTATUS (WINAPI *pSHRegOpenUSKeyW)(LPCWSTR,REGSAM,HUSKEY,PHUSKEY,BOOL);
+static LSTATUS (WINAPI *pSHRegCloseUSKey)(HUSKEY);
 
 static const char sTestpath1[] = "%LONGSYSTEMVAR%\\subdir1";
 static const char sTestpath2[] = "%FOO%\\subdir1";
@@ -462,6 +464,35 @@ static void test_SHRegCreateUSKeyW(void)
     ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
 }
 
+static void test_SHRegCloseUSKey(void)
+{
+    static const WCHAR localW[] = {'S','o','f','t','w','a','r','e',0};
+    LONG ret;
+    HUSKEY key;
+
+    if (!pSHRegOpenUSKeyW || !pSHRegCloseUSKey)
+    {
+        win_skip("SHRegOpenUSKeyW or SHRegCloseUSKey not available\n");
+        return;
+    }
+
+    ret = pSHRegCloseUSKey(NULL);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+
+    ret = pSHRegOpenUSKeyW(localW, KEY_ALL_ACCESS, NULL, &key, FALSE);
+    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+
+    ret = pSHRegCloseUSKey(key);
+    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+
+    /* Test with limited rights, specially without KEY_SET_VALUE */
+    ret = pSHRegOpenUSKeyW(localW, KEY_QUERY_VALUE, NULL, &key, FALSE);
+    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+
+    ret = pSHRegCloseUSKey(key);
+    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+}
+
 START_TEST(shreg)
 {
     HKEY hkey = create_test_entries();
@@ -480,6 +511,8 @@ START_TEST(shreg)
     pSHRegGetPathA = (void*)GetProcAddress(hshlwapi,"SHRegGetPathA");
     pSHRegGetValueA = (void*)GetProcAddress(hshlwapi,"SHRegGetValueA");
     pSHRegCreateUSKeyW = (void*)GetProcAddress(hshlwapi, "SHRegCreateUSKeyW");
+    pSHRegOpenUSKeyW = (void*)GetProcAddress(hshlwapi, "SHRegOpenUSKeyW");
+    pSHRegCloseUSKey = (void*)GetProcAddress(hshlwapi, "SHRegCloseUSKey");
 
     test_SHGetValue();
     test_SHRegGetValue();
@@ -488,6 +521,7 @@ START_TEST(shreg)
     test_SHCopyKey();
     test_SHDeleteKey();
     test_SHRegCreateUSKeyW();
+    test_SHRegCloseUSKey();
 
     delete_key( hkey, "Software\\Wine", "Test" );
 }