[4/5] propsys: Implement IPropertyStoreCache::SetState.

Vincent Povirk madewokherd at gmail.com
Thu May 24 13:19:43 CDT 2012


-------------- next part --------------
From aa74f07ae552e8ba545c2759db7771abda89b331 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 22 May 2012 15:43:01 -0500
Subject: [PATCH 4/6] propsys: Implement IPropertyStoreCache::SetState.

---
 dlls/propsys/propstore.c       |   18 ++++++++++++++++--
 dlls/propsys/tests/propstore.c |    6 +++---
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c
index 7c28131..c9df65e 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 ad06ea0..b6c1e5a 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;
-- 
1.7.9.5


More information about the wine-patches mailing list