Jacek Caban : jscript: Properly handle aggregation attempt.

Alexandre Julliard julliard at winehq.org
Mon Jul 18 12:47:01 CDT 2011


Module: wine
Branch: master
Commit: 5b16e6e0fdb35e57a034fd5e6df61765ad11fa71
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5b16e6e0fdb35e57a034fd5e6df61765ad11fa71

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jul 18 18:05:13 2011 +0200

jscript: Properly handle aggregation attempt.

---

 dlls/jscript/jscript.c       |    5 +++++
 dlls/jscript/tests/jscript.c |   13 +++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c
index 641c192..fb7fd8c 100644
--- a/dlls/jscript/jscript.c
+++ b/dlls/jscript/jscript.c
@@ -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));
diff --git a/dlls/jscript/tests/jscript.c b/dlls/jscript/tests/jscript.c
index 6d48799..67067b9 100644
--- a/dlls/jscript/tests/jscript.c
+++ b/dlls/jscript/tests/jscript.c
@@ -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");
     }




More information about the wine-cvs mailing list