[2/5] propsys: Implement IPropertyStoreCache::GetState.

Vincent Povirk madewokherd at gmail.com
Thu May 24 13:17:52 CDT 2012


-------------- next part --------------
From 14316cfd3817a2a9668dc213ee663b84aabd845c Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 22 May 2012 15:38:22 -0500
Subject: [PATCH 2/6] propsys: Implement IPropertyStoreCache::GetState.

---
 dlls/propsys/propstore.c       |   21 +++++++++++++++++++--
 dlls/propsys/tests/propstore.c |   10 +++++-----
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c
index a57bb2e..00ff701 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 7915b96..17cf7f3 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;
-- 
1.7.9.5


More information about the wine-patches mailing list