ntdll: The FileMailslotSetInformation and FileCompletionInformation cases of NtSetInf...
[wine] / dlls / shdocvw / shdocvw.h
1 /*
2  * Header includes for shdocvw.dll
3  *
4  * Copyright 2001 John R. Sheets (for CodeWeavers)
5  * Copyright 2005-2006 Jacek Caban for CodeWeavers
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #ifndef __WINE_SHDOCVW_H
23 #define __WINE_SHDOCVW_H
24
25 #define COBJMACROS
26
27 #include <stdarg.h>
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
33
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
41 #include "wine/unicode.h"
42
43 /**********************************************************************
44  * Shell Instance Objects
45  */
46 extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, 
47     REFIID riid, LPVOID *ppvClassObj);
48
49 /**********************************************************************
50  * WebBrowser declaration for SHDOCVW.DLL
51  */
52
53 typedef struct ConnectionPoint ConnectionPoint;
54 typedef struct DocHost DocHost;
55
56 typedef struct {
57     const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
58
59     ConnectionPoint *wbe2;
60     ConnectionPoint *wbe;
61     ConnectionPoint *pns;
62
63     IUnknown *impl;
64 } ConnectionPointContainer;
65
66 struct _task_header_t;
67
68 typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
69
70 typedef struct _task_header_t {
71     task_proc_t proc;
72 } task_header_t;
73
74 struct DocHost {
75     const IOleClientSiteVtbl      *lpOleClientSiteVtbl;
76     const IOleInPlaceSiteVtbl     *lpOleInPlaceSiteVtbl;
77     const IDocHostUIHandler2Vtbl  *lpDocHostUIHandlerVtbl;
78     const IOleDocumentSiteVtbl    *lpOleDocumentSiteVtbl;
79     const IOleCommandTargetVtbl   *lpOleCommandTargetVtbl;
80     const IDispatchVtbl           *lpDispatchVtbl;
81     const IServiceProviderVtbl    *lpServiceProviderVtbl;
82
83     /* Interfaces of InPlaceFrame object */
84     const IOleInPlaceFrameVtbl          *lpOleInPlaceFrameVtbl;
85
86     IDispatch *disp;
87
88     IDispatch *client_disp;
89     IDocHostUIHandler *hostui;
90     IOleInPlaceFrame *frame;
91
92     IUnknown *document;
93     IOleDocumentView *view;
94
95     HWND hwnd;
96     HWND frame_hwnd;
97
98     LPOLESTR url;
99
100     VARIANT_BOOL silent;
101     VARIANT_BOOL offline;
102
103     ConnectionPointContainer cps;
104 };
105
106 struct WebBrowser {
107     /* Interfaces available via WebBrowser object */
108
109     const IWebBrowser2Vtbl              *lpWebBrowser2Vtbl;
110     const IOleObjectVtbl                *lpOleObjectVtbl;
111     const IOleInPlaceObjectVtbl         *lpOleInPlaceObjectVtbl;
112     const IOleControlVtbl               *lpOleControlVtbl;
113     const IPersistStorageVtbl           *lpPersistStorageVtbl;
114     const IPersistMemoryVtbl            *lpPersistMemoryVtbl;
115     const IPersistStreamInitVtbl        *lpPersistStreamInitVtbl;
116     const IProvideClassInfo2Vtbl        *lpProvideClassInfoVtbl;
117     const IViewObject2Vtbl              *lpViewObjectVtbl;
118     const IOleInPlaceActiveObjectVtbl   *lpOleInPlaceActiveObjectVtbl;
119     const IOleCommandTargetVtbl         *lpOleCommandTargetVtbl;
120     const IHlinkFrameVtbl               *lpHlinkFrameVtbl;
121
122     LONG ref;
123
124     INT version;
125
126     IOleClientSite *client;
127     IOleContainer *container;
128     IOleInPlaceSite *inplace;
129
130     /* window context */
131
132     HWND frame_hwnd;
133     IOleInPlaceUIWindow *uiwindow;
134     RECT pos_rect;
135     RECT clip_rect;
136     OLEINPLACEFRAMEINFO frameinfo;
137     SIZEL extent;
138
139     HWND shell_embedding_hwnd;
140
141     VARIANT_BOOL visible;
142     VARIANT_BOOL menu_bar;
143     VARIANT_BOOL address_bar;
144     VARIANT_BOOL status_bar;
145     VARIANT_BOOL tool_bar;
146     VARIANT_BOOL full_screen;
147
148     DocHost doc_host;
149 };
150
151 struct InternetExplorer {
152     const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
153
154     LONG ref;
155
156     HWND frame_hwnd;
157
158     DocHost doc_host;
159 };
160
161 #define WEBBROWSER(x)   ((IWebBrowser*)                 &(x)->lpWebBrowser2Vtbl)
162 #define WEBBROWSER2(x)  ((IWebBrowser2*)                &(x)->lpWebBrowser2Vtbl)
163 #define OLEOBJ(x)       ((IOleObject*)                  &(x)->lpOleObjectVtbl)
164 #define INPLACEOBJ(x)   ((IOleInPlaceObject*)           &(x)->lpOleInPlaceObjectVtbl)
165 #define CONTROL(x)      ((IOleControl*)                 &(x)->lpOleControlVtbl)
166 #define PERSTORAGE(x)   ((IPersistStorage*)             &(x)->lpPersistStorageVtbl)
167 #define PERMEMORY(x)    ((IPersistMemory*)              &(x)->lpPersistMemoryVtbl)
168 #define PERSTRINIT(x)   ((IPersistStreamInit*)          &(x)->lpPersistStreamInitVtbl)
169 #define CLASSINFO(x)    ((IProvideClassInfo2*)          &(x)->lpProvideClassInfoVtbl)
170 #define CONPTCONT(x)    ((IConnectionPointContainer*)   &(x)->lpConnectionPointContainerVtbl)
171 #define VIEWOBJ(x)      ((IViewObject*)                 &(x)->lpViewObjectVtbl);
172 #define VIEWOBJ2(x)     ((IViewObject2*)                &(x)->lpViewObjectVtbl);
173 #define ACTIVEOBJ(x)    ((IOleInPlaceActiveObject*)     &(x)->lpOleInPlaceActiveObjectVtbl)
174 #define OLECMD(x)       ((IOleCommandTarget*)           &(x)->lpOleCommandTargetVtbl)
175 #define HLINKFRAME(x)   ((IHlinkFrame*)                 &(x)->lpHlinkFrameVtbl)
176
177 #define CLIENTSITE(x)   ((IOleClientSite*)              &(x)->lpOleClientSiteVtbl)
178 #define INPLACESITE(x)  ((IOleInPlaceSite*)             &(x)->lpOleInPlaceSiteVtbl)
179 #define DOCHOSTUI(x)    ((IDocHostUIHandler*)           &(x)->lpDocHostUIHandlerVtbl)
180 #define DOCHOSTUI2(x)   ((IDocHostUIHandler2*)          &(x)->lpDocHostUIHandlerVtbl)
181 #define DOCSITE(x)      ((IOleDocumentSite*)            &(x)->lpOleDocumentSiteVtbl)
182 #define CLDISP(x)       ((IDispatch*)                   &(x)->lpDispatchVtbl)
183 #define SERVPROV(x)     ((IServiceProvider*)            &(x)->lpServiceProviderVtbl)
184
185 #define INPLACEFRAME(x) ((IOleInPlaceFrame*)            &(x)->lpOleInPlaceFrameVtbl)
186
187 void WebBrowser_OleObject_Init(WebBrowser*);
188 void WebBrowser_ViewObject_Init(WebBrowser*);
189 void WebBrowser_Persist_Init(WebBrowser*);
190 void WebBrowser_ClassInfo_Init(WebBrowser*);
191 void WebBrowser_HlinkFrame_Init(WebBrowser*);
192
193 void WebBrowser_OleObject_Destroy(WebBrowser*);
194
195 void DocHost_Init(DocHost*,IDispatch*);
196 void DocHost_ClientSite_Init(DocHost*);
197 void DocHost_Frame_Init(DocHost*);
198
199 void DocHost_Release(DocHost*);
200 void DocHost_ClientSite_Release(DocHost*);
201
202 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
203 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
204
205 HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
206 HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
207
208 void create_doc_view_hwnd(DocHost*);
209 void deactivate_document(DocHost*);
210 void object_available(DocHost*);
211 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
212 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
213 HRESULT go_home(DocHost*);
214
215 #define WM_DOCHOSTTASK (WM_USER+0x300)
216 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
217 LRESULT  process_dochost_task(DocHost*,LPARAM);
218
219 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
220 void InternetExplorer_WebBrowser_Init(InternetExplorer*);
221
222 HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
223
224 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
225
226 /**********************************************************************
227  * Dll lifetime tracking declaration for shdocvw.dll
228  */
229 extern LONG SHDOCVW_refCount;
230 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
231 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
232
233 extern HINSTANCE shdocvw_hinstance;
234 extern void register_iewindow_class(void);
235 extern void unregister_iewindow_class(void);
236
237 HRESULT register_class_object(BOOL);
238 HRESULT get_typeinfo(ITypeInfo**);
239 DWORD register_iexplore(BOOL);
240
241 /* memory allocation functions */
242
243 static inline void *heap_alloc(size_t len)
244 {
245     return HeapAlloc(GetProcessHeap(), 0, len);
246 }
247
248 static inline void *heap_realloc(void *mem, size_t len)
249 {
250     return HeapReAlloc(GetProcessHeap(), 0, mem, len);
251 }
252
253 static inline BOOL heap_free(void *mem)
254 {
255     return HeapFree(GetProcessHeap(), 0, mem);
256 }
257
258 static inline LPWSTR heap_strdupW(LPCWSTR str)
259 {
260     LPWSTR ret = NULL;
261
262     if(str) {
263         DWORD size;
264
265         size = (strlenW(str)+1)*sizeof(WCHAR);
266         ret = heap_alloc(size);
267         memcpy(ret, str, size);
268     }
269
270     return ret;
271 }
272
273 #endif /* __WINE_SHDOCVW_H */