push 6fe5edf8439c19d3885814583531c2f2b1495177
[wine/hacks.git] / dlls / mshtml / dispex.c
blob6596f76bc0ef32410439f2e5d9a70600f04000d2
1 /*
2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 static ITypeLib *typelib;
35 static ITypeInfo *typeinfos[LAST_tid];
37 static REFIID tid_ids[] = {
38 &IID_IHTMLWindow2,
41 HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
43 HRESULT hres;
45 if(!typelib) {
46 ITypeLib *tl;
48 hres = LoadRegTypeLib(&LIBID_MSHTML, 4, 0, LOCALE_SYSTEM_DEFAULT, &tl);
49 if(FAILED(hres)) {
50 ERR("LoadRegTypeLib failed: %08x\n", hres);
51 return hres;
54 if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
55 ITypeLib_Release(tl);
58 if(!typeinfos[tid]) {
59 ITypeInfo *typeinfo;
61 hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &typeinfo);
62 if(FAILED(hres)) {
63 ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
64 return hres;
67 if(InterlockedCompareExchangePointer((void**)(typeinfos+tid), typeinfo, NULL))
68 ITypeInfo_Release(typeinfo);
71 *typeinfo = typeinfos[tid];
72 return S_OK;
75 void release_typelib(void)
77 unsigned i;
79 if(!typelib)
80 return;
82 for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
83 if(typeinfos[i])
84 ITypeInfo_Release(typeinfos[i]);
86 ITypeLib_Release(typelib);
89 #define DISPATCHEX_THIS(iface) DEFINE_THIS(DispatchEx, IDispatchEx, iface)
91 static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
93 DispatchEx *This = DISPATCHEX_THIS(iface);
95 return IUnknown_QueryInterface(This->outer, riid, ppv);
98 static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
100 DispatchEx *This = DISPATCHEX_THIS(iface);
102 return IUnknown_AddRef(This->outer);
105 static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
107 DispatchEx *This = DISPATCHEX_THIS(iface);
109 return IUnknown_Release(This->outer);
112 static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
114 DispatchEx *This = DISPATCHEX_THIS(iface);
116 TRACE("(%p)->(%p)\n", This, pctinfo);
118 *pctinfo = 1;
119 return S_OK;
122 static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
123 LCID lcid, ITypeInfo **ppTInfo)
125 DispatchEx *This = DISPATCHEX_THIS(iface);
126 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
127 return E_NOTIMPL;
130 static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
131 LPOLESTR *rgszNames, UINT cNames,
132 LCID lcid, DISPID *rgDispId)
134 DispatchEx *This = DISPATCHEX_THIS(iface);
135 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
136 lcid, rgDispId);
137 return E_NOTIMPL;
140 static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
141 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
142 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
144 DispatchEx *This = DISPATCHEX_THIS(iface);
145 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
146 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
147 return E_NOTIMPL;
150 static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
152 DispatchEx *This = DISPATCHEX_THIS(iface);
153 FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid);
154 return E_NOTIMPL;
157 static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
158 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
160 DispatchEx *This = DISPATCHEX_THIS(iface);
161 FIXME("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
162 return E_NOTIMPL;
165 static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
167 DispatchEx *This = DISPATCHEX_THIS(iface);
168 FIXME("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
169 return E_NOTIMPL;
172 static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
174 DispatchEx *This = DISPATCHEX_THIS(iface);
175 FIXME("(%p)->(%x)\n", This, id);
176 return E_NOTIMPL;
179 static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
181 DispatchEx *This = DISPATCHEX_THIS(iface);
182 FIXME("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
183 return E_NOTIMPL;
186 static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
188 DispatchEx *This = DISPATCHEX_THIS(iface);
189 FIXME("(%p)->(%x %p)\n", This, id, pbstrName);
190 return E_NOTIMPL;
193 static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
195 DispatchEx *This = DISPATCHEX_THIS(iface);
196 FIXME("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
197 return E_NOTIMPL;
200 static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
202 DispatchEx *This = DISPATCHEX_THIS(iface);
203 FIXME("(%p)->(%p)\n", This, ppunk);
204 return E_NOTIMPL;
207 #undef DISPATCHEX_THIS
209 static IDispatchExVtbl DispatchExVtbl = {
210 DispatchEx_QueryInterface,
211 DispatchEx_AddRef,
212 DispatchEx_Release,
213 DispatchEx_GetTypeInfoCount,
214 DispatchEx_GetTypeInfo,
215 DispatchEx_GetIDsOfNames,
216 DispatchEx_Invoke,
217 DispatchEx_GetDispID,
218 DispatchEx_InvokeEx,
219 DispatchEx_DeleteMemberByName,
220 DispatchEx_DeleteMemberByDispID,
221 DispatchEx_GetMemberProperties,
222 DispatchEx_GetMemberName,
223 DispatchEx_GetNextDispID,
224 DispatchEx_GetNameSpaceParent
227 void init_dispex(DispatchEx *dispex, IUnknown *outer)
229 dispex->lpIDispatchExVtbl = &DispatchExVtbl;
230 dispex->outer = outer;