Vincent Povirk : propsys: Implement IPropertyStoreCache::GetValueAndState.
Alexandre Julliard
julliard at winehq.org
Thu May 24 14:58:14 CDT 2012
Module: wine
Branch: master
Commit: c3748c7daaeb2b0ca961787c7866434842b680d5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c3748c7daaeb2b0ca961787c7866434842b680d5
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Tue May 22 15:40:45 2012 -0500
propsys: Implement IPropertyStoreCache::GetValueAndState.
---
dlls/propsys/propstore.c | 27 +++++++++++++++++++++++++--
dlls/propsys/tests/propstore.c | 10 +++++-----
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c
index 00ff701..7c28131 100644
--- a/dlls/propsys/propstore.c
+++ b/dlls/propsys/propstore.c
@@ -351,8 +351,31 @@ static HRESULT WINAPI PropertyStore_GetState(IPropertyStoreCache *iface,
static HRESULT WINAPI PropertyStore_GetValueAndState(IPropertyStoreCache *iface,
REFPROPERTYKEY key, PROPVARIANT *ppropvar, PSC_STATE *pstate)
{
- FIXME("%p,%p,%p,%p: stub\n", iface, key, ppropvar, pstate);
- return E_NOTIMPL;
+ PropertyStore *This = impl_from_IPropertyStoreCache(iface);
+ propstore_value *value;
+ HRESULT hr;
+
+ TRACE("%p,%p,%p,%p\n", iface, key, ppropvar, pstate);
+
+ EnterCriticalSection(&This->lock);
+
+ hr = PropertyStore_LookupValue(This, key, 0, &value);
+
+ if (SUCCEEDED(hr))
+ hr = PropVariantCopy(ppropvar, &value->propvar);
+
+ if (SUCCEEDED(hr))
+ *pstate = value->state;
+
+ LeaveCriticalSection(&This->lock);
+
+ if (FAILED(hr))
+ {
+ PropVariantInit(ppropvar);
+ *pstate = PSC_NORMAL;
+ }
+
+ return hr;
}
static HRESULT WINAPI PropertyStore_SetState(IPropertyStoreCache *iface,
diff --git a/dlls/propsys/tests/propstore.c b/dlls/propsys/tests/propstore.c
index 17cf7f3..ad06ea0 100644
--- a/dlls/propsys/tests/propstore.c
+++ b/dlls/propsys/tests/propstore.c
@@ -138,9 +138,9 @@ static void test_inmemorystore(void)
propvar.vt = VT_I2;
state = 0xdeadbeef;
hr = IPropertyStoreCache_GetValueAndState(propcache, &pkey, &propvar, &state);
- todo_wine ok(hr == TYPE_E_ELEMENTNOTFOUND, "GetValueAndState failed, hr=%x\n", hr);
- todo_wine ok(propvar.vt == VT_EMPTY, "expected VT_EMPTY, got %d\n", propvar.vt);
- todo_wine ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state);
+ ok(hr == TYPE_E_ELEMENTNOTFOUND, "GetValueAndState failed, hr=%x\n", hr);
+ ok(propvar.vt == VT_EMPTY, "expected VT_EMPTY, got %d\n", propvar.vt);
+ ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state);
/* Set state on an unset field */
hr = IPropertyStoreCache_SetState(propcache, &pkey, PSC_NORMAL);
@@ -171,8 +171,8 @@ static void test_inmemorystore(void)
memset(&propvar, 0, sizeof(propvar));
state = 0xdeadbeef;
hr = IPropertyStoreCache_GetValueAndState(propcache, &pkey, &propvar, &state);
- todo_wine ok(hr == S_OK, "GetValueAndState failed, hr=%x\n", hr);
- todo_wine ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
+ ok(hr == S_OK, "GetValueAndState failed, hr=%x\n", hr);
+ ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
todo_wine ok(propvar.u.lVal == 12346, "expected 12346, got %d\n", propvar.vt);
todo_wine ok(state == 5, "expected 5, got %d\n", state);
More information about the wine-cvs
mailing list