diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c index a57bb2ee9e..00ff70162d 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 7915b96614..17cf7f3ba9 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;