[PATCH] Add IFolderView::Item implementation

Nikolay Sivov nsivov at codeweavers.com
Mon Mar 22 21:08:10 CDT 2010


---
 dlls/shell32/shlview.c       |   21 ++++++++++++++++++---
 dlls/shell32/tests/shlview.c |   12 +++++++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index 3049c1b..653e5f3 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -2741,9 +2741,24 @@ static HRESULT WINAPI IFView_GetFolder(IFolderView *iface, REFIID riid, void **p
 
 static HRESULT WINAPI IFView_Item(IFolderView *iface, int index, PITEMID_CHILD *ppidl)
 {
-	IShellViewImpl *This = impl_from_IFolderView(iface);
-	FIXME("(%p)->(%d %p), stub\n", This, index, ppidl);
-	return E_NOTIMPL;
+    IShellViewImpl *This = impl_from_IFolderView(iface);
+    LVITEMW item;
+
+    TRACE("(%p)->(%d %p)\n", This, index, ppidl);
+
+    item.mask = LVIF_PARAM;
+    item.iItem = index;
+
+    if (SendMessageW(This->hWndList, LVM_GETITEMW, 0, (LPARAM)&item))
+    {
+        *ppidl = ILClone((PITEMID_CHILD)item.lParam);
+        return S_OK;
+    }
+    else
+    {
+        *ppidl = 0;
+        return E_INVALIDARG;
+    }
 }
 
 static HRESULT WINAPI IFView_ItemCount(IFolderView *iface, UINT flags, int *items)
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c
index 35b001a..59716d5 100644
--- a/dlls/shell32/tests/shlview.c
+++ b/dlls/shell32/tests/shlview.c
@@ -370,6 +370,7 @@ static void test_IFolderView(void)
     IShellBrowser *browser;
     IFolderView *fv;
     HWND hwnd_view, hwnd_list;
+    PITEMID_CHILD pidl;
     HRESULT hr;
     INT ret;
     POINT pt;
@@ -395,6 +396,11 @@ static void test_IFolderView(void)
     hr = IFolderView_GetSpacing(fv, NULL);
     ok(hr == S_FALSE || broken(hr == S_OK) /* win7 */, "got (0x%08x)\n", hr);
 
+    pidl = (void*)0xdeadbeef;
+    hr = IFolderView_Item(fv, 0, &pidl);
+    ok(hr == E_INVALIDARG || broken(hr == E_FAIL) /* < Vista */, "got (0x%08x)\n", hr);
+    ok(pidl == 0 || broken(pidl == (void*)0xdeadbeef) /* < Vista */, "got %p\n", pidl);
+
 if (0)
 {
     /* crashes on Vista and Win2k8 - List not created yet case */
@@ -403,6 +409,9 @@ if (0)
     /* crashes on XP */
     hr = IFolderView_GetSelectionMarkedItem(fv, NULL);
     hr = IFolderView_GetFocusedItem(fv, NULL);
+
+    /* crashes on Vista+ */
+    hr = IFolderView_Item(fv, 0, NULL);
 }
 
     browser = IShellBrowserImpl_Construct();
@@ -585,7 +594,8 @@ static void test_IShellFolderView(void)
     i = 0xdeadbeef;
     hr = IShellFolderView_RemoveObject(folderview, NULL, &i);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
-    ok(i == 0, "got %d\n", i);
+    ok(i == 0 || i == -1 /* Win7 */ || broken(i == 0xdeadbeef) /* Vista, 2k8 */,
+        "got %d\n", i);
 
     IShellFolderView_Release(folderview);
 
-- 
1.5.6.5


--=-ISuJotjSKs5jUizdnecE--




More information about the wine-patches mailing list