From acb2e4fc7a4242c74ac91657edb97bf1e402656a Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 3 Nov 2019 00:13:37 +0300 Subject: [PATCH] propsys: Add a semi-stub for PSCreatePropertyStoreFromObject(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47958 Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/propsys/propstore.c | 16 ++++++++++++++++ dlls/propsys/propsys.spec | 2 +- dlls/propsys/tests/propsys.c | 35 ++++++++++++++++++++++++++++++++++- include/propsys.idl | 1 + 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c index 6212f293123..6e0d49057d9 100644 --- a/dlls/propsys/propstore.c +++ b/dlls/propsys/propstore.c @@ -473,3 +473,19 @@ HRESULT PropertyStore_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv return ret; } + +HRESULT WINAPI PSCreatePropertyStoreFromObject(IUnknown *obj, DWORD access, REFIID riid, void **ret) +{ + HRESULT hr; + + TRACE("(%p, %d, %s, %p)\n", obj, access, debugstr_guid(riid), ret); + + if (!obj || !ret) + return E_POINTER; + + if (IsEqualIID(riid, &IID_IPropertyStore) && SUCCEEDED(hr = IUnknown_QueryInterface(obj, riid, ret))) + return hr; + + FIXME("Unimplemented for %s.\n", debugstr_guid(riid)); + return E_NOTIMPL; +} diff --git a/dlls/propsys/propsys.spec b/dlls/propsys/propsys.spec index 8416b6dc74d..35828057264 100644 --- a/dlls/propsys/propsys.spec +++ b/dlls/propsys/propsys.spec @@ -68,7 +68,7 @@ @ stdcall PSCreateMemoryPropertyStore(ptr ptr) @ stub PSCreateMultiplexPropertyStore @ stub PSCreatePropertyChangeArray -@ stub PSCreatePropertyStoreFromObject +@ stdcall PSCreatePropertyStoreFromObject(ptr long ptr ptr) @ stub PSCreatePropertyStoreFromPropertySetStorage @ stub PSCreateSimplePropertyChange @ stub PSEnumeratePropertyDescriptions diff --git a/dlls/propsys/tests/propsys.c b/dlls/propsys/tests/propsys.c index 419a0a080b8..191a1547440 100644 --- a/dlls/propsys/tests/propsys.c +++ b/dlls/propsys/tests/propsys.c @@ -29,8 +29,8 @@ #include "windef.h" #include "winbase.h" -#include "objbase.h" #include "initguid.h" +#include "objbase.h" #include "propsys.h" #include "propvarutil.h" #include "strsafe.h" @@ -1919,6 +1919,38 @@ static void test_propertystore(void) IPropertyStore_Release(propstore); } +static void test_PSCreatePropertyStoreFromObject(void) +{ + IPropertyStore *propstore; + IUnknown *unk; + HRESULT hr; + + hr = PSCreateMemoryPropertyStore(&IID_IPropertyStore, (void **)&propstore); + ok(hr == S_OK, "Failed to create property store, hr %#x.\n", hr); + + hr = PSCreatePropertyStoreFromObject(NULL, STGM_READWRITE, &IID_IUnknown, (void **)&unk); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = PSCreatePropertyStoreFromObject((IUnknown *)propstore, STGM_READWRITE, &IID_IUnknown, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = PSCreatePropertyStoreFromObject((IUnknown *)propstore, STGM_READWRITE, &IID_IUnknown, (void **)&unk); +todo_wine + ok(hr == S_OK, "Failed to create wrapper, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + ok(unk != (IUnknown *)propstore, "Unexpected object returned.\n"); + IUnknown_Release(unk); + } + + hr = PSCreatePropertyStoreFromObject((IUnknown *)propstore, STGM_READWRITE, &IID_IPropertyStore, (void **)&unk); + ok(hr == S_OK, "Failed to create wrapper, hr %#x.\n", hr); + ok(unk == (IUnknown *)propstore, "Unexpected object returned.\n"); + IUnknown_Release(unk); + + IPropertyStore_Release(propstore); +} + START_TEST(propsys) { test_PSStringFromPropertyKey(); @@ -1941,4 +1973,5 @@ START_TEST(propsys) test_persistserialized(); test_PSCreateMemoryPropertyStore(); test_propertystore(); + test_PSCreatePropertyStoreFromObject(); } diff --git a/include/propsys.idl b/include/propsys.idl index bdd67fa6a59..fa6902831e0 100644 --- a/include/propsys.idl +++ b/include/propsys.idl @@ -800,6 +800,7 @@ cpp_quote("#define GUIDSTRING_MAX 39") cpp_quote("#define PKEYSTR_MAX (GUIDSTRING_MAX + 1 + PKEY_PIDSTR_MAX)") cpp_quote("HRESULT WINAPI PSCreateMemoryPropertyStore(REFIID,void **);") +cpp_quote("HRESULT WINAPI PSCreatePropertyStoreFromObject(IUnknown*,DWORD,REFIID,void **);") cpp_quote("HRESULT WINAPI PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);") cpp_quote("HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR,PROPERTYKEY*);") cpp_quote("HRESULT WINAPI PSGetPropertyDescription(REFPROPERTYKEY,REFIID,void **);")