jscript: Implement ScriptTypeInfo_GetIDsOfNames.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
93cc9e557d
commit
a6ac60dcc3
|
@ -802,10 +802,53 @@ static HRESULT WINAPI ScriptTypeInfo_GetIDsOfNames(ITypeInfo *iface, LPOLESTR *r
|
||||||
MEMBERID *pMemId)
|
MEMBERID *pMemId)
|
||||||
{
|
{
|
||||||
ScriptTypeInfo *This = ScriptTypeInfo_from_ITypeInfo(iface);
|
ScriptTypeInfo *This = ScriptTypeInfo_from_ITypeInfo(iface);
|
||||||
|
ITypeInfo *disp_typeinfo;
|
||||||
|
const WCHAR *name;
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
int i, j, arg;
|
||||||
|
|
||||||
FIXME("(%p)->(%p %u %p)\n", This, rgszNames, cNames, pMemId);
|
TRACE("(%p)->(%p %u %p)\n", This, rgszNames, cNames, pMemId);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (!rgszNames || !cNames || !pMemId) return E_INVALIDARG;
|
||||||
|
|
||||||
|
for (i = 0; i < cNames; i++) pMemId[i] = MEMBERID_NIL;
|
||||||
|
name = rgszNames[0];
|
||||||
|
|
||||||
|
for (i = 0; i < This->num_funcs; i++)
|
||||||
|
{
|
||||||
|
struct typeinfo_func *func = &This->funcs[i];
|
||||||
|
|
||||||
|
if (wcsicmp(name, func->prop->name)) continue;
|
||||||
|
pMemId[0] = prop_to_id(This->jsdisp, func->prop);
|
||||||
|
|
||||||
|
for (j = 1; j < cNames; j++)
|
||||||
|
{
|
||||||
|
name = rgszNames[j];
|
||||||
|
for (arg = func->code->param_cnt; --arg >= 0;)
|
||||||
|
if (!wcsicmp(name, func->code->params[arg]))
|
||||||
|
break;
|
||||||
|
if (arg >= 0)
|
||||||
|
pMemId[j] = arg;
|
||||||
|
else
|
||||||
|
hr = DISP_E_UNKNOWNNAME;
|
||||||
|
}
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < This->num_vars; i++)
|
||||||
|
{
|
||||||
|
dispex_prop_t *var = This->vars[i];
|
||||||
|
|
||||||
|
if (wcsicmp(name, var->name)) continue;
|
||||||
|
pMemId[0] = prop_to_id(This->jsdisp, var);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look into the inherited IDispatch */
|
||||||
|
hr = get_dispatch_typeinfo(&disp_typeinfo);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return ITypeInfo_GetIDsOfNames(disp_typeinfo, rgszNames, cNames, pMemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI ScriptTypeInfo_Invoke(ITypeInfo *iface, PVOID pvInstance, MEMBERID memid, WORD wFlags,
|
static HRESULT WINAPI ScriptTypeInfo_Invoke(ITypeInfo *iface, PVOID pvInstance, MEMBERID memid, WORD wFlags,
|
||||||
|
|
|
@ -87,6 +87,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
|
||||||
typedef struct jsdisp_t jsdisp_t;
|
typedef struct jsdisp_t jsdisp_t;
|
||||||
|
|
||||||
extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN;
|
extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN;
|
||||||
|
HRESULT get_dispatch_typeinfo(ITypeInfo**) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
#define PROPF_ARGMASK 0x00ff
|
#define PROPF_ARGMASK 0x00ff
|
||||||
#define PROPF_METHOD 0x0100
|
#define PROPF_METHOD 0x0100
|
||||||
|
|
|
@ -37,6 +37,30 @@ LONG module_ref = 0;
|
||||||
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
||||||
|
|
||||||
HINSTANCE jscript_hinstance;
|
HINSTANCE jscript_hinstance;
|
||||||
|
static ITypeInfo *dispatch_typeinfo;
|
||||||
|
|
||||||
|
HRESULT get_dispatch_typeinfo(ITypeInfo **out)
|
||||||
|
{
|
||||||
|
ITypeInfo *typeinfo;
|
||||||
|
ITypeLib *typelib;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
if (!dispatch_typeinfo)
|
||||||
|
{
|
||||||
|
hr = LoadRegTypeLib(&IID_StdOle, STDOLE_MAJORVERNUM, STDOLE_MINORVERNUM, STDOLE_LCID, &typelib);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IDispatch, &typeinfo);
|
||||||
|
ITypeLib_Release(typelib);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
if (InterlockedCompareExchangePointer((void**)&dispatch_typeinfo, typeinfo, NULL))
|
||||||
|
ITypeInfo_Release(typeinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
*out = dispatch_typeinfo;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
|
@ -145,6 +169,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
if (lpv) break;
|
if (lpv) break;
|
||||||
|
if (dispatch_typeinfo) ITypeInfo_Release(dispatch_typeinfo);
|
||||||
free_strings();
|
free_strings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue