[PATCH 2/2] shell32: Added remaining Application() properties

Nikolay Sivov nsivov at codeweavers.com
Mon Sep 18 02:39:42 CDT 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/shell32/shelldispatch.c       | 23 ++++++++++++++++-------
 dlls/shell32/tests/shelldispatch.c | 23 ++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/dlls/shell32/shelldispatch.c b/dlls/shell32/shelldispatch.c
index c489eb6153..24843f021b 100644
--- a/dlls/shell32/shelldispatch.c
+++ b/dlls/shell32/shelldispatch.c
@@ -292,7 +292,10 @@ static HRESULT WINAPI FolderItemVerbImpl_Invoke(FolderItemVerb *iface,
 
 static HRESULT WINAPI FolderItemVerbImpl_get_Application(FolderItemVerb *iface, IDispatch **disp)
 {
-    FIXME("(%p, %p)\n", iface, disp);
+    TRACE("(%p, %p)\n", iface, disp);
+
+    if (disp)
+        *disp = NULL;
     return E_NOTIMPL;
 }
 
@@ -474,7 +477,10 @@ static HRESULT WINAPI FolderItemVerbsImpl_get_Count(FolderItemVerbs *iface, LONG
 
 static HRESULT WINAPI FolderItemVerbsImpl_get_Application(FolderItemVerbs *iface, IDispatch **disp)
 {
-    FIXME("(%p, %p)\n", iface, disp);
+    TRACE("(%p, %p)\n", iface, disp);
+
+    if (disp)
+        *disp = NULL;
     return E_NOTIMPL;
 }
 
@@ -1764,13 +1770,16 @@ static HRESULT WINAPI ShellDispatch_Invoke(IShellDispatch6 *iface,
     return hr;
 }
 
-static HRESULT WINAPI ShellDispatch_get_Application(IShellDispatch6 *iface,
-        IDispatch **ppid)
+static HRESULT WINAPI ShellDispatch_get_Application(IShellDispatch6 *iface, IDispatch **disp)
 {
-    FIXME("(%p,%p)\n", iface, ppid);
+    TRACE("(%p,%p)\n", iface, disp);
 
-    *ppid = NULL;
-    return E_NOTIMPL;
+    if (!disp)
+        return E_INVALIDARG;
+
+    *disp = (IDispatch *)iface;
+    IDispatch_AddRef(*disp);
+    return S_OK;
 }
 
 static HRESULT WINAPI ShellDispatch_get_Parent(IShellDispatch6 *iface, IDispatch **disp)
diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c
index fa7e8dc8a2..a9c5549877 100644
--- a/dlls/shell32/tests/shelldispatch.c
+++ b/dlls/shell32/tests/shelldispatch.c
@@ -130,6 +130,12 @@ static void test_namespace(void)
     r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (void **)&sd);
     ok(SUCCEEDED(r), "Failed to create ShellDispatch object: %#x.\n", r);
 
+    disp = NULL;
+    r = IShellDispatch_get_Application(sd, &disp);
+    ok(r == S_OK, "Failed to get application pointer, hr %#x.\n", r);
+    ok(disp == (IDispatch *)sd, "Unexpected application pointer %p.\n", disp);
+    IDispatch_Release(disp);
+
     disp = NULL;
     r = IShellDispatch_get_Parent(sd, &disp);
     ok(r == S_OK, "Failed to get Shell object parent, hr %#x.\n", r);
@@ -1226,7 +1232,7 @@ static void test_ParseName(void)
 
 static void test_Verbs(void)
 {
-    FolderItemVerbs *verbs;
+    FolderItemVerbs *verbs, *verbs2;
     WCHAR pathW[MAX_PATH];
     FolderItemVerb *verb;
     IShellDispatch *sd;
@@ -1265,6 +1271,16 @@ if (0) { /* crashes on some systems */
     hr = FolderItem_Verbs(item, &verbs);
     ok(hr == S_OK, "got 0x%08x\n", hr);
 
+    hr = FolderItem_Verbs(item, &verbs2);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(verbs2 != verbs, "Unexpected verbs pointer.\n");
+    FolderItemVerbs_Release(verbs2);
+
+    disp = (void *)0xdeadbeef;
+    hr = FolderItemVerbs_get_Application(verbs, &disp);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(disp == NULL, "Unexpected application pointer.\n");
+
     disp = (void *)0xdeadbeef;
     hr = FolderItemVerbs_get_Parent(verbs, &disp);
     ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
@@ -1303,6 +1319,11 @@ if (0) { /* crashes on winxp/win2k3 */
         ok(hr == E_NOTIMPL, "got %#x.\n", hr);
         ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
 
+        disp = (void *)0xdeadbeef;
+        hr = FolderItemVerb_get_Application(verb, &disp);
+        ok(hr == E_NOTIMPL, "got %#x.\n", hr);
+        ok(disp == NULL, "Unexpected parent pointer %p.\n", disp);
+
         SysFreeString(str);
         FolderItemVerb_Release(verb);
     }
-- 
2.14.1




More information about the wine-patches mailing list