Jacek Caban : jscript: Added Object constructor implementation.

Alexandre Julliard julliard at winehq.org
Thu Sep 11 08:00:52 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Sep 10 21:08:09 2008 +0200

jscript: Added Object constructor implementation.

---

 dlls/jscript/jscript.h |    1 +
 dlls/jscript/object.c  |   44 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index f2490cb..5f15695 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -113,6 +113,7 @@ HRESULT jsdisp_propput_idx(DispatchEx*,DWORD,LCID,VARIANT*,jsexcept_t*,IServiceP
 
 HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,DWORD,DispatchEx*,DispatchEx**);
 
+HRESULT create_object(script_ctx_t*,DispatchEx*,DispatchEx**);
 HRESULT create_math(script_ctx_t*,DispatchEx**);
 
 HRESULT to_boolean(VARIANT*,VARIANT_BOOL*);
diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c
index 2cca6e9..2f021f7 100644
--- a/dlls/jscript/object.c
+++ b/dlls/jscript/object.c
@@ -105,8 +105,29 @@ static const builtin_info_t Object_info = {
 static HRESULT ObjectConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
         VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    HRESULT hres;
+
+    TRACE("\n");
+
+    switch(flags) {
+    case DISPATCH_CONSTRUCT: {
+        DispatchEx *obj;
+
+        hres = create_object(dispex->ctx, NULL, &obj);
+        if(FAILED(hres))
+            return hres;
+
+        V_VT(retv) = VT_DISPATCH;
+        V_DISPATCH(retv) = (IDispatch*)_IDispatchEx_(obj);
+        break;
+    }
+
+    default:
+        FIXME("unimplemented flags: %x\n", flags);
+        return E_NOTIMPL;
+    }
+
+    return S_OK;
 }
 
 HRESULT create_object_constr(script_ctx_t *ctx, DispatchEx **ret)
@@ -123,3 +144,22 @@ HRESULT create_object_constr(script_ctx_t *ctx, DispatchEx **ret)
     jsdisp_release(object);
     return hres;
 }
+
+HRESULT create_object(script_ctx_t *ctx, DispatchEx *constr, DispatchEx **ret)
+{
+    DispatchEx *object;
+    HRESULT hres;
+
+    object = heap_alloc_zero(sizeof(DispatchEx));
+    if(!object)
+        return E_OUTOFMEMORY;
+
+    hres = init_dispex_from_constr(object, ctx, &Object_info, constr ? constr : ctx->object_constr);
+    if(FAILED(hres)) {
+        heap_free(object);
+        return hres;
+    }
+
+    *ret = object;
+    return S_OK;
+}




More information about the wine-cvs mailing list