Nikolay Sivov : shell32: Add IFolderView::Item implementation.

Alexandre Julliard julliard at winehq.org
Tue Mar 23 12:12:46 CDT 2010


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Mar 23 05:08:10 2010 +0300

shell32: Add IFolderView::Item implementation.

---

 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);
 




More information about the wine-cvs mailing list