Module: wine Branch: master Commit: f833061e50dc44edbf8a892c1aab226e2bbb9c40 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f833061e50dc44edbf8a892c1a...
Author: Vincent Povirk vincent@codeweavers.com Date: Tue May 22 15:43:01 2012 -0500
propsys: Implement IPropertyStoreCache::SetState.
---
dlls/propsys/propstore.c | 18 ++++++++++++++++-- dlls/propsys/tests/propstore.c | 6 +++--- 2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c index 7c28131..c9df65e 100644 --- a/dlls/propsys/propstore.c +++ b/dlls/propsys/propstore.c @@ -381,8 +381,22 @@ static HRESULT WINAPI PropertyStore_GetValueAndState(IPropertyStoreCache *iface, static HRESULT WINAPI PropertyStore_SetState(IPropertyStoreCache *iface, REFPROPERTYKEY key, PSC_STATE pstate) { - FIXME("%p,%p,%d: stub\n", iface, key, pstate); - return E_NOTIMPL; + PropertyStore *This = impl_from_IPropertyStoreCache(iface); + propstore_value *value; + HRESULT hr; + + TRACE("%p,%p,%d\n", iface, key, pstate); + + EnterCriticalSection(&This->lock); + + hr = PropertyStore_LookupValue(This, key, 0, &value); + + if (SUCCEEDED(hr)) + value->state = pstate; + + LeaveCriticalSection(&This->lock); + + return hr; }
static HRESULT WINAPI PropertyStore_SetValueAndState(IPropertyStoreCache *iface, diff --git a/dlls/propsys/tests/propstore.c b/dlls/propsys/tests/propstore.c index ad06ea0..b6c1e5a 100644 --- a/dlls/propsys/tests/propstore.c +++ b/dlls/propsys/tests/propstore.c @@ -144,7 +144,7 @@ static void test_inmemorystore(void)
/* Set state on an unset field */ hr = IPropertyStoreCache_SetState(propcache, &pkey, PSC_NORMAL); - todo_wine ok(hr == TYPE_E_ELEMENTNOTFOUND, "SetState failed, hr=%x\n", hr); + ok(hr == TYPE_E_ELEMENTNOTFOUND, "SetState failed, hr=%x\n", hr);
/* Manipulate state on already set field */ pkey.fmtid = PKEY_WineTest; @@ -156,12 +156,12 @@ static void test_inmemorystore(void) 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); + ok(hr == S_OK, "SetState failed, hr=%x\n", hr);
state = 0xdeadbeef; hr = IPropertyStoreCache_GetState(propcache, &pkey, &state); ok(hr == S_OK, "GetState failed, hr=%x\n", hr); - todo_wine ok(state == 10, "expected 10, got %d\n", state); + ok(state == 10, "expected 10, got %d\n", state);
propvar.vt = VT_I4; propvar.u.lVal = 12346;