propsys: Implement PSCreateMemoryPropertyStore().

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2019-02-07 16:31:59 +08:00 committed by Alexandre Julliard
parent bb4d919faf
commit 906f91db32
4 changed files with 63 additions and 1 deletions

View File

@ -65,7 +65,7 @@
@ stub PSCoerceToCanonicalValue
@ stub PSCreateAdapterFromPropertyStore
@ stub PSCreateDelayedMultiplexPropertyStore
@ stub PSCreateMemoryPropertyStore
@ stdcall PSCreateMemoryPropertyStore(ptr ptr)
@ stub PSCreateMultiplexPropertyStore
@ stub PSCreatePropertyChangeArray
@ stub PSCreatePropertyStoreFromObject

View File

@ -509,3 +509,10 @@ HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR pszString, PROPERTYKEY *pkey)
return S_OK;
}
HRESULT WINAPI PSCreateMemoryPropertyStore(REFIID riid, void **ppv)
{
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
return PropertyStore_CreateInstance(NULL, riid, ppv);
}

View File

@ -35,6 +35,15 @@
DEFINE_GUID(PKEY_WineTest, 0x7b317433, 0xdfa3, 0x4c44, 0xad, 0x3e, 0x2f, 0x80, 0x4b, 0x90, 0xdb, 0xf4);
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
{
ULONG rc;
IUnknown_AddRef(obj);
rc = IUnknown_Release(obj);
ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
}
static void test_inmemorystore(void)
{
IPropertyStoreCache *propcache;
@ -249,12 +258,57 @@ static void test_persistserialized(void)
IPersistSerializedPropStorage_Release(serialized);
}
static void test_PSCreateMemoryPropertyStore(void)
{
IPropertyStore *propstore, *propstore1;
IPersistSerializedPropStorage *serialized;
IPropertyStoreCache *propstorecache;
HRESULT hr;
/* PSCreateMemoryPropertyStore(&IID_IPropertyStore, NULL); crashes */
hr = PSCreateMemoryPropertyStore(&IID_IPropertyStore, (void **)&propstore);
ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
ok(propstore != NULL, "got %p.\n", propstore);
EXPECT_REF(propstore, 1);
hr = PSCreateMemoryPropertyStore(&IID_IPersistSerializedPropStorage, (void **)&serialized);
todo_wine ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
todo_wine ok(serialized != NULL, "got %p.\n", serialized);
EXPECT_REF(propstore, 1);
if(serialized)
{
EXPECT_REF(serialized, 1);
IPersistSerializedPropStorage_Release(serialized);
}
hr = PSCreateMemoryPropertyStore(&IID_IPropertyStoreCache, (void **)&propstorecache);
ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
ok(propstorecache != NULL, "got %p.\n", propstore);
ok(propstorecache != (IPropertyStoreCache *)propstore, "pointer are equal: %p, %p.\n", propstorecache, propstore);
EXPECT_REF(propstore, 1);
EXPECT_REF(propstorecache, 1);
hr = PSCreateMemoryPropertyStore(&IID_IPropertyStore, (void **)&propstore1);
ok(hr == S_OK, "PSCreateMemoryPropertyStore failed: 0x%08x.\n", hr);
ok(propstore1 != NULL, "got %p.\n", propstore);
ok(propstore1 != propstore, "pointer are equal: %p, %p.\n", propstore1, propstore);
EXPECT_REF(propstore, 1);
EXPECT_REF(propstore1, 1);
EXPECT_REF(propstorecache, 1);
IPropertyStore_Release(propstore1);
IPropertyStore_Release(propstore);
IPropertyStoreCache_Release(propstorecache);
}
START_TEST(propstore)
{
CoInitialize(NULL);
test_inmemorystore();
test_persistserialized();
test_PSCreateMemoryPropertyStore();
CoUninitialize();
}

View File

@ -799,6 +799,7 @@ cpp_quote("#define PKEY_PIDSTR_MAX 10")
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 PSStringFromPropertyKey(REFPROPERTYKEY,LPWSTR,UINT);")
cpp_quote("HRESULT WINAPI PSPropertyKeyFromString(LPCWSTR,PROPERTYKEY*);")
cpp_quote("HRESULT WINAPI PSGetPropertyDescription(REFPROPERTYKEY,REFIID,void **);")