Commit 1a129283 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Get rid of no longer needed ITypeInfo in BuiltinDisp.

parent 4a30e699
......@@ -268,8 +268,7 @@ static const IDispatchVtbl BuiltinDispVtbl = {
Builtin_Invoke
};
static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt,
ITypeInfo *typeinfo, BuiltinDisp **ret)
static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *members, size_t member_cnt, BuiltinDisp **ret)
{
BuiltinDisp *disp;
......@@ -281,7 +280,6 @@ static HRESULT create_builtin_dispatch(script_ctx_t *ctx, const builtin_prop_t *
disp->members = members;
disp->member_cnt = member_cnt;
disp->ctx = ctx;
disp->typeinfo = typeinfo;
*ret = disp;
return S_OK;
......@@ -2858,14 +2856,9 @@ void detach_global_objects(script_ctx_t *ctx)
HRESULT init_global(script_ctx_t *ctx)
{
ITypeInfo *typeinfo;
HRESULT hres;
hres = get_typeinfo(GlobalObj_tid, &typeinfo);
if(FAILED(hres))
return hres;
hres = create_builtin_dispatch(ctx, global_props, ARRAY_SIZE(global_props), typeinfo, &ctx->global_obj);
hres = create_builtin_dispatch(ctx, global_props, ARRAY_SIZE(global_props), &ctx->global_obj);
if(FAILED(hres))
return hres;
......@@ -2873,9 +2866,5 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
hres = get_typeinfo(ErrObj_tid, &typeinfo);
if(FAILED(hres))
return hres;
return create_builtin_dispatch(ctx, err_props, ARRAY_SIZE(err_props), typeinfo, &ctx->err_obj);
return create_builtin_dispatch(ctx, err_props, ARRAY_SIZE(err_props), &ctx->err_obj);
}
......@@ -141,7 +141,6 @@ typedef struct {
size_t member_cnt;
const builtin_prop_t *members;
script_ctx_t *ctx;
ITypeInfo *typeinfo;
} BuiltinDisp;
HRESULT create_vbdisp(const class_desc_t*,vbdisp_t**) DECLSPEC_HIDDEN;
......@@ -358,18 +357,6 @@ HRESULT report_script_error(script_ctx_t*) DECLSPEC_HIDDEN;
void detach_global_objects(script_ctx_t*) DECLSPEC_HIDDEN;
HRESULT get_builtin_id(BuiltinDisp*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
#define TID_LIST \
XDIID(ErrObj) \
XDIID(GlobalObj)
typedef enum {
#define XDIID(iface) iface ## _tid,
TID_LIST
#undef XDIID
LAST_tid
} tid_t;
HRESULT get_typeinfo(tid_t,ITypeInfo**) DECLSPEC_HIDDEN;
void release_regexp_typelib(void) DECLSPEC_HIDDEN;
static inline BOOL is_int32(double d)
......
......@@ -35,66 +35,6 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static HINSTANCE vbscript_hinstance;
static ITypeLib *typelib;
static ITypeInfo *typeinfos[LAST_tid];
static REFIID tid_ids[] = {
#define XDIID(iface) &DIID_ ## iface,
TID_LIST
#undef XDIID
};
HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
{
HRESULT hres;
if (!typelib) {
ITypeLib *tl;
static const WCHAR vbscript_dll1W[] = {'v','b','s','c','r','i','p','t','.','d','l','l','\\','1',0};
hres = LoadTypeLib(vbscript_dll1W, &tl);
if(FAILED(hres)) {
ERR("LoadRegTypeLib failed: %08x\n", hres);
return hres;
}
if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
ITypeLib_Release(tl);
}
if(!typeinfos[tid]) {
ITypeInfo *ti;
hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti);
if(FAILED(hres)) {
ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids[tid]), hres);
return hres;
}
if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL))
ITypeInfo_Release(ti);
}
*typeinfo = typeinfos[tid];
return S_OK;
}
static void release_typelib(void)
{
unsigned i;
if(!typelib)
return;
for(i = 0; i < ARRAY_SIZE(typeinfos); i++) {
if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
}
ITypeLib_Release(typelib);
}
BSTR get_vbscript_string(int id)
{
WCHAR buf[512];
......@@ -316,7 +256,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
break;
case DLL_PROCESS_DETACH:
if (lpv) break;
release_typelib();
release_regexp_typelib();
}
......
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