advapi32: Make rpcrt4 a delayed import to work around circular dependencies with...
[wine/testsucceed.git] / dlls / shdocvw / shdocvw.h
blob1af0365d25d43f9427e584b5c5eecffdccd50748
1 /*
2 * Header includes for shdocvw.dll
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2005-2006 Jacek Caban for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_SHDOCVW_H
23 #define __WINE_SHDOCVW_H
25 #define COBJMACROS
27 #include <stdarg.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
34 #include "ole2.h"
35 #include "olectl.h"
36 #include "shlobj.h"
37 #include "exdisp.h"
38 #include "mshtmhst.h"
39 #include "hlink.h"
40 #include "htiframe.h"
42 #include "wine/unicode.h"
44 /**********************************************************************
45 * Shell Instance Objects
47 extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
48 REFIID riid, LPVOID *ppvClassObj);
50 /**********************************************************************
51 * WebBrowser declaration for SHDOCVW.DLL
54 typedef struct ConnectionPoint ConnectionPoint;
55 typedef struct DocHost DocHost;
57 typedef struct {
58 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
60 ConnectionPoint *wbe2;
61 ConnectionPoint *wbe;
62 ConnectionPoint *pns;
64 IUnknown *impl;
65 } ConnectionPointContainer;
67 struct _task_header_t;
69 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
71 typedef struct _task_header_t {
72 task_proc_t proc;
73 } task_header_t;
75 struct DocHost {
76 const IOleClientSiteVtbl *lpOleClientSiteVtbl;
77 const IOleInPlaceSiteVtbl *lpOleInPlaceSiteVtbl;
78 const IDocHostUIHandler2Vtbl *lpDocHostUIHandlerVtbl;
79 const IOleDocumentSiteVtbl *lpOleDocumentSiteVtbl;
80 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
81 const IDispatchVtbl *lpDispatchVtbl;
82 const IPropertyNotifySinkVtbl *lpIPropertyNotifySinkVtbl;
83 const IServiceProviderVtbl *lpServiceProviderVtbl;
85 /* Interfaces of InPlaceFrame object */
86 const IOleInPlaceFrameVtbl *lpOleInPlaceFrameVtbl;
88 IDispatch *disp;
90 IDispatch *client_disp;
91 IDocHostUIHandler *hostui;
92 IOleInPlaceFrame *frame;
94 IUnknown *document;
95 IOleDocumentView *view;
96 IUnknown *doc_navigate;
98 HWND hwnd;
99 HWND frame_hwnd;
101 LPOLESTR url;
103 VARIANT_BOOL silent;
104 VARIANT_BOOL offline;
105 VARIANT_BOOL busy;
107 READYSTATE ready_state;
108 READYSTATE doc_state;
109 DWORD prop_notif_cookie;
110 BOOL is_prop_notif;
112 ConnectionPointContainer cps;
115 struct WebBrowser {
116 /* Interfaces available via WebBrowser object */
118 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
119 const IOleObjectVtbl *lpOleObjectVtbl;
120 const IOleInPlaceObjectVtbl *lpOleInPlaceObjectVtbl;
121 const IOleControlVtbl *lpOleControlVtbl;
122 const IPersistStorageVtbl *lpPersistStorageVtbl;
123 const IPersistMemoryVtbl *lpPersistMemoryVtbl;
124 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
125 const IProvideClassInfo2Vtbl *lpProvideClassInfoVtbl;
126 const IViewObject2Vtbl *lpViewObjectVtbl;
127 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
128 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
129 const IHlinkFrameVtbl *lpHlinkFrameVtbl;
130 const ITargetFrame2Vtbl *lpITargetFrame2Vtbl;
131 const IServiceProviderVtbl *lpServiceProviderVtbl;
132 const IDataObjectVtbl *lpDataObjectVtbl;
134 LONG ref;
136 INT version;
138 IOleClientSite *client;
139 IOleContainer *container;
140 IOleInPlaceSite *inplace;
142 /* window context */
144 HWND frame_hwnd;
145 IOleInPlaceUIWindow *uiwindow;
146 RECT pos_rect;
147 RECT clip_rect;
148 OLEINPLACEFRAMEINFO frameinfo;
149 SIZEL extent;
151 HWND shell_embedding_hwnd;
153 VARIANT_BOOL register_browser;
154 VARIANT_BOOL visible;
155 VARIANT_BOOL menu_bar;
156 VARIANT_BOOL address_bar;
157 VARIANT_BOOL status_bar;
158 VARIANT_BOOL tool_bar;
159 VARIANT_BOOL full_screen;
160 VARIANT_BOOL theater_mode;
162 DocHost doc_host;
165 struct InternetExplorer {
166 const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
168 LONG ref;
170 HWND frame_hwnd;
172 DocHost doc_host;
175 #define WEBBROWSER(x) ((IWebBrowser*) &(x)->lpWebBrowser2Vtbl)
176 #define WEBBROWSER2(x) ((IWebBrowser2*) &(x)->lpWebBrowser2Vtbl)
177 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
178 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectVtbl)
179 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
180 #define PERSTORAGE(x) ((IPersistStorage*) &(x)->lpPersistStorageVtbl)
181 #define PERMEMORY(x) ((IPersistMemory*) &(x)->lpPersistMemoryVtbl)
182 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
183 #define CLASSINFO(x) ((IProvideClassInfo2*) &(x)->lpProvideClassInfoVtbl)
184 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
185 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObjectVtbl);
186 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectVtbl);
187 #define ACTIVEOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
188 #define OLECMD(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
189 #define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpHlinkFrameVtbl)
190 #define DATAOBJECT(x) ((IDataObject*) &(x)->lpDataObjectVtbl)
191 #define TARGETFRAME2(x) ((ITargetFrame2*) &(x)->lpITargetFrame2Vtbl)
193 #define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpOleClientSiteVtbl)
194 #define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpOleInPlaceSiteVtbl)
195 #define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpDocHostUIHandlerVtbl)
196 #define DOCHOSTUI2(x) ((IDocHostUIHandler2*) &(x)->lpDocHostUIHandlerVtbl)
197 #define DOCSITE(x) ((IOleDocumentSite*) &(x)->lpOleDocumentSiteVtbl)
198 #define CLDISP(x) ((IDispatch*) &(x)->lpDispatchVtbl)
199 #define PROPNOTIF(x) ((IPropertyNotifySink*) &(x)->lpIPropertyNotifySinkVtbl)
200 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
202 #define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl)
204 void WebBrowser_OleObject_Init(WebBrowser*);
205 void WebBrowser_ViewObject_Init(WebBrowser*);
206 void WebBrowser_DataObject_Init(WebBrowser*);
207 void WebBrowser_Persist_Init(WebBrowser*);
208 void WebBrowser_ClassInfo_Init(WebBrowser*);
209 void WebBrowser_HlinkFrame_Init(WebBrowser*);
211 void WebBrowser_OleObject_Destroy(WebBrowser*);
213 void DocHost_Init(DocHost*,IDispatch*);
214 void DocHost_ClientSite_Init(DocHost*);
215 void DocHost_Frame_Init(DocHost*);
216 void release_dochost_client(DocHost*);
218 void DocHost_Release(DocHost*);
219 void DocHost_ClientSite_Release(DocHost*);
221 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
222 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
224 HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
225 HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
227 void create_doc_view_hwnd(DocHost*);
228 void deactivate_document(DocHost*);
229 HRESULT dochost_object_available(DocHost*,IUnknown*);
230 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
231 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
232 HRESULT go_home(DocHost*);
233 void set_doc_state(DocHost*,READYSTATE);
235 #define WM_DOCHOSTTASK (WM_USER+0x300)
236 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
237 LRESULT process_dochost_task(DocHost*,LPARAM);
239 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
240 void InternetExplorer_WebBrowser_Init(InternetExplorer*);
242 HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
244 HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);
246 HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);
248 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
250 /**********************************************************************
251 * Dll lifetime tracking declaration for shdocvw.dll
253 extern LONG SHDOCVW_refCount;
254 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
255 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
257 extern HINSTANCE shdocvw_hinstance;
258 extern void register_iewindow_class(void);
259 extern void unregister_iewindow_class(void);
261 HRESULT register_class_object(BOOL);
262 HRESULT get_typeinfo(ITypeInfo**);
263 DWORD register_iexplore(BOOL);
265 const char *debugstr_variant(const VARIANT*);
267 /* memory allocation functions */
269 static inline void *heap_alloc(size_t len)
271 return HeapAlloc(GetProcessHeap(), 0, len);
274 static inline void *heap_alloc_zero(size_t len)
276 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
279 static inline void *heap_realloc(void *mem, size_t len)
281 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
284 static inline BOOL heap_free(void *mem)
286 return HeapFree(GetProcessHeap(), 0, mem);
289 static inline LPWSTR heap_strdupW(LPCWSTR str)
291 LPWSTR ret = NULL;
293 if(str) {
294 DWORD size;
296 size = (strlenW(str)+1)*sizeof(WCHAR);
297 ret = heap_alloc(size);
298 memcpy(ret, str, size);
301 return ret;
304 static inline LPWSTR co_strdupW(LPCWSTR str)
306 WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
307 if (ret)
308 lstrcpyW(ret, str);
309 return ret;
312 static inline LPWSTR co_strdupAtoW(LPCSTR str)
314 INT len;
315 WCHAR *ret;
316 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
317 ret = CoTaskMemAlloc(len*sizeof(WCHAR));
318 if (ret)
319 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
320 return ret;
323 static inline LPSTR co_strdupWtoA(LPCWSTR str)
325 INT len;
326 CHAR *ret;
327 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
328 ret = CoTaskMemAlloc(len);
329 if (ret)
330 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
331 return ret;
334 #endif /* __WINE_SHDOCVW_H */