explorer: Added IDispatch support for ShellBrowserWindow instance.

This commit is contained in:
Nikolay Sivov 2015-04-30 09:13:27 +03:00 committed by Alexandre Julliard
parent 514345b401
commit 58775c878a
3 changed files with 101 additions and 19 deletions

View File

@ -524,21 +524,19 @@ todo_wine {
/* IDispatch-related tests */
count = 10;
hr = IDispatch_GetTypeInfoCount(disp, &count);
todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(count == 1, "got %u\n", count);
}
hr = IDispatch_GetTypeInfo(disp, 0, LOCALE_SYSTEM_DEFAULT, &typeinfo);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
if (hr == S_OK) {
hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(IsEqualGUID(&typeattr->guid, &IID_IWebBrowser2), "type guid %s\n", wine_dbgstr_guid(&typeattr->guid));
ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
ITypeInfo_Release(typeinfo);
}
/* IWebBrowser2 */
hr = IDispatch_QueryInterface(disp, &IID_IWebBrowser2, (void**)&wb);
ok(hr == S_OK, "got 0x%08x\n", hr);

View File

@ -1,7 +1,7 @@
MODULE = explorer.exe
APPMODE = -mwindows -municode
IMPORTS = rpcrt4 user32 gdi32 advapi32
DELAYIMPORTS = comctl32 shell32 ole32 shlwapi
DELAYIMPORTS = comctl32 shell32 oleaut32 ole32 shlwapi
C_SRCS = \
appbar.c \

View File

@ -65,6 +65,66 @@ static int desktop_width, launcher_size, launchers_per_row;
static struct launcher **launchers;
static unsigned int nb_launchers, nb_allocated;
static REFIID tid_ids[] =
{
&IID_NULL,
&IID_IWebBrowser2
};
typedef enum
{
NULL_tid,
IWebBrowser2_tid,
LAST_tid
} tid_t;
static ITypeLib *typelib;
static ITypeInfo *typeinfos[LAST_tid];
static HRESULT load_typelib(void)
{
HRESULT hres;
ITypeLib *tl;
hres = LoadRegTypeLib(&LIBID_SHDocVw, 1, 0, LOCALE_SYSTEM_DEFAULT, &tl);
if (FAILED(hres))
{
ERR("LoadRegTypeLib failed: %08x\n", hres);
return hres;
}
if (InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
ITypeLib_Release(tl);
return hres;
}
static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
{
HRESULT hres;
if (!typelib)
hres = load_typelib();
if (!typelib)
return hres;
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];
ITypeInfo_AddRef(*typeinfo);
return S_OK;
}
struct shellwindows
{
IShellWindows IShellWindows_iface;
@ -1246,19 +1306,17 @@ static ULONG WINAPI webbrowser_Release(IWebBrowser2 *iface)
static HRESULT WINAPI webbrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
{
struct shellbrowserwindow *This = impl_from_IWebBrowser2(iface);
FIXME("(%p)->(%p): stub\n", This, pctinfo);
*pctinfo = 0;
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, pctinfo);
*pctinfo = 1;
return S_OK;
}
static HRESULT WINAPI webbrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
LPTYPEINFO *ppTInfo)
{
struct shellbrowserwindow *This = impl_from_IWebBrowser2(iface);
FIXME("(%p)->(%d %d %p): stub\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
TRACE("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
return get_typeinfo(IWebBrowser2_tid, ppTInfo);
}
static HRESULT WINAPI webbrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
@ -1266,20 +1324,46 @@ static HRESULT WINAPI webbrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
LCID lcid, DISPID *rgDispId)
{
struct shellbrowserwindow *This = impl_from_IWebBrowser2(iface);
FIXME("(%p)->(%s %p %d %d %p): stub\n", This, debugstr_guid(riid), rgszNames, cNames,
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
return E_NOTIMPL;
if(!rgszNames || cNames == 0 || !rgDispId)
return E_INVALIDARG;
hr = get_typeinfo(IWebBrowser2_tid, &typeinfo);
if (SUCCEEDED(hr))
{
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI webbrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExepInfo, UINT *puArgErr)
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
struct shellbrowserwindow *This = impl_from_IWebBrowser2(iface);
FIXME("(%p)->(%d %s %d %08x %p %p %p %p): stub\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
return E_NOTIMPL;
ITypeInfo *typeinfo;
HRESULT hr;
TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
hr = get_typeinfo(IWebBrowser2_tid, &typeinfo);
if (SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &This->IWebBrowser2_iface, dispIdMember, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
ITypeInfo_Release(typeinfo);
}
return hr;
}
/* IWebBrowser methods */