Commit b285d562 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Wrap callback in RegisterBindStatusCallback.

parent f185e049
...@@ -714,7 +714,7 @@ static void test_CreateAsyncBindCtx(void) ...@@ -714,7 +714,7 @@ static void test_CreateAsyncBindCtx(void)
SET_EXPECT(QueryInterface_IServiceProvider); SET_EXPECT(QueryInterface_IServiceProvider);
hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx); hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx);
ok(SUCCEEDED(hres), "CreateAsyncBindCtx failed: %08x\n", hres); ok(SUCCEEDED(hres), "CreateAsyncBindCtx failed: %08x\n", hres);
todo_wine CHECK_CALLED(QueryInterface_IServiceProvider); CHECK_CALLED(QueryInterface_IServiceProvider);
bindopts.cbStruct = sizeof(bindopts); bindopts.cbStruct = sizeof(bindopts);
hres = IBindCtx_GetBindOptions(bctx, &bindopts); hres = IBindCtx_GetBindOptions(bctx, &bindopts);
...@@ -788,7 +788,7 @@ static void test_CreateAsyncBindCtxEx(void) ...@@ -788,7 +788,7 @@ static void test_CreateAsyncBindCtxEx(void)
SET_EXPECT(QueryInterface_IServiceProvider); SET_EXPECT(QueryInterface_IServiceProvider);
hres = CreateAsyncBindCtxEx(NULL, 0, &bsc, NULL, &bctx, 0); hres = CreateAsyncBindCtxEx(NULL, 0, &bsc, NULL, &bctx, 0);
ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres); ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
todo_wine CHECK_CALLED(QueryInterface_IServiceProvider); CHECK_CALLED(QueryInterface_IServiceProvider);
hres = IBindCtx_QueryInterface(bctx, &IID_IAsyncBindCtx, (void**)&unk); hres = IBindCtx_QueryInterface(bctx, &IID_IAsyncBindCtx, (void**)&unk);
ok(hres == S_OK, "QueryInterface(IID_IAsyncBindCtx) failed: %08x\n", hres); ok(hres == S_OK, "QueryInterface(IID_IAsyncBindCtx) failed: %08x\n", hres);
...@@ -819,16 +819,16 @@ static void test_BindToStorage(int protocol, BOOL emul) ...@@ -819,16 +819,16 @@ static void test_BindToStorage(int protocol, BOOL emul)
SET_EXPECT(QueryInterface_IServiceProvider); SET_EXPECT(QueryInterface_IServiceProvider);
hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx); hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx);
ok(SUCCEEDED(hres), "CreateAsyncBindCtx failed: %08x\n\n", hres); ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
if(FAILED(hres)) if(FAILED(hres))
return; return;
todo_wine CHECK_CALLED(QueryInterface_IServiceProvider);
SET_EXPECT(QueryInterface_IServiceProvider); SET_EXPECT(QueryInterface_IServiceProvider);
hres = RegisterBindStatusCallback(bctx, &bsc, &previousclb, 0); hres = RegisterBindStatusCallback(bctx, &bsc, &previousclb, 0);
ok(SUCCEEDED(hres), "RegisterBindStatusCallback failed: %08x\n", hres); ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
ok(previousclb == &bsc, "previousclb(%p) != sclb(%p)\n", previousclb, &bsc); ok(previousclb == &bsc, "previousclb(%p) != sclb(%p)\n", previousclb, &bsc);
todo_wine CHECK_CALLED(QueryInterface_IServiceProvider); CHECK_CALLED(QueryInterface_IServiceProvider);
if(previousclb) if(previousclb)
IBindStatusCallback_Release(previousclb); IBindStatusCallback_Release(previousclb);
...@@ -903,7 +903,7 @@ static void test_BindToStorage(int protocol, BOOL emul) ...@@ -903,7 +903,7 @@ static void test_BindToStorage(int protocol, BOOL emul)
DispatchMessage(&msg); DispatchMessage(&msg);
} }
todo_wine CHECK_NOT_CALLED(QueryInterface_IServiceProvider); CHECK_NOT_CALLED(QueryInterface_IServiceProvider);
CHECK_CALLED(GetBindInfo); CHECK_CALLED(GetBindInfo);
CHECK_CALLED(OnStartBinding); CHECK_CALLED(OnStartBinding);
if(emulate_protocol) { if(emulate_protocol) {
......
...@@ -738,7 +738,7 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface, ...@@ -738,7 +738,7 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
sizeof(schema)/sizeof(WCHAR), 0, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0}; sizeof(schema)/sizeof(WCHAR), 0, NULL, 0, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0};
if(pmkToLeft) if(pmkToLeft)
FIXME("Unsupported pmkToLeft\n"); FIXME("Unsupported pmkToLeft\n");
bret = InternetCrackUrlW(This->URLName, 0, ICU_ESCAPE, &url); bret = InternetCrackUrlW(This->URLName, 0, ICU_ESCAPE, &url);
if(!bret) { if(!bret) {
...@@ -1209,85 +1209,6 @@ HRESULT WINAPI BindAsyncMoniker(IMoniker *pmk, DWORD grfOpt, IBindStatusCallback ...@@ -1209,85 +1209,6 @@ HRESULT WINAPI BindAsyncMoniker(IMoniker *pmk, DWORD grfOpt, IBindStatusCallback
} }
/*********************************************************************** /***********************************************************************
* RegisterBindStatusCallback (URLMON.@)
*
* Register a bind status callback.
*
* PARAMS
* pbc [I] Binding context
* pbsc [I] Callback to register
* ppbscPrevious [O] Destination for previous callback
* dwReserved [I] Reserved, must be 0.
*
* RETURNS
* Success: S_OK.
* Failure: E_INVALIDARG, if any argument is invalid, or
* E_OUTOFMEMORY if memory allocation fails.
*/
HRESULT WINAPI RegisterBindStatusCallback(
IBindCtx *pbc,
IBindStatusCallback *pbsc,
IBindStatusCallback **ppbscPrevious,
DWORD dwReserved)
{
IBindStatusCallback *prev;
TRACE("(%p,%p,%p,%u)\n", pbc, pbsc, ppbscPrevious, dwReserved);
if (pbc == NULL || pbsc == NULL)
return E_INVALIDARG;
if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown **)&prev)))
{
IBindCtx_RevokeObjectParam(pbc, BSCBHolder);
if (ppbscPrevious)
*ppbscPrevious = prev;
else
IBindStatusCallback_Release(prev);
}
return IBindCtx_RegisterObjectParam(pbc, BSCBHolder, (IUnknown *)pbsc);
}
/***********************************************************************
* RevokeBindStatusCallback (URLMON.@)
*
* Unregister a bind status callback.
*
* pbc [I] Binding context
* pbsc [I] Callback to unregister
*
* RETURNS
* Success: S_OK.
* Failure: E_INVALIDARG, if any argument is invalid, or
* E_FAIL if pbsc wasn't registered with pbc.
*/
HRESULT WINAPI RevokeBindStatusCallback(
IBindCtx *pbc,
IBindStatusCallback *pbsc)
{
IBindStatusCallback *callback;
HRESULT hr = E_FAIL;
TRACE("(%p,%p)\n", pbc, pbsc);
if (pbc == NULL || pbsc == NULL)
return E_INVALIDARG;
if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown **)&callback)))
{
if (callback == pbsc)
{
IBindCtx_RevokeObjectParam(pbc, BSCBHolder);
hr = S_OK;
}
IBindStatusCallback_Release(pbsc);
}
return hr;
}
/***********************************************************************
* URLDownloadToFileA (URLMON.@) * URLDownloadToFileA (URLMON.@)
* *
* Downloads URL szURL to rile szFileName and call lpfnCB callback to * Downloads URL szURL to rile szFileName and call lpfnCB callback to
......
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