Commit 0ba11e89 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

propsys: Implement IPropertyStore::GetAt.

parent 11f24690
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment