diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c index 7c2813186c..c9df65e514 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 ad06ea006e..b6c1e5aaa0 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;