propsys: Implement IPropertyStore::GetAt.

oldstable
Vincent Povirk 2012-05-22 15:34:25 -05:00 committed by Alexandre Julliard
parent 11f24690d5
commit 0ba11e8970
2 changed files with 49 additions and 6 deletions

View File

@ -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,

View File

@ -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;