ddraw: Destroy the swapchain in the DllMain() cleanup handler.
[wine/zf.git] / dlls / ieframe / ieframe.h
blob4c32e5245d0ef5fdacb276433928e3b5d893e369
1 /*
2 * Header includes for ieframe.dll
4 * Copyright 2011 Jacek Caban for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #define COBJMACROS
24 #define NONAMELESSUNION
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
31 #include "ole2.h"
32 #include "olectl.h"
33 #include "shlobj.h"
34 #include "mshtmhst.h"
35 #include "exdisp.h"
36 #include "hlink.h"
37 #include "htiframe.h"
38 #include "shdeprecated.h"
39 #include "docobjectservice.h"
41 #include "wine/unicode.h"
42 #include "wine/list.h"
44 typedef struct ConnectionPoint ConnectionPoint;
45 typedef struct DocHost DocHost;
47 typedef struct {
48 IConnectionPointContainer IConnectionPointContainer_iface;
50 ConnectionPoint *wbe2;
51 ConnectionPoint *wbe;
52 ConnectionPoint *pns;
54 IUnknown *impl;
55 } ConnectionPointContainer;
57 typedef struct {
58 IHlinkFrame IHlinkFrame_iface;
59 ITargetFrame2 ITargetFrame2_iface;
61 IUnknown *outer;
62 DocHost *doc_host;
63 } HlinkFrame;
65 struct _task_header_t;
67 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
68 typedef void (*task_destr_t)(struct _task_header_t*);
70 typedef struct _task_header_t {
71 struct list entry;
72 task_proc_t proc;
73 task_destr_t destr;
74 } task_header_t;
76 typedef struct {
77 IShellBrowser IShellBrowser_iface;
78 IBrowserService IBrowserService_iface;
79 IDocObjectService IDocObjectService_iface;
81 LONG ref;
83 DocHost *doc_host;
84 } ShellBrowser;
86 typedef struct _IDocHostContainerVtbl
88 ULONG (*addref)(DocHost*);
89 ULONG (*release)(DocHost*);
90 void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
91 HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
92 void (WINAPI* SetURL)(DocHost*,LPCWSTR);
93 HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*);
94 } IDocHostContainerVtbl;
96 struct DocHost {
97 IOleClientSite IOleClientSite_iface;
98 IOleInPlaceSiteEx IOleInPlaceSiteEx_iface;
99 IDocHostUIHandler2 IDocHostUIHandler2_iface;
100 IOleDocumentSite IOleDocumentSite_iface;
101 IOleControlSite IOleControlSite_iface;
102 IOleCommandTarget IOleCommandTarget_iface;
103 IDispatch IDispatch_iface;
104 IPropertyNotifySink IPropertyNotifySink_iface;
105 IServiceProvider IServiceProvider_iface;
107 /* Interfaces of InPlaceFrame object */
108 IOleInPlaceFrame IOleInPlaceFrame_iface;
110 IDispatch *disp;
112 IDispatch *client_disp;
113 IDocHostUIHandler *hostui;
114 IOleInPlaceFrame *frame;
116 IUnknown *document;
117 IOleDocumentView *view;
118 IUnknown *doc_navigate;
120 const IDocHostContainerVtbl *container_vtbl;
122 HWND hwnd;
123 HWND frame_hwnd;
125 struct list task_queue;
127 LPOLESTR url;
129 VARIANT_BOOL silent;
130 VARIANT_BOOL offline;
131 VARIANT_BOOL busy;
133 READYSTATE ready_state;
134 READYSTATE doc_state;
135 DWORD prop_notif_cookie;
136 BOOL is_prop_notif;
138 ShellBrowser *browser_service;
140 ConnectionPointContainer cps;
143 struct WebBrowser {
144 IWebBrowser2 IWebBrowser2_iface;
145 IOleObject IOleObject_iface;
146 IOleInPlaceObject IOleInPlaceObject_iface;
147 IOleControl IOleControl_iface;
148 IPersistStorage IPersistStorage_iface;
149 IPersistMemory IPersistMemory_iface;
150 IPersistStreamInit IPersistStreamInit_iface;
151 IProvideClassInfo2 IProvideClassInfo2_iface;
152 IViewObject2 IViewObject2_iface;
153 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
154 IOleCommandTarget IOleCommandTarget_iface;
155 IServiceProvider IServiceProvider_iface;
156 IDataObject IDataObject_iface;
157 HlinkFrame hlink_frame;
159 LONG ref;
161 INT version;
163 IOleClientSite *client;
164 IOleContainer *container;
165 IOleInPlaceSiteEx *inplace;
167 /* window context */
169 HWND frame_hwnd;
170 IOleInPlaceUIWindow *uiwindow;
171 RECT pos_rect;
172 RECT clip_rect;
173 OLEINPLACEFRAMEINFO frameinfo;
174 SIZEL extent;
176 HWND shell_embedding_hwnd;
178 VARIANT_BOOL register_browser;
179 VARIANT_BOOL visible;
180 VARIANT_BOOL menu_bar;
181 VARIANT_BOOL address_bar;
182 VARIANT_BOOL status_bar;
183 VARIANT_BOOL tool_bar;
184 VARIANT_BOOL full_screen;
185 VARIANT_BOOL theater_mode;
187 DocHost doc_host;
190 typedef struct {
191 DocHost doc_host;
193 LONG ref;
195 InternetExplorer *ie;
196 } IEDocHost;
198 struct InternetExplorer {
199 IWebBrowser2 IWebBrowser2_iface;
200 HlinkFrame hlink_frame;
202 LONG ref;
204 HWND frame_hwnd;
205 HWND status_hwnd;
206 HMENU menu;
207 BOOL nohome;
209 struct list entry;
210 IEDocHost *doc_host;
213 void WebBrowser_OleObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
214 void WebBrowser_ViewObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
215 void WebBrowser_Persist_Init(WebBrowser*) DECLSPEC_HIDDEN;
216 void WebBrowser_ClassInfo_Init(WebBrowser*) DECLSPEC_HIDDEN;
218 void WebBrowser_OleObject_Destroy(WebBrowser*) DECLSPEC_HIDDEN;
220 void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*) DECLSPEC_HIDDEN;
221 void DocHost_Release(DocHost*) DECLSPEC_HIDDEN;
222 void DocHost_ClientSite_Init(DocHost*) DECLSPEC_HIDDEN;
223 void DocHost_ClientSite_Release(DocHost*) DECLSPEC_HIDDEN;
224 void DocHost_Frame_Init(DocHost*) DECLSPEC_HIDDEN;
225 void release_dochost_client(DocHost*) DECLSPEC_HIDDEN;
227 void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN;
228 BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN;
230 HRESULT create_browser_service(DocHost*,ShellBrowser**) DECLSPEC_HIDDEN;
231 void detach_browser_service(ShellBrowser*) DECLSPEC_HIDDEN;
233 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
234 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
236 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*) DECLSPEC_HIDDEN;
237 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
238 HRESULT go_home(DocHost*) DECLSPEC_HIDDEN;
239 HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN;
240 HRESULT set_dochost_url(DocHost*,const WCHAR*) DECLSPEC_HIDDEN;
241 void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN;
242 HRESULT dochost_object_available(DocHost*,IUnknown*) DECLSPEC_HIDDEN;
243 void set_doc_state(DocHost*,READYSTATE) DECLSPEC_HIDDEN;
244 void deactivate_document(DocHost*) DECLSPEC_HIDDEN;
245 void create_doc_view_hwnd(DocHost*) DECLSPEC_HIDDEN;
247 #define WM_DOCHOSTTASK (WM_USER+0x300)
248 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,task_destr_t,BOOL) DECLSPEC_HIDDEN;
249 void abort_dochost_tasks(DocHost*,task_proc_t) DECLSPEC_HIDDEN;
250 LRESULT process_dochost_tasks(DocHost*) DECLSPEC_HIDDEN;
252 void InternetExplorer_WebBrowser_Init(InternetExplorer*) DECLSPEC_HIDDEN;
253 HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR) DECLSPEC_HIDDEN;
254 void released_obj(void) DECLSPEC_HIDDEN;
256 void register_iewindow_class(void) DECLSPEC_HIDDEN;
257 void unregister_iewindow_class(void) DECLSPEC_HIDDEN;
259 HRESULT get_typeinfo(ITypeInfo**) DECLSPEC_HIDDEN;
260 HRESULT register_class_object(BOOL) DECLSPEC_HIDDEN;
262 HRESULT WINAPI CUrlHistory_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
263 HRESULT WINAPI InternetExplorer_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
264 HRESULT WINAPI InternetShortcut_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
265 HRESULT WINAPI TaskbarList_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
266 HRESULT WINAPI WebBrowser_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
267 HRESULT WINAPI WebBrowserV1_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
269 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
271 extern LONG module_ref DECLSPEC_HIDDEN;
272 extern HINSTANCE ieframe_instance DECLSPEC_HIDDEN;
274 static inline void lock_module(void) {
275 InterlockedIncrement(&module_ref);
278 static inline void unlock_module(void) {
279 InterlockedDecrement(&module_ref);
282 static inline void *heap_alloc(size_t len)
284 return HeapAlloc(GetProcessHeap(), 0, len);
287 static inline void *heap_alloc_zero(size_t len)
289 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
292 static inline void *heap_realloc(void *mem, size_t len)
294 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
297 static inline BOOL heap_free(void *mem)
299 return HeapFree(GetProcessHeap(), 0, mem);
302 static inline LPWSTR heap_strdupW(LPCWSTR str)
304 LPWSTR ret = NULL;
306 if(str) {
307 DWORD size;
309 size = (strlenW(str)+1)*sizeof(WCHAR);
310 ret = heap_alloc(size);
311 if(ret)
312 memcpy(ret, str, size);
315 return ret;
318 static inline LPWSTR co_strdupW(LPCWSTR str)
320 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
321 if (ret)
322 lstrcpyW(ret, str);
323 return ret;
326 static inline LPWSTR co_strdupAtoW(LPCSTR str)
328 INT len;
329 WCHAR *ret;
330 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
331 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
332 if (ret)
333 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
334 return ret;
337 static inline LPSTR co_strdupWtoA(LPCWSTR str)
339 INT len;
340 CHAR *ret;
341 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
342 ret = CoTaskMemAlloc(len);
343 if (ret)
344 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
345 return ret;