[PATCH v3 2/8] mshtml: Always call builtin functions using invoke_builtin_function.

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Dec 7 13:10:03 CST 2021


And move typeinfo_invoke as a fallback into it if we have no call_vtbl_off.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

It's made non-static because it will be used in next patch, and this avoids
a pointless temporary forward-declaration.

 dlls/mshtml/dispex.c         | 17 +++++++++--------
 dlls/mshtml/mshtml_private.h |  2 ++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index b7bc751..3ab8202 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -49,7 +49,7 @@ typedef struct {
     VARIANT default_value;
 } func_arg_info_t;
 
-typedef struct {
+struct func_info_t {
     DISPID id;
     BSTR name;
     tid_t tid;
@@ -63,7 +63,7 @@ typedef struct {
     VARTYPE prop_vt;
     VARTYPE *arg_types;
     func_arg_info_t *arg_info;
-} func_info_t;
+};
 
 struct dispex_data_t {
     dispex_static_data_t *desc;
@@ -842,7 +842,7 @@ static HRESULT function_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR
     case DISPATCH_METHOD:
         if(!This->obj)
             return E_UNEXPECTED;
-        hres = typeinfo_invoke(This->obj, This->info, flags, params, res, ei);
+        hres = invoke_builtin_function(This->obj, This->info, flags, params, res, ei, caller);
         break;
     case DISPATCH_PROPERTYGET: {
         unsigned name_len;
@@ -1168,13 +1168,17 @@ static HRESULT builtin_propput(DispatchEx *This, func_info_t *func, DISPPARAMS *
     return hres;
 }
 
-static HRESULT invoke_builtin_function(DispatchEx *This, func_info_t *func, DISPPARAMS *dp, VARIANT *res, IServiceProvider *caller)
+HRESULT invoke_builtin_function(DispatchEx *This, func_info_t *func, WORD flags, DISPPARAMS *dp, VARIANT *res,
+        EXCEPINFO *ei, IServiceProvider *caller)
 {
     VARIANT arg_buf[MAX_ARGS], *arg_ptrs[MAX_ARGS], *arg, retv, ret_ref, vhres;
     unsigned i, nconv = 0;
     IUnknown *iface;
     HRESULT hres;
 
+    if(!func->call_vtbl_off)
+        return typeinfo_invoke(This, func, flags, dp, res, ei);
+
     if(dp->cArgs + func->default_value_cnt < func->argc) {
         FIXME("Invalid argument count (expected %u, got %u)\n", func->argc, dp->cArgs);
         return E_INVALIDARG;
@@ -1296,10 +1300,7 @@ static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags,
             }
         }
 
-        if(func->call_vtbl_off)
-            hres = invoke_builtin_function(This, func, dp, res, caller);
-        else
-            hres = typeinfo_invoke(This, func, flags, dp, res, ei);
+        hres = invoke_builtin_function(This, func, flags, dp, res, ei, caller);
         break;
     case DISPATCH_PROPERTYGET: {
         func_obj_entry_t *entry;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 6978ed7..03ccc7e 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -312,6 +312,7 @@ extern const compat_mode_info_t compat_mode_info[COMPAT_MODE_CNT] DECLSPEC_HIDDE
 
 typedef struct dispex_data_t dispex_data_t;
 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
+typedef struct func_info_t func_info_t;
 
 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
@@ -387,6 +388,7 @@ BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
 HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*) DECLSPEC_HIDDEN;
 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
+HRESULT invoke_builtin_function(DispatchEx*,func_info_t*,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*) DECLSPEC_HIDDEN;
 HRESULT remove_attribute(DispatchEx*,DISPID,VARIANT_BOOL*) DECLSPEC_HIDDEN;
 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
 void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
-- 
2.31.1




More information about the wine-devel mailing list