[PATCH v2 3/3] shell32: Implement FolderItems_get_Count.

Alex Henrie alexhenrie24 at gmail.com
Sun Sep 10 23:43:12 CDT 2017


Gets rid of a confusing error message in some GOG installers, see
https://dev.wine-staging.com/patches/63/

If this patchset is accepted, Wine Staging can drop their hacky
workaround.

v2: No changes

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/shell32/shelldispatch.c       | 7 +++++--
 dlls/shell32/tests/shelldispatch.c | 8 --------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/dlls/shell32/shelldispatch.c b/dlls/shell32/shelldispatch.c
index 7559c7861f..f0f93d2c01 100644
--- a/dlls/shell32/shelldispatch.c
+++ b/dlls/shell32/shelldispatch.c
@@ -1061,9 +1061,12 @@ static HRESULT WINAPI FolderItemsImpl_Invoke(FolderItems3 *iface,
 
 static HRESULT WINAPI FolderItemsImpl_get_Count(FolderItems3 *iface, LONG *count)
 {
-    FIXME("(%p,%p)\n", iface, count);
+    FolderItemsImpl *This = impl_from_FolderItems(iface);
 
-    return E_NOTIMPL;
+    TRACE("(%p,%p)\n", iface, count);
+
+    *count = PathIsDirectoryW(V_BSTR(&This->dir)) ? This->item_count : 0;
+    return S_OK;
 }
 
 static HRESULT WINAPI FolderItemsImpl_get_Application(FolderItems3 *iface, IDispatch **ppid)
diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c
index 63d6f94b26..0529bb2d10 100644
--- a/dlls/shell32/tests/shelldispatch.c
+++ b/dlls/shell32/tests/shelldispatch.c
@@ -444,9 +444,7 @@ static void test_items(void)
         r = FolderItems_get_Count(items, NULL);
 
     r = FolderItems_get_Count(items, &count);
-todo_wine
     ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
-todo_wine
     ok(!count, "expected 0 files, got %d\n", count);
 
     V_VT(&var) = VT_I4;
@@ -484,9 +482,7 @@ todo_wine
     /* test that get_Count is not aware of the newly created files */
     count = -1;
     r = FolderItems_get_Count(items, &count);
-todo_wine
     ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
-todo_wine
     ok(!count, "expected 0 files, got %d\n", count);
 
     /* test that the newly created files CAN be retrieved by string index */
@@ -514,9 +510,7 @@ todo_wine
 
     count = -1;
     r = FolderItems_get_Count(items, &count);
-todo_wine
     ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
-todo_wine
     ok(count == sizeof(file_defs)/sizeof(file_defs[0]),
        "expected %d files, got %d\n", (LONG)(sizeof(file_defs)/sizeof(file_defs[0])), count);
 
@@ -737,9 +731,7 @@ todo_wine
     /* test that everything stops working after the directory has been removed */
     count = -1;
     r = FolderItems_get_Count(items, &count);
-todo_wine
     ok(r == S_OK, "FolderItems::get_Count failed: %08x\n", r);
-todo_wine
     ok(!count, "expected 0 files, got %d\n", count);
 
     item = NULL;
-- 
2.14.1




More information about the wine-patches mailing list