[1/5] propsys: Implement IPropertyStore::GetAt.
Vincent Povirk
madewokherd at gmail.com
Thu May 24 13:16:49 CDT 2012
-------------- next part --------------
From 6848d5e3211d73d929983765f4b84d36a9cd414b Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 22 May 2012 15:34:25 -0500
Subject: [PATCH 1/6] propsys: Implement IPropertyStore::GetAt.
---
dlls/propsys/propstore.c | 47 ++++++++++++++++++++++++++++++++++++++--
dlls/propsys/tests/propstore.c | 8 +++----
2 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/dlls/propsys/propstore.c b/dlls/propsys/propstore.c
index b89eb76..a57bb2e 100644
--- a/dlls/propsys/propstore.c
+++ b/dlls/propsys/propstore.c
@@ -156,8 +156,51 @@ static HRESULT WINAPI PropertyStore_GetCount(IPropertyStoreCache *iface,
static HRESULT WINAPI PropertyStore_GetAt(IPropertyStoreCache *iface,
DWORD iProp, PROPERTYKEY *pkey)
{
- FIXME("%p,%d,%p: stub\n", iface, iProp, pkey);
- return E_NOTIMPL;
+ PropertyStore *This = impl_from_IPropertyStoreCache(iface);
+ propstore_format *format=NULL, *format_candidate;
+ propstore_value *value;
+ HRESULT hr;
+
+ TRACE("%p,%d,%p\n", iface, iProp, pkey);
+
+ if (!pkey)
+ return E_POINTER;
+
+ EnterCriticalSection(&This->lock);
+
+ LIST_FOR_EACH_ENTRY(format_candidate, &This->formats, propstore_format, entry)
+ {
+ if (format_candidate->count > iProp)
+ {
+ format = format_candidate;
+ pkey->fmtid = format->fmtid;
+ break;
+ }
+
+ iProp -= format_candidate->count;
+ }
+
+ if (format)
+ {
+ LIST_FOR_EACH_ENTRY(value, &format->values, propstore_value, entry)
+ {
+ if (iProp == 0)
+ {
+ pkey->pid = value->pid;
+ break;
+ }
+
+ iProp--;
+ }
+
+ hr = S_OK;
+ }
+ else
+ hr = E_INVALIDARG;
+
+ LeaveCriticalSection(&This->lock);
+
+ return hr;
}
static HRESULT PropertyStore_LookupValue(PropertyStore *This, REFPROPERTYKEY key,
diff --git a/dlls/propsys/tests/propstore.c b/dlls/propsys/tests/propstore.c
index 6ca67e9..7915b96 100644
--- a/dlls/propsys/tests/propstore.c
+++ b/dlls/propsys/tests/propstore.c
@@ -68,7 +68,7 @@ static void test_inmemorystore(void)
ok(hr == S_OK, "Commit failed, hr=%x\n", hr);
hr = IPropertyStoreCache_GetAt(propcache, 0, &pkey);
- todo_wine ok(hr == E_INVALIDARG, "GetAt failed, hr=%x\n", hr);
+ ok(hr == E_INVALIDARG, "GetAt failed, hr=%x\n", hr);
pkey.fmtid = PKEY_WineTest;
pkey.pid = 4;
@@ -97,9 +97,9 @@ static void test_inmemorystore(void)
memset(&pkey, 0, sizeof(pkey));
hr = IPropertyStoreCache_GetAt(propcache, 0, &pkey);
- todo_wine ok(hr == S_OK, "GetAt failed, hr=%x\n", hr);
- todo_wine ok(IsEqualGUID(&pkey.fmtid, &PKEY_WineTest), "got wrong pkey\n");
- todo_wine ok(pkey.pid == 4, "got pid of %i, expected 4\n", pkey.pid);
+ ok(hr == S_OK, "GetAt failed, hr=%x\n", hr);
+ ok(IsEqualGUID(&pkey.fmtid, &PKEY_WineTest), "got wrong pkey\n");
+ ok(pkey.pid == 4, "got pid of %i, expected 4\n", pkey.pid);
pkey.fmtid = PKEY_WineTest;
pkey.pid = 4;
--
1.7.9.5
More information about the wine-patches
mailing list