Detlef Riekenberg : devenum: Do not fail with a IBindCtx (with tests).
Alexandre Julliard
julliard at winehq.org
Tue Jun 19 15:36:27 CDT 2012
Module: wine
Branch: master
Commit: a8f4364388a841b4debd5fc25e340f21dadd3623
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a8f4364388a841b4debd5fc25e340f21dadd3623
Author: Detlef Riekenberg <wine.dev at web.de>
Date: Sat Jun 16 19:36:24 2012 +0200
devenum: Do not fail with a IBindCtx (with tests).
---
dlls/devenum/mediacatenum.c | 12 +++++++++++-
dlls/devenum/tests/devenum.c | 36 ++++++++++++++++++++++--------------
2 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c
index f167feb..24d236d 100644
--- a/dlls/devenum/mediacatenum.c
+++ b/dlls/devenum/mediacatenum.c
@@ -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;
diff --git a/dlls/devenum/tests/devenum.c b/dlls/devenum/tests/devenum.c
index d8cd92f..c7f765b 100644
--- a/dlls/devenum/tests/devenum.c
+++ b/dlls/devenum/tests/devenum.c
@@ -47,28 +47,24 @@ 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++)
{
- trace("%s:\n", am_categories[i].name);
+ if (winetest_debug > 1)
+ trace("%s:\n", am_categories[i].name);
res = ICreateDevEnum_CreateClassEnumerator(create_devenum, am_categories[i].clsid, &enum_moniker, 0);
ok(SUCCEEDED(res), "Cannot create enum moniker (res = %x)\n", res);
@@ -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,7 +88,8 @@ static void test_devenum(void)
if (SUCCEEDED(hr))
{
- trace(" %s\n", wine_dbgstr_w(V_UNION(&var, bstrVal)));
+ if (winetest_debug > 1)
+ trace(" %s\n", wine_dbgstr_w(V_UNION(&var, bstrVal)));
VariantClear(&var);
}
else
@@ -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();
}
More information about the wine-cvs
mailing list