jscript: Properly handle aggregation attempt.

This commit is contained in:
Jacek Caban 2011-07-18 18:05:13 +02:00 committed by Alexandre Julliard
parent cf30b6aea3
commit 5b16e6e0fd
2 changed files with 18 additions and 0 deletions

View File

@ -963,6 +963,11 @@ HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUn
TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
if(pUnkOuter) {
*ppv = NULL;
return CLASS_E_NOAGGREGATION;
}
lock_module();
ret = heap_alloc_zero(sizeof(*ret));

View File

@ -605,6 +605,18 @@ static void test_jscript_uninitializing(void)
ok(!ref, "ref = %d\n", ref);
}
static void test_aggregation(void)
{
IUnknown *unk = (IUnknown*)0xdeadbeef;
HRESULT hres;
hres = CoCreateInstance(&CLSID_JScript, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IUnknown, (void**)&unk);
ok(hres == CLASS_E_NOAGGREGATION || broken(E_INVALIDARG) /* win2k */,
"CoCreateInstance failed: %08x, expected CLASS_E_NOAGGREGATION\n", hres);
ok(!unk, "unk = %p\n", unk);
}
static BOOL check_jscript(void)
{
IActiveScriptProperty *script_prop;
@ -626,6 +638,7 @@ START_TEST(jscript)
test_jscript();
test_jscript2();
test_jscript_uninitializing();
test_aggregation();
}else {
win_skip("Broken engine, probably too old\n");
}