2 * Copyright 2011 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
25 #include "ieautomation.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(ieframe
);
32 HINSTANCE ieframe_instance
;
34 static ITypeLib
*typelib
;
35 static ITypeInfo
*typeinfos
[LAST_tid
];
37 static REFIID tid_ids
[] = {
38 #define XIID(iface) &IID_ ## iface,
39 #define XCLSID(class) &CLSID_ ## class,
45 static HRESULT
load_typelib(void)
50 hres
= LoadRegTypeLib(&LIBID_SHDocVw
, 1, 1, LOCALE_SYSTEM_DEFAULT
, &tl
);
52 ERR("LoadRegTypeLib failed: %08lx\n", hres
);
56 if(InterlockedCompareExchangePointer((void**)&typelib
, tl
, NULL
))
61 HRESULT
get_typeinfo(tid_t tid
, ITypeInfo
**typeinfo
)
66 hres
= load_typelib();
73 hres
= ITypeLib_GetTypeInfoOfGuid(typelib
, tid_ids
[tid
], &ti
);
75 ERR("GetTypeInfoOfGuid(%s) failed: %08lx\n", debugstr_guid(tid_ids
[tid
]), hres
);
79 if(InterlockedCompareExchangePointer((void**)(typeinfos
+tid
), ti
, NULL
))
80 ITypeInfo_Release(ti
);
83 *typeinfo
= typeinfos
[tid
];
87 static void release_typelib(void)
94 for(i
=0; i
< ARRAY_SIZE(typeinfos
); i
++) {
96 ITypeInfo_Release(typeinfos
[i
]);
99 ITypeLib_Release(typelib
);
102 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
106 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
107 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
109 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
110 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
115 IUnknown_AddRef((IUnknown
*)*ppv
);
119 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
120 return E_NOINTERFACE
;
123 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
125 TRACE("(%p)\n", iface
);
129 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
131 TRACE("(%p)\n", iface
);
135 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
137 TRACE("(%p)->(%x)\n", iface
, fLock
);
141 static const IClassFactoryVtbl WebBrowserFactoryVtbl
= {
142 ClassFactory_QueryInterface
,
144 ClassFactory_Release
,
146 ClassFactory_LockServer
149 static IClassFactory WebBrowserFactory
= { &WebBrowserFactoryVtbl
};
151 static const IClassFactoryVtbl WebBrowserV1FactoryVtbl
= {
152 ClassFactory_QueryInterface
,
154 ClassFactory_Release
,
156 ClassFactory_LockServer
159 static IClassFactory WebBrowserV1Factory
= { &WebBrowserV1FactoryVtbl
};
161 static const IClassFactoryVtbl InternetShortcutFactoryVtbl
= {
162 ClassFactory_QueryInterface
,
164 ClassFactory_Release
,
165 InternetShortcut_Create
,
166 ClassFactory_LockServer
169 static IClassFactory InternetShortcutFactory
= { &InternetShortcutFactoryVtbl
};
171 static const IClassFactoryVtbl CUrlHistoryFactoryVtbl
= {
172 ClassFactory_QueryInterface
,
174 ClassFactory_Release
,
176 ClassFactory_LockServer
179 static IClassFactory CUrlHistoryFactory
= { &CUrlHistoryFactoryVtbl
};
181 /******************************************************************
182 * DllMain (ieframe.@)
184 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
186 TRACE("(%p %ld %p)\n", hInstDLL
, fdwReason
, lpv
);
190 case DLL_PROCESS_ATTACH
:
191 ieframe_instance
= hInstDLL
;
192 register_iewindow_class();
193 DisableThreadLibraryCalls(ieframe_instance
);
195 case DLL_PROCESS_DETACH
:
197 unregister_iewindow_class();
204 /***********************************************************************
205 * DllGetClassObject (ieframe.@)
207 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
209 if(IsEqualGUID(&CLSID_WebBrowser
, rclsid
)) {
210 TRACE("(CLSID_WebBrowser %s %p)\n", debugstr_guid(riid
), ppv
);
211 return IClassFactory_QueryInterface(&WebBrowserFactory
, riid
, ppv
);
214 if(IsEqualGUID(&CLSID_WebBrowser_V1
, rclsid
)) {
215 TRACE("(CLSID_WebBrowser_V1 %s %p)\n", debugstr_guid(riid
), ppv
);
216 return IClassFactory_QueryInterface(&WebBrowserV1Factory
, riid
, ppv
);
219 if(IsEqualGUID(rclsid
, &CLSID_InternetShortcut
)) {
220 TRACE("(CLSID_InternetShortcut %s %p)\n", debugstr_guid(riid
), ppv
);
221 return IClassFactory_QueryInterface(&InternetShortcutFactory
, riid
, ppv
);
224 if(IsEqualGUID(&CLSID_CUrlHistory
, rclsid
)) {
225 TRACE("(CLSID_CUrlHistory %s %p)\n", debugstr_guid(riid
), ppv
);
226 return IClassFactory_QueryInterface(&CUrlHistoryFactory
, riid
, ppv
);
229 FIXME("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
230 return CLASS_E_CLASSNOTAVAILABLE
;
233 static const IClassFactoryVtbl InternetExplorerFactoryVtbl
= {
234 ClassFactory_QueryInterface
,
236 ClassFactory_Release
,
237 InternetExplorer_Create
,
238 ClassFactory_LockServer
241 IClassFactory InternetExplorerFactory
= { &InternetExplorerFactoryVtbl
};
243 static const IClassFactoryVtbl InternetExplorerManagerFactoryVtbl
= {
244 ClassFactory_QueryInterface
,
246 ClassFactory_Release
,
247 InternetExplorerManager_Create
,
248 ClassFactory_LockServer
251 IClassFactory InternetExplorerManagerFactory
= { &InternetExplorerManagerFactoryVtbl
};
253 /***********************************************************************
254 * DllCanUnloadNow (ieframe.@)
256 HRESULT WINAPI
DllCanUnloadNow(void)
259 return module_ref
? S_FALSE
: S_OK
;
262 /***********************************************************************
263 * IEGetWriteableHKCU (ieframe.@)
265 HRESULT WINAPI
IEGetWriteableHKCU(HKEY
*pkey
)
267 FIXME("(%p) stub\n", pkey
);
271 /***********************************************************************
272 * SetQueryNetSessionCount (ieframe.@)
274 LONG WINAPI
SetQueryNetSessionCount(DWORD session_op
)
276 static LONG session_count
;
278 TRACE("(%lx)\n", session_op
);
283 return session_count
;
284 case SESSION_INCREMENT
:
285 return InterlockedIncrement(&session_count
);
286 case SESSION_DECREMENT
:
287 return InterlockedDecrement(&session_count
);