msi: Free the column info data when updating the table column info.
[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 IPropertyNotifySinkVtbl *lpIPropertyNotifySinkVtbl;
82     const IServiceProviderVtbl    *lpServiceProviderVtbl;
83
84     /* Interfaces of InPlaceFrame object */
85     const IOleInPlaceFrameVtbl          *lpOleInPlaceFrameVtbl;
86
87     IDispatch *disp;
88
89     IDispatch *client_disp;
90     IDocHostUIHandler *hostui;
91     IOleInPlaceFrame *frame;
92
93     IUnknown *document;
94     IOleDocumentView *view;
95
96     HWND hwnd;
97     HWND frame_hwnd;
98
99     LPOLESTR url;
100
101     VARIANT_BOOL silent;
102     VARIANT_BOOL offline;
103     VARIANT_BOOL busy;
104
105     READYSTATE ready_state;
106     DWORD prop_notif_cookie;
107     BOOL is_prop_notif;
108
109     ConnectionPointContainer cps;
110 };
111
112 struct WebBrowser {
113     /* Interfaces available via WebBrowser object */
114
115     const IWebBrowser2Vtbl              *lpWebBrowser2Vtbl;
116     const IOleObjectVtbl                *lpOleObjectVtbl;
117     const IOleInPlaceObjectVtbl         *lpOleInPlaceObjectVtbl;
118     const IOleControlVtbl               *lpOleControlVtbl;
119     const IPersistStorageVtbl           *lpPersistStorageVtbl;
120     const IPersistMemoryVtbl            *lpPersistMemoryVtbl;
121     const IPersistStreamInitVtbl        *lpPersistStreamInitVtbl;
122     const IProvideClassInfo2Vtbl        *lpProvideClassInfoVtbl;
123     const IViewObject2Vtbl              *lpViewObjectVtbl;
124     const IOleInPlaceActiveObjectVtbl   *lpOleInPlaceActiveObjectVtbl;
125     const IOleCommandTargetVtbl         *lpOleCommandTargetVtbl;
126     const IHlinkFrameVtbl               *lpHlinkFrameVtbl;
127     const IServiceProviderVtbl          *lpServiceProviderVtbl;
128
129     LONG ref;
130
131     INT version;
132
133     IOleClientSite *client;
134     IOleContainer *container;
135     IOleInPlaceSite *inplace;
136
137     /* window context */
138
139     HWND frame_hwnd;
140     IOleInPlaceUIWindow *uiwindow;
141     RECT pos_rect;
142     RECT clip_rect;
143     OLEINPLACEFRAMEINFO frameinfo;
144     SIZEL extent;
145
146     HWND shell_embedding_hwnd;
147
148     VARIANT_BOOL register_browser;
149     VARIANT_BOOL visible;
150     VARIANT_BOOL menu_bar;
151     VARIANT_BOOL address_bar;
152     VARIANT_BOOL status_bar;
153     VARIANT_BOOL tool_bar;
154     VARIANT_BOOL full_screen;
155     VARIANT_BOOL theater_mode;
156
157     DocHost doc_host;
158 };
159
160 struct InternetExplorer {
161     const IWebBrowser2Vtbl *lpWebBrowser2Vtbl;
162
163     LONG ref;
164
165     HWND frame_hwnd;
166
167     DocHost doc_host;
168 };
169
170 #define WEBBROWSER(x)   ((IWebBrowser*)                 &(x)->lpWebBrowser2Vtbl)
171 #define WEBBROWSER2(x)  ((IWebBrowser2*)                &(x)->lpWebBrowser2Vtbl)
172 #define OLEOBJ(x)       ((IOleObject*)                  &(x)->lpOleObjectVtbl)
173 #define INPLACEOBJ(x)   ((IOleInPlaceObject*)           &(x)->lpOleInPlaceObjectVtbl)
174 #define CONTROL(x)      ((IOleControl*)                 &(x)->lpOleControlVtbl)
175 #define PERSTORAGE(x)   ((IPersistStorage*)             &(x)->lpPersistStorageVtbl)
176 #define PERMEMORY(x)    ((IPersistMemory*)              &(x)->lpPersistMemoryVtbl)
177 #define PERSTRINIT(x)   ((IPersistStreamInit*)          &(x)->lpPersistStreamInitVtbl)
178 #define CLASSINFO(x)    ((IProvideClassInfo2*)          &(x)->lpProvideClassInfoVtbl)
179 #define CONPTCONT(x)    ((IConnectionPointContainer*)   &(x)->lpConnectionPointContainerVtbl)
180 #define VIEWOBJ(x)      ((IViewObject*)                 &(x)->lpViewObjectVtbl);
181 #define VIEWOBJ2(x)     ((IViewObject2*)                &(x)->lpViewObjectVtbl);
182 #define ACTIVEOBJ(x)    ((IOleInPlaceActiveObject*)     &(x)->lpOleInPlaceActiveObjectVtbl)
183 #define OLECMD(x)       ((IOleCommandTarget*)           &(x)->lpOleCommandTargetVtbl)
184 #define HLINKFRAME(x)   ((IHlinkFrame*)                 &(x)->lpHlinkFrameVtbl)
185
186 #define CLIENTSITE(x)   ((IOleClientSite*)              &(x)->lpOleClientSiteVtbl)
187 #define INPLACESITE(x)  ((IOleInPlaceSite*)             &(x)->lpOleInPlaceSiteVtbl)
188 #define DOCHOSTUI(x)    ((IDocHostUIHandler*)           &(x)->lpDocHostUIHandlerVtbl)
189 #define DOCHOSTUI2(x)   ((IDocHostUIHandler2*)          &(x)->lpDocHostUIHandlerVtbl)
190 #define DOCSITE(x)      ((IOleDocumentSite*)            &(x)->lpOleDocumentSiteVtbl)
191 #define CLDISP(x)       ((IDispatch*)                   &(x)->lpDispatchVtbl)
192 #define PROPNOTIF(x)    ((IPropertyNotifySink*)         &(x)->lpIPropertyNotifySinkVtbl)
193 #define SERVPROV(x)     ((IServiceProvider*)            &(x)->lpServiceProviderVtbl)
194
195 #define INPLACEFRAME(x) ((IOleInPlaceFrame*)            &(x)->lpOleInPlaceFrameVtbl)
196
197 void WebBrowser_OleObject_Init(WebBrowser*);
198 void WebBrowser_ViewObject_Init(WebBrowser*);
199 void WebBrowser_Persist_Init(WebBrowser*);
200 void WebBrowser_ClassInfo_Init(WebBrowser*);
201 void WebBrowser_HlinkFrame_Init(WebBrowser*);
202
203 void WebBrowser_OleObject_Destroy(WebBrowser*);
204
205 void DocHost_Init(DocHost*,IDispatch*);
206 void DocHost_ClientSite_Init(DocHost*);
207 void DocHost_Frame_Init(DocHost*);
208
209 void DocHost_Release(DocHost*);
210 void DocHost_ClientSite_Release(DocHost*);
211
212 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
213 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
214
215 HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
216 HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
217
218 void create_doc_view_hwnd(DocHost*);
219 void deactivate_document(DocHost*);
220 HRESULT dochost_object_available(DocHost*,IUnknown*);
221 void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
222 HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
223 HRESULT go_home(DocHost*);
224
225 #define WM_DOCHOSTTASK (WM_USER+0x300)
226 void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
227 LRESULT  process_dochost_task(DocHost*,LPARAM);
228
229 HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
230 void InternetExplorer_WebBrowser_Init(InternetExplorer*);
231
232 HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
233
234 HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);
235
236 HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);
237
238 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
239
240 /**********************************************************************
241  * Dll lifetime tracking declaration for shdocvw.dll
242  */
243 extern LONG SHDOCVW_refCount;
244 static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
245 static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
246
247 extern HINSTANCE shdocvw_hinstance;
248 extern void register_iewindow_class(void);
249 extern void unregister_iewindow_class(void);
250
251 HRESULT register_class_object(BOOL);
252 HRESULT get_typeinfo(ITypeInfo**);
253 DWORD register_iexplore(BOOL);
254
255 const char *debugstr_variant(const VARIANT*);
256
257 /* memory allocation functions */
258
259 static inline void *heap_alloc(size_t len)
260 {
261     return HeapAlloc(GetProcessHeap(), 0, len);
262 }
263
264 static inline void *heap_realloc(void *mem, size_t len)
265 {
266     return HeapReAlloc(GetProcessHeap(), 0, mem, len);
267 }
268
269 static inline BOOL heap_free(void *mem)
270 {
271     return HeapFree(GetProcessHeap(), 0, mem);
272 }
273
274 static inline LPWSTR heap_strdupW(LPCWSTR str)
275 {
276     LPWSTR ret = NULL;
277
278     if(str) {
279         DWORD size;
280
281         size = (strlenW(str)+1)*sizeof(WCHAR);
282         ret = heap_alloc(size);
283         memcpy(ret, str, size);
284     }
285
286     return ret;
287 }
288
289 static inline LPWSTR co_strdupW(LPCWSTR str)
290 {
291     WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
292     if (ret)
293         lstrcpyW(ret, str);
294     return ret;
295 }
296
297 static inline LPWSTR co_strdupAtoW(LPCSTR str)
298 {
299     INT len;
300     WCHAR *ret;
301     len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
302     ret = CoTaskMemAlloc(len*sizeof(WCHAR));
303     if (ret)
304         MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
305     return ret;
306 }
307
308 static inline LPSTR co_strdupWtoA(LPCWSTR str)
309 {
310     INT len;
311     CHAR *ret;
312     len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
313     ret = CoTaskMemAlloc(len);
314     if (ret)
315         WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
316     return ret;
317 }
318
319 #endif /* __WINE_SHDOCVW_H */