[ros-diffs] [cwittich] 45977: [SHELL32_WINETEST] sync shell32_winetest to wine 1.1.40

cwittich at svn.reactos.org cwittich at svn.reactos.org
Sun Mar 7 08:34:02 CET 2010


Author: cwittich
Date: Sun Mar  7 08:34:02 2010
New Revision: 45977

URL: http://svn.reactos.org/svn/reactos?rev=45977&view=rev
Log:
[SHELL32_WINETEST]
sync shell32_winetest to wine 1.1.40

Modified:
    trunk/rostests/winetests/shell32/autocomplete.c
    trunk/rostests/winetests/shell32/shlexec.c
    trunk/rostests/winetests/shell32/shlfileop.c
    trunk/rostests/winetests/shell32/shlfolder.c

Modified: trunk/rostests/winetests/shell32/autocomplete.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/autocomplete.c?rev=45977&r1=45976&r2=45977&view=diff
==============================================================================
--- trunk/rostests/winetests/shell32/autocomplete.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shell32/autocomplete.c [iso-8859-1] Sun Mar  7 08:34:02 2010
@@ -126,9 +126,8 @@
         return;
 
     createMainWnd();
-
-    if(!ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n"))
-        return;
+    ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n");
+    if (!hMainWnd) return;
 
     ac = test_init();
     if (!ac)

Modified: trunk/rostests/winetests/shell32/shlexec.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlexec.c?rev=45977&r1=45976&r2=45977&view=diff
==============================================================================
--- trunk/rostests/winetests/shell32/shlexec.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shell32/shlexec.c [iso-8859-1] Sun Mar  7 08:34:02 2010
@@ -672,28 +672,28 @@
     return 0;
 }
 
-static int _okChildString(const char* file, int line, const char* key, const char* expected)
+static void _okChildString(const char* file, int line, const char* key, const char* expected)
 {
     char* result;
     result=getChildString("Arguments", key);
-    return ok_(file, line)(lstrcmpiA(result, expected) == 0,
-               "%s expected '%s', got '%s'\n", key, expected, result);
-}
-
-static int _okChildPath(const char* file, int line, const char* key, const char* expected)
+    ok_(file, line)(lstrcmpiA(result, expected) == 0,
+                    "%s expected '%s', got '%s'\n", key, expected, result);
+}
+
+static void _okChildPath(const char* file, int line, const char* key, const char* expected)
 {
     char* result;
     result=getChildString("Arguments", key);
-    return ok_(file, line)(StrCmpPath(result, expected) == 0,
-               "%s expected '%s', got '%s'\n", key, expected, result);
-}
-
-static int _okChildInt(const char* file, int line, const char* key, int expected)
+    ok_(file, line)(StrCmpPath(result, expected) == 0,
+                    "%s expected '%s', got '%s'\n", key, expected, result);
+}
+
+static void _okChildInt(const char* file, int line, const char* key, int expected)
 {
     INT result;
     result=GetPrivateProfileIntA("Arguments", key, expected, child_file);
-    return ok_(file, line)(result == expected,
-               "%s expected %d, but got %d\n", key, expected, result);
+    ok_(file, line)(result == expected,
+                    "%s expected %d, but got %d\n", key, expected, result);
 }
 
 #define okChildString(key, expected) _okChildString(__FILE__, __LINE__, (key), (expected))

Modified: trunk/rostests/winetests/shell32/shlfileop.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlfileop.c?rev=45977&r1=45976&r2=45977&view=diff
==============================================================================
--- trunk/rostests/winetests/shell32/shlfileop.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shell32/shlfileop.c [iso-8859-1] Sun Mar  7 08:34:02 2010
@@ -965,6 +965,26 @@
     ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
     ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1 to exist\n");
 
+    /* try to overwrite an existing write protected file */
+    clean_after_shfo_tests();
+    init_shfo_tests();
+    tmp_flags = shfo.fFlags;
+    shfo.pFrom = "test1.txt\0";
+    shfo.pTo = "test2.txt\0";
+    /* suppress the error-dialog in win9x here */
+    shfo.fFlags = FOF_NOERRORUI | FOF_NOCONFIRMATION | FOF_SILENT;
+    ok(SetFileAttributesA(shfo.pTo, FILE_ATTRIBUTE_READONLY),
+        "Failure to set file attributes (error %x)\n", GetLastError());
+    retval = CopyFileA(shfo.pFrom, shfo.pTo, FALSE);
+    ok(!retval && GetLastError() == ERROR_ACCESS_DENIED, "CopyFileA should have fail with ERROR_ACCESS_DENIED\n");
+    retval = SHFileOperationA(&shfo);
+    /* Does not work on Win95, Win95B, NT4WS and NT4SRV */
+    ok(!retval || broken(retval == DE_OPCANCELLED), "SHFileOperationA failed to copy (error %x)\n", retval);
+    /* Set back normal attributes to make the file deletion succeed */
+    ok(SetFileAttributesA(shfo.pTo, FILE_ATTRIBUTE_NORMAL),
+        "Failure to set file attributes (error %x)\n", GetLastError());
+    shfo.fFlags = tmp_flags;
+
     /* try to copy files to a file */
     clean_after_shfo_tests();
     init_shfo_tests();

