Module: wine Branch: master Commit: a28183f390cc3975800ca2693a2a8ffec376e148 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a28183f390cc3975800ca2693a...
Author: Vincent Povirk vincent@codeweavers.com Date: Tue May 22 15:38:22 2012 -0500
propsys: Implement IPropertyStoreCache::GetState.
---
dlls/propsys/propstore.c | 21 +++++++++++++++++++-- dlls/propsys/tests/propstore.c | 10 +++++----- 2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c index a57bb2e..00ff701 100644 --- a/dlls/propsys/propstore.c +++ b/dlls/propsys/propstore.c @@ -327,8 +327,25 @@ static HRESULT WINAPI PropertyStore_Commit(IPropertyStoreCache *iface) static HRESULT WINAPI PropertyStore_GetState(IPropertyStoreCache *iface, REFPROPERTYKEY key, PSC_STATE *pstate) { - FIXME("%p,%p,%p: stub\n", iface, key, pstate); - return E_NOTIMPL; + PropertyStore *This = impl_from_IPropertyStoreCache(iface); + propstore_value *value; + HRESULT hr; + + TRACE("%p,%p,%p\n", iface, key, pstate); + + EnterCriticalSection(&This->lock); + + hr = PropertyStore_LookupValue(This, key, 0, &value); + + if (SUCCEEDED(hr)) + *pstate = value->state; + + LeaveCriticalSection(&This->lock); + + if (FAILED(hr)) + *pstate = PSC_NORMAL; + + return hr; }
static HRESULT WINAPI PropertyStore_GetValueAndState(IPropertyStoreCache *iface, diff --git a/dlls/propsys/tests/propstore.c b/dlls/propsys/tests/propstore.c index 7915b96..17cf7f3 100644 --- a/dlls/propsys/tests/propstore.c +++ b/dlls/propsys/tests/propstore.c @@ -132,8 +132,8 @@ static void test_inmemorystore(void)
state = 0xdeadbeef; hr = IPropertyStoreCache_GetState(propcache, &pkey, &state); - todo_wine ok(hr == TYPE_E_ELEMENTNOTFOUND, "GetState failed, hr=%x\n", hr); - todo_wine ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state); + ok(hr == TYPE_E_ELEMENTNOTFOUND, "GetState failed, hr=%x\n", hr); + ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state);
propvar.vt = VT_I2; state = 0xdeadbeef; @@ -152,15 +152,15 @@ static void test_inmemorystore(void)
state = 0xdeadbeef; hr = IPropertyStoreCache_GetState(propcache, &pkey, &state); - todo_wine ok(hr == S_OK, "GetState failed, hr=%x\n", hr); - todo_wine ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state); + ok(hr == S_OK, "GetState failed, hr=%x\n", hr); + ok(state == PSC_NORMAL, "expected PSC_NORMAL, got %d\n", state);
hr = IPropertyStoreCache_SetState(propcache, &pkey, 10); todo_wine ok(hr == S_OK, "SetState failed, hr=%x\n", hr);
state = 0xdeadbeef; hr = IPropertyStoreCache_GetState(propcache, &pkey, &state); - todo_wine ok(hr == S_OK, "GetState failed, hr=%x\n", hr); + ok(hr == S_OK, "GetState failed, hr=%x\n", hr); todo_wine ok(state == 10, "expected 10, got %d\n", state);
propvar.vt = VT_I4;