Vincent Povirk : shell32: Fail properly when no pidl is passed to SHCreateShellItem.

Alexandre Julliard julliard at winehq.org
Fri May 22 08:25:33 CDT 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu May 21 11:24:29 2009 -0500

shell32: Fail properly when no pidl is passed to SHCreateShellItem.

---

 dlls/shell32/shellitem.c       |    6 +++++-
 dlls/shell32/tests/shlfolder.c |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c
index 643f1b5..08b2e24 100644
--- a/dlls/shell32/shellitem.c
+++ b/dlls/shell32/shellitem.c
@@ -276,7 +276,11 @@ HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
 
     TRACE("(%p,%p,%p,%p)\n", pidlParent, psfParent, pidl, ppsi);
 
-    if (!pidlParent && !psfParent && pidl)
+    if (!pidl)
+    {
+        return E_INVALIDARG;
+    }
+    else if (!pidlParent && !psfParent)
     {
         new_pidl = ILClone(pidl);
         if (!new_pidl)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 0b5d7b2..9c0c9a0 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -1783,7 +1783,7 @@ static void test_SHCreateShellItem(void)
     pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile);
 
     ret = pSHCreateShellItem(NULL, NULL, NULL, &shellitem);
-    todo_wine ok(ret == E_INVALIDARG, "SHCreateShellItem returned %x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateShellItem returned %x\n", ret);
 
     if (0) /* crashes on Windows XP */
     {




More information about the wine-cvs mailing list