[PATCH 4/6] comsvcs: Implement Hash() for "new" moniker.

Nikolay Sivov nsivov at codeweavers.com
Sun Nov 3 13:30:58 CST 2019


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/comsvcs/main.c          | 10 ++++++++--
 dlls/comsvcs/tests/comsvcs.c |  3 +--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/comsvcs/main.c b/dlls/comsvcs/main.c
index 101af6f071..7addd1ee80 100644
--- a/dlls/comsvcs/main.c
+++ b/dlls/comsvcs/main.c
@@ -55,6 +55,7 @@ struct new_moniker
 {
     IMoniker IMoniker_iface;
     LONG refcount;
+    CLSID clsid;
 };
 
 static HRESULT new_moniker_parse_displayname(IBindCtx *pbc, LPOLESTR name, ULONG *eaten, IMoniker **ret);
@@ -556,9 +557,13 @@ static HRESULT WINAPI new_moniker_IsEqual(IMoniker *iface, IMoniker *other_monik
 
 static HRESULT WINAPI new_moniker_Hash(IMoniker *iface, DWORD *hash)
 {
-    FIXME("%p, %p.\n", iface, hash);
+    struct new_moniker *moniker = impl_from_IMoniker(iface);
 
-    return E_NOTIMPL;
+    TRACE("%p, %p.\n", iface, hash);
+
+    *hash = moniker->clsid.Data1;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI new_moniker_IsRunning(IMoniker* iface, IBindCtx *pbc, IMoniker *pmkToLeft,
@@ -748,6 +753,7 @@ static HRESULT new_moniker_parse_displayname(IBindCtx *pbc, LPOLESTR name, ULONG
 
     moniker->IMoniker_iface.lpVtbl = &new_moniker_vtbl;
     moniker->refcount = 1;
+    moniker->clsid = guid;
 
     *ret = &moniker->IMoniker_iface;
 
diff --git a/dlls/comsvcs/tests/comsvcs.c b/dlls/comsvcs/tests/comsvcs.c
index b377a9a515..cbe338872a 100644
--- a/dlls/comsvcs/tests/comsvcs.c
+++ b/dlls/comsvcs/tests/comsvcs.c
@@ -327,10 +327,9 @@ static void test_new_moniker(void)
     /* Hashing */
     hash = 0;
     hr = IMoniker_Hash(moniker, &hash);
-todo_wine {
     ok(hr == S_OK, "Failed to get a hash, hr %#x.\n", hr);
     ok(hash == 0x20d04fe0, "Unexpected hash value %#x.\n", hash);
-}
+
     moniker_type = MKSYS_CLASSMONIKER;
     hr = IMoniker_IsSystemMoniker(moniker, &moniker_type);
 todo_wine {
-- 
2.24.0.rc1




More information about the wine-devel mailing list