[5/5] propsys: Implement IPropertyStore::GetCount.
Vincent Povirk
madewokherd at gmail.com
Tue May 22 15:53:29 CDT 2012
-------------- next part --------------
From cac31e9d0c4d59e5f45d718b0f1a7d36590c4f1b Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 22 May 2012 15:24:03 -0500
Subject: [PATCH 05/10] propsys: Implement IPropertyStore::GetCount.
---
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 0e94219..9a4906a 100644
--- a/dlls/propsys/propstore.c
+++ b/dlls/propsys/propstore.c
@@ -133,8 +133,24 @@ static ULONG WINAPI PropertyStore_Release(IPropertyStoreCache *iface)
static HRESULT WINAPI PropertyStore_GetCount(IPropertyStoreCache *iface,
DWORD *cProps)
{
- FIXME("%p,%p: stub\n", iface, cProps);
- return E_NOTIMPL;
+ PropertyStore *This = impl_from_IPropertyStoreCache(iface);
+ propstore_format *format;
+
+ TRACE("%p,%p\n", iface, cProps);
+
+ if (!cProps)
+ return E_POINTER;
+
+ *cProps = 0;
+
+ EnterCriticalSection(&This->lock);
+
+ LIST_FOR_EACH_ENTRY(format, &This->formats, propstore_format, entry)
+ *cProps += format->count;
+
+ LeaveCriticalSection(&This->lock);
+
+ return S_OK;
}
static HRESULT WINAPI PropertyStore_GetAt(IPropertyStoreCache *iface,
@@ -201,6 +217,7 @@ static HRESULT PropertyStore_LookupValue(PropertyStore *This, REFPROPERTYKEY key
value->pid = key->pid;
list_add_tail(&format->values, &value->entry);
+ format->count++;
}
*result = value;
diff --git a/dlls/propsys/tests/propstore.c b/dlls/propsys/tests/propstore.c
index c24cb35..6ca67e9 100644
--- a/dlls/propsys/tests/propstore.c
+++ b/dlls/propsys/tests/propstore.c
@@ -55,11 +55,11 @@ static void test_inmemorystore(void)
}
hr = IPropertyStoreCache_GetCount(propcache, NULL);
- todo_wine ok(hr == E_POINTER, "GetCount failed, hr=%x\n", hr);
+ ok(hr == E_POINTER, "GetCount failed, hr=%x\n", hr);
hr = IPropertyStoreCache_GetCount(propcache, &count);
- todo_wine ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
- todo_wine ok(count == 0, "GetCount returned %i, expected 0\n", count);
+ ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
+ ok(count == 0, "GetCount returned %i, expected 0\n", count);
hr = IPropertyStoreCache_Commit(propcache);
ok(hr == S_OK, "Commit failed, hr=%x\n", hr);
@@ -91,8 +91,8 @@ static void test_inmemorystore(void)
ok(hr == S_OK, "SetValue failed, hr=%x\n", hr);
hr = IPropertyStoreCache_GetCount(propcache, &count);
- todo_wine ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
- todo_wine ok(count == 1, "GetCount returned %i, expected 0\n", count);
+ ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
+ ok(count == 1, "GetCount returned %i, expected 0\n", count);
memset(&pkey, 0, sizeof(pkey));
--
1.7.9.5
More information about the wine-patches
mailing list