Modified: trunk/rostests/winetests/shell32/shlfolder.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlfolder.c?rev=45977&r1=45976&r2=45977&view=diff
==============================================================================
--- trunk/rostests/winetests/shell32/shlfolder.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shell32/shlfolder.c [iso-8859-1] Sun Mar  7 08:34:02 2010
@@ -54,7 +54,7 @@
 static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
 static HRESULT (WINAPI *pSHCreateShellItem)(LPCITEMIDLIST,IShellFolder*,LPCITEMIDLIST,IShellItem**);
 static LPITEMIDLIST (WINAPI *pILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
-
+static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*);
 
 static void init_function_pointers(void)
 {
@@ -62,17 +62,24 @@
     HRESULT hr;
 
     hmod = GetModuleHandleA("shell32.dll");
-    pSHBindToParent = (void*)GetProcAddress(hmod, "SHBindToParent");
-    pSHGetFolderPathA = (void*)GetProcAddress(hmod, "SHGetFolderPathA");
-    pSHGetFolderPathAndSubDirA = (void*)GetProcAddress(hmod, "SHGetFolderPathAndSubDirA");
-    pSHGetPathFromIDListW = (void*)GetProcAddress(hmod, "SHGetPathFromIDListW");
-    pSHGetSpecialFolderPathA = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathA");
-    pSHGetSpecialFolderPathW = (void*)GetProcAddress(hmod, "SHGetSpecialFolderPathW");
-    pILFindLastID = (void *)GetProcAddress(hmod, (LPCSTR)16);
-    pILFree = (void*)GetProcAddress(hmod, (LPSTR)155);
-    pILIsEqual = (void*)GetProcAddress(hmod, (LPSTR)21);
-    pSHCreateShellItem = (void*)GetProcAddress(hmod, "SHCreateShellItem");
-    pILCombine = (void*)GetProcAddress(hmod, (LPSTR)25);
+
+#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f))
+    MAKEFUNC(SHBindToParent);
+    MAKEFUNC(SHCreateShellItem);
+    MAKEFUNC(SHGetFolderPathA);
+    MAKEFUNC(SHGetFolderPathAndSubDirA);
+    MAKEFUNC(SHGetPathFromIDListW);
+    MAKEFUNC(SHGetSpecialFolderPathA);
+    MAKEFUNC(SHGetSpecialFolderPathW);
+    MAKEFUNC(SHParseDisplayName);
+#undef MAKEFUNC
+
+#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
+    MAKEFUNC_ORD(ILFindLastID, 16);
+    MAKEFUNC_ORD(ILIsEqual, 21);
+    MAKEFUNC_ORD(ILCombine, 25);
+    MAKEFUNC_ORD(ILFree, 155);
+#undef MAKEFUNC_ORD
 
     hmod = GetModuleHandleA("shlwapi.dll");
     pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
@@ -96,6 +103,24 @@
 
     hr = SHGetDesktopFolder(&IDesktopFolder);
     if(hr != S_OK) return;
+
+    /* Tests crash on W2K and below (SHCreateShellItem available as of XP) */
+    if (pSHCreateShellItem)
+    {
+        /* null name and pidl */
+        hr = IShellFolder_ParseDisplayName(IDesktopFolder,
+            NULL, NULL, NULL, NULL, NULL, 0);
+        ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr);
+
+        /* null name */
+        newPIDL = (ITEMIDLIST*)0xdeadbeef;
+        hr = IShellFolder_ParseDisplayName(IDesktopFolder,
+            NULL, NULL, NULL, NULL, &newPIDL, 0);
+        ok(newPIDL == 0, "expected null, got %p\n", newPIDL);
+        ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr);
+    }
+    else
+        win_skip("Tests would crash on W2K and below\n");
 
     MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH);
     hr = IShellFolder_ParseDisplayName(IDesktopFolder,
@@ -331,11 +356,12 @@
     hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
     ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
 
-#if 0
+if (0)
+{
     /* this call segfaults on 98SE */
     hr = IShellFolder_BindToObject(psfMyComputer, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
     ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
-#endif
+}
 
     cChars = GetSystemDirectoryA(szSystemDir, MAX_PATH);
     ok (cChars > 0 && cChars < MAX_PATH, "GetSystemDirectoryA failed! LastError: %u\n", GetLastError());
@@ -361,13 +387,14 @@
     hr = IShellFolder_BindToObject(psfSystemDir, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
     ok (hr == E_INVALIDARG, 
         "FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
-    
-#if 0
+
+if (0)
+{
     /* this call segfaults on 98SE */
     hr = IShellFolder_BindToObject(psfSystemDir, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
-    ok (hr == E_INVALIDARG, 
+    ok (hr == E_INVALIDARG,
         "FileSystem ShellFolder's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
-#endif
+}
 
     IShellFolder_Release(psfSystemDir);
 }
@@ -1564,7 +1591,7 @@
     IShellFolder_Release(psfPersonal);
 }
 
-static void testSHGetFolderPathAndSubDirA(void)
+static void test_SHGetFolderPathAndSubDirA(void)
 {
     HRESULT ret;
     BOOL delret;
@@ -1575,6 +1602,12 @@
     static char appdata[MAX_PATH];
     static char testpath[MAX_PATH];
     static char toolongpath[MAX_PATH+1];
+
+    if(!pSHGetFolderPathAndSubDirA)
+    {
+        win_skip("SHGetFolderPathAndSubDirA not present!\n");
+        return;
+    }
 
     if(!pSHGetFolderPathA) {
         win_skip("SHGetFolderPathA not present!\n");
@@ -1796,6 +1829,12 @@
     static WCHAR testfileW[] = {'t','e','s','t','f','i','l','e',0};
 
     GetCurrentDirectoryA(MAX_PATH, curdirA);
+
+    if (!pSHCreateShellItem)
+    {
+        win_skip("SHCreateShellItem isn't available\n");
+        return;
+    }
 
     if (!lstrlenA(curdirA))
     {
@@ -1942,6 +1981,69 @@
     IShellFolder_Release(desktopfolder);
 }
 
+static void test_SHParseDisplayName(void)
+{
+    static const WCHAR prefixW[] = {'w','t',0};
+    LPITEMIDLIST pidl1, pidl2;
+    IShellFolder *desktop;
+    WCHAR dirW[MAX_PATH];
+    WCHAR nameW[10];
+    HRESULT hr;
+    BOOL ret;
+
+    if (!pSHParseDisplayName)
+    {
+        win_skip("SHParseDisplayName isn't available\n");
+        return;
+    }
+
+if (0)
+{
+    /* crashes on native */
+    hr = pSHParseDisplayName(NULL, NULL, NULL, 0, NULL);
+    nameW[0] = 0;
+    hr = pSHParseDisplayName(nameW, NULL, NULL, 0, NULL);
+}
+
+    pidl1 = (LPITEMIDLIST)0xdeadbeef;
+    hr = pSHParseDisplayName(NULL, NULL, &pidl1, 0, NULL);
+    ok(broken(hr == E_OUTOFMEMORY) /* < Vista */ ||
+       hr == E_INVALIDARG, "failed %08x\n", hr);
+    ok(pidl1 == 0, "expected null ptr, got %p\n", pidl1);
+
+    /* dummy name */
+    nameW[0] = 0;
+    hr = pSHParseDisplayName(nameW, NULL, &pidl1, 0, NULL);
+    ok(hr == S_OK, "failed %08x\n", hr);
+    hr = SHGetDesktopFolder(&desktop);
+    ok(hr == S_OK, "failed %08x\n", hr);
+    hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, nameW, NULL, &pidl2, NULL);
+    ok(hr == S_OK, "failed %08x\n", hr);
+    ret = pILIsEqual(pidl1, pidl2);
+    ok(ret == TRUE, "expected equal idls\n");
+    pILFree(pidl1);
+    pILFree(pidl2);
+
+    /* with path */
+    GetTempPathW(sizeof(dirW)/sizeof(WCHAR), dirW);
+    GetTempFileNameW(dirW, prefixW, 0, dirW);
+    CreateFileW(dirW, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+
+    hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
+    ok(hr == S_OK, "failed %08x\n", hr);
+    hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, dirW, NULL, &pidl2, NULL);
+    ok(hr == S_OK, "failed %08x\n", hr);
+
+    ret = pILIsEqual(pidl1, pidl2);
+    ok(ret == TRUE, "expected equal idls\n");
+    pILFree(pidl1);
+    pILFree(pidl2);
+
+    DeleteFileW(dirW);
+
+    IShellFolder_Release(desktop);
+}
+
 START_TEST(shlfolder)
 {
     init_function_pointers();
@@ -1950,6 +2052,7 @@
     OleInitialize(NULL);
 
     test_ParseDisplayName();
+    test_SHParseDisplayName();
     test_BindToObject();
     test_EnumObjects_and_CompareIDs();
     test_GetDisplayName();
@@ -1958,15 +2061,9 @@
     test_CallForAttributes();
     test_FolderShortcut();
     test_ITEMIDLIST_format();
-    if(pSHGetFolderPathAndSubDirA)
-        testSHGetFolderPathAndSubDirA();
-    else
-        win_skip("SHGetFolderPathAndSubDirA not present\n");
+    test_SHGetFolderPathAndSubDirA();
     test_LocalizedNames();
-    if(pSHCreateShellItem)
-        test_SHCreateShellItem();
-    else
-        win_skip("SHCreateShellItem not present\n");
+    test_SHCreateShellItem();
 
     OleUninitialize();
 }




More information about the Ros-diffs mailing list