From 785e98173f918a5f9d3b1f803d0f134b13d1942b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 30 Dec 2007 17:42:03 +0100 Subject: [PATCH] urlmon: Added ibind argument handling in CreateAsyncBindCtx. --- dlls/urlmon/bindctx.c | 17 +++++++++++------ dlls/urlmon/tests/url.c | 23 ++++++++++++++++++++--- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/dlls/urlmon/bindctx.c b/dlls/urlmon/bindctx.c index 83c8c39b749..328254c3bb6 100644 --- a/dlls/urlmon/bindctx.c +++ b/dlls/urlmon/bindctx.c @@ -705,13 +705,13 @@ static HRESULT WINAPI AsyncBindCtx_GetObjectParam(IBindCtx* iface, LPOLESTR pszk return IBindCtx_GetObjectParam(This->bindctx, pszkey, punk); } -static HRESULT WINAPI AsyncBindCtx_RevokeObjectParam(IBindCtx *iface, LPOLESTR ppenum) +static HRESULT WINAPI AsyncBindCtx_RevokeObjectParam(IBindCtx *iface, LPOLESTR pszkey) { AsyncBindCtx *This = BINDCTX_THIS(iface); - TRACE("(%p)->(%p)\n", This, ppenum); + TRACE("(%p)->(%s)\n", This, debugstr_w(pszkey)); - return IBindCtx_RevokeObjectParam(This->bindctx, ppenum); + return IBindCtx_RevokeObjectParam(This->bindctx, pszkey); } static HRESULT WINAPI AsyncBindCtx_EnumObjectParam(IBindCtx *iface, IEnumString **pszkey) @@ -820,9 +820,14 @@ HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options, if(reserved) WARN("reserved=%d\n", reserved); - hres = CreateBindCtx(0, &bindctx); - if(FAILED(hres)) - return hres; + if(ibind) { + IBindCtx_AddRef(ibind); + bindctx = ibind; + }else { + hres = CreateBindCtx(0, &bindctx); + if(FAILED(hres)) + return hres; + } ret = heap_alloc(sizeof(AsyncBindCtx)); diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index 9be2de72e13..0dd9c81360a 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -1191,11 +1191,13 @@ static void test_CreateAsyncBindCtx(void) static void test_CreateAsyncBindCtxEx(void) { - IBindCtx *bctx = NULL, *bctx_arg = NULL; + IBindCtx *bctx = NULL, *bctx2 = NULL, *bctx_arg = NULL; IUnknown *unk; BIND_OPTS bindopts; HRESULT hres; + static WCHAR testW[] = {'t','e','s','t',0}; + hres = CreateAsyncBindCtxEx(NULL, 0, NULL, NULL, NULL, 0); ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed: %08x, expected E_INVALIDARG\n", hres); @@ -1248,8 +1250,23 @@ static void test_CreateAsyncBindCtxEx(void) if(SUCCEEDED(hres)) IUnknown_Release(unk); - if(SUCCEEDED(hres)) - IBindCtx_Release(bctx); + IBindCtx_Release(bctx); + + hres = CreateBindCtx(0, &bctx2); + ok(hres == S_OK, "CreateBindCtx failed: %08x\n", hres); + + hres = CreateAsyncBindCtxEx(bctx2, 0, NULL, NULL, &bctx, 0); + ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres); + + hres = IBindCtx_RegisterObjectParam(bctx2, testW, (IUnknown*)&Protocol); + ok(hres == S_OK, "RegisterObjectParam failed: %08x\n", hres); + + hres = IBindCtx_GetObjectParam(bctx, testW, &unk); + ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres); + ok(unk == (IUnknown*)&Protocol, "unexpected unk %p\n", unk); + + IBindCtx_Release(bctx); + IBindCtx_Release(bctx2); } static void test_bscholder(IBindStatusCallback *holder) -- 2.11.4.GIT