devenum: Do not fail with a IBindCtx (with tests).

This commit is contained in:
Detlef Riekenberg 2012-06-16 19:36:24 +02:00 committed by Alexandre Julliard
parent 8c5cf7e25f
commit a8f4364388
2 changed files with 33 additions and 15 deletions

View file

@ -465,9 +465,19 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToStorage(IMoniker *iface, IB
*ppvObj = NULL;
if (pbc || pmkToLeft)
if (pmkToLeft)
return MK_E_NOSTORAGE;
if (pbc != NULL)
{
static DWORD reported;
if (!reported)
{
FIXME("ignoring IBindCtx %p\n", pbc);
reported++;
}
}
if (IsEqualGUID(riid, &IID_IPropertyBag))
{
HANDLE hkey;

View file

@ -47,27 +47,23 @@ static struct category am_categories[] =
{ "Video compressor category", &CLSID_VideoCompressorCategory }
};
static void test_devenum(void)
static void test_devenum(IBindCtx *bind_ctx)
{
HRESULT res;
ICreateDevEnum* create_devenum;
IEnumMoniker* enum_moniker = NULL;
int i;
CoInitialize(NULL);
res = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
&IID_ICreateDevEnum, (LPVOID*)&create_devenum);
if (res != S_OK) {
skip("Cannot create SystemDeviceEnum object (%x)\n", res);
CoUninitialize();
return;
}
trace("\n");
for (i = 0; i < (sizeof(am_categories) / sizeof(struct category)); i++)
{
if (winetest_debug > 1)
trace("%s:\n", am_categories[i].name);
res = ICreateDevEnum_CreateClassEnumerator(create_devenum, am_categories[i].clsid, &enum_moniker, 0);
@ -82,7 +78,7 @@ static void test_devenum(void)
HRESULT hr;
VariantInit(&var);
hr = IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&prop_bag);
hr = IMoniker_BindToStorage(moniker, bind_ctx, NULL, &IID_IPropertyBag, (LPVOID*)&prop_bag);
ok(hr == S_OK, "IMoniker_BindToStorage failed with error %x\n", hr);
if (SUCCEEDED(hr))
@ -92,6 +88,7 @@ static void test_devenum(void)
if (SUCCEEDED(hr))
{
if (winetest_debug > 1)
trace(" %s\n", wine_dbgstr_w(V_UNION(&var, bstrVal)));
VariantClear(&var);
}
@ -107,18 +104,29 @@ static void test_devenum(void)
}
IEnumMoniker_Release(enum_moniker);
}
trace("\n");
}
ICreateDevEnum_Release(create_devenum);
CoUninitialize();
}
/* CLSID_CDeviceMoniker */
START_TEST(devenum)
{
test_devenum();
IBindCtx *bind_ctx = NULL;
HRESULT hr;
CoInitialize(NULL);
test_devenum(NULL);
/* IBindCtx is allowed in IMoniker_BindToStorage (IMediaCatMoniker_BindToStorage) */
hr = CreateBindCtx(0, &bind_ctx);
ok(hr == S_OK, "Cannot create BindCtx: (res = 0x%x)\n", hr);
if (bind_ctx) {
test_devenum(bind_ctx);
IBindCtx_Release(bind_ctx);
}
CoUninitialize();
}