Commit 8d0f45f7 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Added CreateAsyncBindCtxEx implementation.

parent a5082b25
......@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = urlmon.dll
IMPORTS = urlmon user32 kernel32
IMPORTS = urlmon user32 kernel32 ole32
EXTRALIBS = -luuid
CTESTS = \
......
......@@ -218,13 +218,14 @@ static void test_CreateAsyncBindCtx(void)
return;
}
bindopts.cbStruct = 16;
bindopts.cbStruct = sizeof(bindopts);
hres = IBindCtx_GetBindOptions(bctx, &bindopts);
ok(SUCCEEDED(hres), "IBindCtx_GetBindOptions failed: %08lx\n", hres);
ok(bindopts.grfFlags == BIND_MAYBOTHERUSER,
"bindopts.grfFlags = %08lx, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
ok(bindopts.grfMode = STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
"bindopts.grfMode = %08lx, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n", bindopts.grfMode);
ok(bindopts.grfMode == (STGM_READWRITE | STGM_SHARE_EXCLUSIVE),
"bindopts.grfMode = %08lx, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
bindopts.grfMode);
ok(bindopts.dwTickCountDeadline == 0,
"bindopts.dwTickCountDeadline = %08lx, expected: 0\n", bindopts.dwTickCountDeadline);
......@@ -234,6 +235,64 @@ static void test_CreateAsyncBindCtx(void)
ok(ref == 0, "bsc should be destroyed here\n");
}
static void test_CreateAsyncBindCtxEx(void)
{
IBindCtx *bctx = NULL, *bctx_arg = NULL;
IBindStatusCallback *bsc = statusclb_create();
BIND_OPTS bindopts;
HRESULT hres;
hres = CreateAsyncBindCtxEx(NULL, 0, NULL, NULL, NULL, 0);
ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed: %08lx, expected E_INVALIDARG\n", hres);
hres = CreateAsyncBindCtxEx(NULL, 0, NULL, NULL, &bctx, 0);
ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
if(SUCCEEDED(hres)) {
bindopts.cbStruct = sizeof(bindopts);
hres = IBindCtx_GetBindOptions(bctx, &bindopts);
ok(SUCCEEDED(hres), "IBindCtx_GetBindOptions failed: %08lx\n", hres);
ok(bindopts.grfFlags == BIND_MAYBOTHERUSER,
"bindopts.grfFlags = %08lx, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
ok(bindopts.grfMode == (STGM_READWRITE | STGM_SHARE_EXCLUSIVE),
"bindopts.grfMode = %08lx, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
bindopts.grfMode);
ok(bindopts.dwTickCountDeadline == 0,
"bindopts.dwTickCountDeadline = %08lx, expected: 0\n", bindopts.dwTickCountDeadline);
IBindCtx_Release(bctx);
}
CreateBindCtx(0, &bctx_arg);
hres = CreateAsyncBindCtxEx(NULL, 0, NULL, NULL, &bctx, 0);
ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
if(SUCCEEDED(hres)) {
bindopts.cbStruct = sizeof(bindopts);
hres = IBindCtx_GetBindOptions(bctx, &bindopts);
ok(SUCCEEDED(hres), "IBindCtx_GetBindOptions failed: %08lx\n", hres);
ok(bindopts.grfFlags == BIND_MAYBOTHERUSER,
"bindopts.grfFlags = %08lx, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
ok(bindopts.grfMode == (STGM_READWRITE | STGM_SHARE_EXCLUSIVE),
"bindopts.grfMode = %08lx, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
bindopts.grfMode);
ok(bindopts.dwTickCountDeadline == 0,
"bindopts.dwTickCountDeadline = %08lx, expected: 0\n", bindopts.dwTickCountDeadline);
IBindCtx_Release(bctx);
}
IBindCtx_Release(bctx_arg);
hres = CreateAsyncBindCtxEx(NULL, 0, bsc, NULL, &bctx, 0);
ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
if(SUCCEEDED(hres))
IBindCtx_Release(bctx);
IBindStatusCallback_Release(bsc);
}
static void test_BindToStorage(void)
{
IMoniker *mon;
......@@ -302,5 +361,6 @@ START_TEST(url)
{
test_create();
test_CreateAsyncBindCtx();
test_CreateAsyncBindCtxEx();
test_BindToStorage();
}
......@@ -1179,16 +1179,38 @@ static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszLeft
HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback,
IEnumFORMATETC *format, IBindCtx **pbind)
{
TRACE("(%08lx %p %p %p)\n", reserved, callback, format, pbind);
if(!callback)
return E_INVALIDARG;
return CreateAsyncBindCtxEx(NULL, 0, callback, format, pbind, 0);
}
/***********************************************************************
* CreateAsyncBindCtxEx (URLMON.@)
*
* Create an asynchronous bind context.
*/
HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options,
IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx** pbind,
DWORD reserved)
{
HRESULT hres;
BIND_OPTS bindopts;
IBindCtx *bctx;
TRACE("(%08lx %p %p %p)\n", reserved, callback, format, pbind);
TRACE("(%p %08lx %p %p %p %ld)\n", ibind, options, callback, format, pbind, reserved);
if(!callback)
if(!pbind)
return E_INVALIDARG;
if(options)
FIXME("not supported options %08lx", options);
if(format)
FIXME("format is not supported yet\n");
FIXME("format is not supported\n");
if(reserved)
WARN("reserved=%ld\n", reserved);
hres = CreateBindCtx(0, &bctx);
if(FAILED(hres))
......@@ -1200,31 +1222,13 @@ HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback,
bindopts.dwTickCountDeadline = 0;
IBindCtx_SetBindOptions(bctx, &bindopts);
hres = IBindCtx_RegisterObjectParam(bctx, (LPOLESTR)BSCBHolder, (IUnknown*)callback);
if(FAILED(hres)) {
IBindCtx_Release(bctx);
return hres;
}
if(callback)
RegisterBindStatusCallback(bctx, callback, NULL, 0);
*pbind = bctx;
return S_OK;
}
/***********************************************************************
* CreateAsyncBindCtxEx (URLMON.@)
*
* Create an asynchronous bind context.
*
* FIXME
* Not implemented.
*/
HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options,
IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx** pbind,
DWORD reserved)
{
FIXME("stub, returns failure\n");
return E_INVALIDARG;
}
/***********************************************************************
......
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