quartz: Free two assert calls from having side effects.
[wine/testsucceed.git] / dlls / ieframe / ieframe.h
blob89f69fade30496ad2770404166d2a39176520638
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"
39 #include "wine/unicode.h"
40 #include "wine/list.h"
42 typedef struct ConnectionPoint ConnectionPoint;
43 typedef struct DocHost DocHost;
45 typedef struct {
46 IConnectionPointContainer IConnectionPointContainer_iface;
48 ConnectionPoint *wbe2;
49 ConnectionPoint *wbe;
50 ConnectionPoint *pns;
52 IUnknown *impl;
53 } ConnectionPointContainer;
55 typedef struct {
56 IHlinkFrame IHlinkFrame_iface;
57 ITargetFrame2 ITargetFrame2_iface;
59 IUnknown *outer;
60 DocHost *doc_host;
61 } HlinkFrame;
63 struct _task_header_t;
65 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
66 typedef void (*task_destr_t)(struct _task_header_t*);
68 typedef struct _task_header_t {
69 struct list entry;
70 task_proc_t proc;
71 task_destr_t destr;
72 } task_header_t;
74 typedef struct _IDocHostContainerVtbl
76 ULONG (*addref)(DocHost*);
77 ULONG (*release)(DocHost*);
78 void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
79 HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
80 void (WINAPI* SetURL)(DocHost*,LPCWSTR);
81 HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*);
82 } IDocHostContainerVtbl;
84 struct DocHost {
85 IOleClientSite IOleClientSite_iface;
86 IOleInPlaceSiteEx IOleInPlaceSiteEx_iface;
87 IDocHostUIHandler2 IDocHostUIHandler2_iface;
88 IOleDocumentSite IOleDocumentSite_iface;
89 IOleControlSite IOleControlSite_iface;
90 IOleCommandTarget IOleCommandTarget_iface;
91 IDispatch IDispatch_iface;
92 IPropertyNotifySink IPropertyNotifySink_iface;
93 IServiceProvider IServiceProvider_iface;
95 /* Interfaces of InPlaceFrame object */
96 IOleInPlaceFrame IOleInPlaceFrame_iface;
98 IDispatch *disp;
100 IDispatch *client_disp;
101 IDocHostUIHandler *hostui;
102 IOleInPlaceFrame *frame;
104 IUnknown *document;
105 IOleDocumentView *view;
106 IUnknown *doc_navigate;
108 const IDocHostContainerVtbl *container_vtbl;
110 HWND hwnd;
111 HWND frame_hwnd;
113 struct list task_queue;
115 LPOLESTR url;
117 VARIANT_BOOL silent;
118 VARIANT_BOOL offline;
119 VARIANT_BOOL busy;
121 READYSTATE ready_state;
122 READYSTATE doc_state;
123 DWORD prop_notif_cookie;
124 BOOL is_prop_notif;
126 ConnectionPointContainer cps;
129 struct WebBrowser {
130 IWebBrowser2 IWebBrowser2_iface;
131 IOleObject IOleObject_iface;
132 IOleInPlaceObject IOleInPlaceObject_iface;
133 IOleControl IOleControl_iface;
134 IPersistStorage IPersistStorage_iface;
135 IPersistMemory IPersistMemory_iface;
136 IPersistStreamInit IPersistStreamInit_iface;
137 IProvideClassInfo2 IProvideClassInfo2_iface;
138 IViewObject2 IViewObject2_iface;
139 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
140 IOleCommandTarget IOleCommandTarget_iface;
141 IServiceProvider IServiceProvider_iface;
142 IDataObject IDataObject_iface;
143 HlinkFrame hlink_frame;
145 LONG ref;
147 INT version;
149 IOleClientSite *client;
150 IOleContainer *container;
151 IOleInPlaceSiteEx *inplace;
153 /* window context */
155 HWND frame_hwnd;
156 IOleInPlaceUIWindow *uiwindow;
157 RECT pos_rect;
158 RECT clip_rect;
159 OLEINPLACEFRAMEINFO frameinfo;
160 SIZEL extent;
162 HWND shell_embedding_hwnd;
164 VARIANT_BOOL register_browser;
165 VARIANT_BOOL visible;
166 VARIANT_BOOL menu_bar;
167 VARIANT_BOOL address_bar;
168 VARIANT_BOOL status_bar;
169 VARIANT_BOOL tool_bar;
170 VARIANT_BOOL full_screen;
171 VARIANT_BOOL theater_mode;
173 DocHost doc_host;
176 typedef struct {
177 DocHost doc_host;
179 LONG ref;
181 InternetExplorer *ie;
182 } IEDocHost;
184 struct InternetExplorer {
185 IWebBrowser2 IWebBrowser2_iface;
186 HlinkFrame hlink_frame;
188 LONG ref;
190 HWND frame_hwnd;
191 HWND status_hwnd;
192 HMENU menu;
193 BOOL nohome;
195 struct list entry;
196 IEDocHost *doc_host;
199 void WebBrowser_OleObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
200 void WebBrowser_ViewObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
201 void WebBrowser_Persist_Init(WebBrowser*) DECLSPEC_HIDDEN;
202 void WebBrowser_ClassInfo_Init(WebBrowser*) DECLSPEC_HIDDEN;
204 void WebBrowser_OleObject_Destroy(WebBrowser*) DECLSPEC_HIDDEN;
206 void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*) DECLSPEC_HIDDEN;
207 void DocHost_Release(DocHost*) DECLSPEC_HIDDEN;
208 void DocHost_ClientSite_Init(DocHost*) DECLSPEC_HIDDEN;
209 void DocHost_ClientSite_Release(DocHost*) DECLSPEC_HIDDEN;
210 void DocHost_Frame_Init(DocHost*) DECLSPEC_HIDDEN;
211 void release_dochost_client(DocHost*) DECLSPEC_HIDDEN;
213 void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN;
214 BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN;
216 HRESULT ShellBrowser_Create(IShellBrowser**) DECLSPEC_HIDDEN;
218 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
219 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
221 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*) DECLSPEC_HIDDEN;
222 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
223 HRESULT go_home(DocHost*) DECLSPEC_HIDDEN;
224 HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN;
225 void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN;
226 HRESULT dochost_object_available(DocHost*,IUnknown*) DECLSPEC_HIDDEN;
227 void set_doc_state(DocHost*,READYSTATE) DECLSPEC_HIDDEN;
228 void deactivate_document(DocHost*) DECLSPEC_HIDDEN;
229 void create_doc_view_hwnd(DocHost*) DECLSPEC_HIDDEN;
231 #define WM_DOCHOSTTASK (WM_USER+0x300)
232 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,task_destr_t,BOOL) DECLSPEC_HIDDEN;
233 void abort_dochost_tasks(DocHost*,task_proc_t) DECLSPEC_HIDDEN;
234 LRESULT process_dochost_tasks(DocHost*) DECLSPEC_HIDDEN;
236 void InternetExplorer_WebBrowser_Init(InternetExplorer*) DECLSPEC_HIDDEN;
237 HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR) DECLSPEC_HIDDEN;
238 void released_obj(void) DECLSPEC_HIDDEN;
240 void register_iewindow_class(void) DECLSPEC_HIDDEN;
241 void unregister_iewindow_class(void) DECLSPEC_HIDDEN;
243 HRESULT get_typeinfo(ITypeInfo**) DECLSPEC_HIDDEN;
244 HRESULT register_class_object(BOOL) DECLSPEC_HIDDEN;
246 HRESULT WINAPI CUrlHistory_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
247 HRESULT WINAPI InternetExplorer_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
248 HRESULT WINAPI InternetShortcut_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
249 HRESULT WINAPI TaskbarList_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
250 HRESULT WINAPI WebBrowser_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
251 HRESULT WINAPI WebBrowserV1_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
253 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
255 extern LONG module_ref DECLSPEC_HIDDEN;
256 extern HINSTANCE ieframe_instance DECLSPEC_HIDDEN;
258 static inline void lock_module(void) {
259 InterlockedIncrement(&module_ref);
262 static inline void unlock_module(void) {
263 InterlockedDecrement(&module_ref);
266 static inline void *heap_alloc(size_t len)
268 return HeapAlloc(GetProcessHeap(), 0, len);
271 static inline void *heap_alloc_zero(size_t len)
273 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
276 static inline void *heap_realloc(void *mem, size_t len)
278 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
281 static inline BOOL heap_free(void *mem)
283 return HeapFree(GetProcessHeap(), 0, mem);
286 static inline LPWSTR heap_strdupW(LPCWSTR str)
288 LPWSTR ret = NULL;
290 if(str) {
291 DWORD size;
293 size = (strlenW(str)+1)*sizeof(WCHAR);
294 ret = heap_alloc(size);
295 if(ret)
296 memcpy(ret, str, size);
299 return ret;
302 static inline LPWSTR co_strdupW(LPCWSTR str)
304 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
305 if (ret)
306 lstrcpyW(ret, str);
307 return ret;
310 static inline LPWSTR co_strdupAtoW(LPCSTR str)
312 INT len;
313 WCHAR *ret;
314 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
315 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
316 if (ret)
317 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
318 return ret;
321 static inline LPSTR co_strdupWtoA(LPCWSTR str)
323 INT len;
324 CHAR *ret;
325 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
326 ret = CoTaskMemAlloc(len);
327 if (ret)
328 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
329 return ret;