propsys: Implement IPropertyStoreCache::SetState.

oldstable
Vincent Povirk 2012-05-22 15:43:01 -05:00 committed by Alexandre Julliard
parent c3748c7daa
commit f833061e50
2 changed files with 19 additions and 5 deletions

View File

@ -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,

View File

@ -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;