propsys: Implement IPropertyStoreCache::GetState.

oldstable
Vincent Povirk 2012-05-22 15:38:22 -05:00 committed by Alexandre Julliard
parent 0ba11e8970
commit a28183f390
2 changed files with 24 additions and 7 deletions

View File

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

View File

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