ntdll: Increase the buffer size dynamically for relay debug lists.
[wine] / dlls / mshtml / mshtml_private.h
1 /*
2  * Copyright 2005-2006 Jacek Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "wingdi.h"
20 #include "docobj.h"
21 #include "mshtml.h"
22 #include "mshtmhst.h"
23 #include "hlink.h"
24
25 #include "wine/list.h"
26
27 #ifdef INIT_GUID
28 #include "initguid.h"
29 #endif
30
31 #include "nsiface.h"
32
33 #define GENERATE_MSHTML_NS_FAILURE(code) \
34     ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
35
36 #define NS_OK                     ((nsresult)0x00000000L)
37 #define NS_ERROR_FAILURE          ((nsresult)0x80004005L)
38 #define NS_NOINTERFACE            ((nsresult)0x80004002L)
39 #define NS_ERROR_NOT_IMPLEMENTED  ((nsresult)0x80004001L)
40 #define NS_ERROR_INVALID_ARG      ((nsresult)0x80070057L) 
41 #define NS_ERROR_UNEXPECTED       ((nsresult)0x8000ffffL)
42 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
43
44 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
45
46 #define NS_FAILED(res) ((res) & 0x80000000)
47 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
48
49 #define NSAPI WINAPI
50
51 #define MSHTML_E_NODOC    0x800a025c
52
53 typedef struct HTMLDOMNode HTMLDOMNode;
54 typedef struct ConnectionPoint ConnectionPoint;
55 typedef struct BSCallback BSCallback;
56
57 typedef struct {
58     const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
59
60     LONG ref;
61
62     HTMLDocument *doc;
63     nsIDOMWindow *nswindow;
64
65     struct list entry;
66 } HTMLWindow;
67
68 typedef enum {
69     UNKNOWN_USERMODE,
70     BROWSEMODE,
71     EDITMODE        
72 } USERMODE;
73
74 typedef struct {
75     const IConnectionPointContainerVtbl  *lpConnectionPointContainerVtbl;
76
77     ConnectionPoint *cp_list;
78     IUnknown *outer;
79 } ConnectionPointContainer;
80
81 struct ConnectionPoint {
82     const IConnectionPointVtbl *lpConnectionPointVtbl;
83
84     IConnectionPointContainer *container;
85
86     union {
87         IUnknown *unk;
88         IDispatch *disp;
89         IPropertyNotifySink *propnotif;
90     } *sinks;
91     DWORD sinks_size;
92
93     const IID *iid;
94
95     ConnectionPoint *next;
96 };
97
98 typedef struct {
99     const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
100
101     LONG ref;
102
103     HTMLDocument *doc;
104 } HTMLOptionElementFactory;
105
106 struct HTMLDocument {
107     const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
108     const IHTMLDocument3Vtbl              *lpHTMLDocument3Vtbl;
109     const IHTMLDocument4Vtbl              *lpHTMLDocument4Vtbl;
110     const IHTMLDocument5Vtbl              *lpHTMLDocument5Vtbl;
111     const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
112     const IPersistFileVtbl                *lpPersistFileVtbl;
113     const IMonikerPropVtbl                *lpMonikerPropVtbl;
114     const IOleObjectVtbl                  *lpOleObjectVtbl;
115     const IOleDocumentVtbl                *lpOleDocumentVtbl;
116     const IOleDocumentViewVtbl            *lpOleDocumentViewVtbl;
117     const IOleInPlaceActiveObjectVtbl     *lpOleInPlaceActiveObjectVtbl;
118     const IViewObject2Vtbl                *lpViewObject2Vtbl;
119     const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
120     const IServiceProviderVtbl            *lpServiceProviderVtbl;
121     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
122     const IOleControlVtbl                 *lpOleControlVtbl;
123     const IHlinkTargetVtbl                *lpHlinkTargetVtbl;
124     const IPersistStreamInitVtbl          *lpPersistStreamInitVtbl;
125     const ICustomDocVtbl                  *lpCustomDocVtbl;
126
127     LONG ref;
128
129     NSContainer *nscontainer;
130     HTMLWindow *window;
131
132     IOleClientSite *client;
133     IDocHostUIHandler *hostui;
134     IOleInPlaceSite *ipsite;
135     IOleInPlaceFrame *frame;
136     IOleInPlaceUIWindow *ip_window;
137
138     IOleUndoManager *undomgr;
139
140     BSCallback *bscallback;
141     IMoniker *mon;
142     LPOLESTR url;
143     struct list bindings;
144
145     HWND hwnd;
146     HWND tooltips_hwnd;
147
148     DOCHOSTUIINFO hostinfo;
149
150     USERMODE usermode;
151     READYSTATE readystate;
152     BOOL in_place_active;
153     BOOL ui_active;
154     BOOL window_active;
155     BOOL has_key_path;
156     BOOL container_locked;
157     BOOL focus;
158
159     DWORD update;
160
161     ConnectionPointContainer cp_container;
162     ConnectionPoint cp_htmldocevents;
163     ConnectionPoint cp_htmldocevents2;
164     ConnectionPoint cp_propnotif;
165
166     HTMLOptionElementFactory *option_factory;
167
168     struct list selection_list;
169     struct list range_list;
170
171     HTMLDOMNode *nodes;
172 };
173
174 typedef struct {
175     const nsIDOMEventListenerVtbl      *lpDOMEventListenerVtbl;
176     NSContainer *This;
177 } nsEventListener;
178
179 struct NSContainer {
180     const nsIWebBrowserChromeVtbl       *lpWebBrowserChromeVtbl;
181     const nsIContextMenuListenerVtbl    *lpContextMenuListenerVtbl;
182     const nsIURIContentListenerVtbl     *lpURIContentListenerVtbl;
183     const nsIEmbeddingSiteWindowVtbl    *lpEmbeddingSiteWindowVtbl;
184     const nsITooltipListenerVtbl        *lpTooltipListenerVtbl;
185     const nsIInterfaceRequestorVtbl     *lpInterfaceRequestorVtbl;
186     const nsIWeakReferenceVtbl          *lpWeakReferenceVtbl;
187     const nsISupportsWeakReferenceVtbl  *lpSupportsWeakReferenceVtbl;
188
189     nsEventListener blur_listener;
190     nsEventListener focus_listener;
191     nsEventListener keypress_listener;
192     nsEventListener load_listener;
193
194     nsIWebBrowser *webbrowser;
195     nsIWebNavigation *navigation;
196     nsIBaseWindow *window;
197     nsIWebBrowserFocus *focus;
198
199     nsIEditor *editor;
200     nsIController *editor_controller;
201
202     LONG ref;
203
204     NSContainer *parent;
205     HTMLDocument *doc;
206
207     nsIURIContentListener *content_listener;
208
209     HWND hwnd;
210
211     BSCallback *bscallback; /* hack */
212     HWND reset_focus; /* hack */
213 };
214
215 typedef struct {
216     const nsIHttpChannelVtbl *lpHttpChannelVtbl;
217     const nsIUploadChannelVtbl *lpUploadChannelVtbl;
218
219     LONG ref;
220
221     nsIChannel *channel;
222     nsIHttpChannel *http_channel;
223     nsIWineURI *uri;
224     nsIInputStream *post_data_stream;
225     nsILoadGroup *load_group;
226     nsIInterfaceRequestor *notif_callback;
227     nsLoadFlags load_flags;
228     nsIURI *original_uri;
229     char *content;
230     char *charset;
231 } nsChannel;
232
233 typedef struct {
234     const nsIInputStreamVtbl *lpInputStreamVtbl;
235
236     LONG ref;
237
238     char buf[1024];
239     DWORD buf_size;
240 } nsProtocolStream;
241
242 struct BSCallback {
243     const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
244     const IServiceProviderVtbl    *lpServiceProviderVtbl;
245     const IHttpNegotiate2Vtbl     *lpHttpNegotiate2Vtbl;
246     const IInternetBindInfoVtbl   *lpInternetBindInfoVtbl;
247
248     LONG ref;
249
250     LPWSTR headers;
251     HGLOBAL post_data;
252     ULONG post_data_len;
253     ULONG readed;
254
255     nsChannel *nschannel;
256     nsIStreamListener *nslistener;
257     nsISupports *nscontext;
258
259     IMoniker *mon;
260     IBinding *binding;
261
262     HTMLDocument *doc;
263
264     nsProtocolStream *nsstream;
265
266     struct list entry;
267 };
268
269 typedef struct {
270     HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
271     void (*destructor)(HTMLDOMNode*);
272 } NodeImplVtbl;
273
274 struct HTMLDOMNode {
275     const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
276     const NodeImplVtbl *vtbl;
277
278     LONG ref;
279
280     nsIDOMNode *nsnode;
281     HTMLDocument *doc;
282
283     HTMLDOMNode *next;
284 };
285
286 typedef struct {
287     HTMLDOMNode node;
288     ConnectionPointContainer cp_container;
289
290     const IHTMLElementVtbl   *lpHTMLElementVtbl;
291     const IHTMLElement2Vtbl  *lpHTMLElement2Vtbl;
292
293     nsIDOMHTMLElement *nselem;
294 } HTMLElement;
295
296 typedef struct {
297     HTMLElement element;
298
299     const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
300
301     ConnectionPoint cp;
302 } HTMLTextContainer;
303
304 #define HTMLWINDOW2(x)   ((IHTMLWindow2*)                 &(x)->lpHTMLWindow2Vtbl)
305
306 #define HTMLDOC(x)       ((IHTMLDocument2*)               &(x)->lpHTMLDocument2Vtbl)
307 #define HTMLDOC3(x)      ((IHTMLDocument3*)               &(x)->lpHTMLDocument3Vtbl)
308 #define HTMLDOC4(x)      ((IHTMLDocument4*)               &(x)->lpHTMLDocument4Vtbl)
309 #define HTMLDOC5(x)      ((IHTMLDocument5*)               &(x)->lpHTMLDocument5Vtbl)
310 #define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
311 #define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
312 #define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
313 #define MONPROP(x)       ((IMonikerProp*)                 &(x)->lpMonikerPropVtbl)
314 #define OLEOBJ(x)        ((IOleObject*)                   &(x)->lpOleObjectVtbl)
315 #define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
316 #define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
317 #define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
318 #define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
319 #define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObject2Vtbl)
320 #define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObject2Vtbl)
321 #define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
322 #define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
323 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
324 #define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
325 #define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
326 #define HLNKTARGET(x)    ((IHlinkTarget*)                 &(x)->lpHlinkTargetVtbl)
327 #define CONPTCONT(x)     ((IConnectionPointContainer*)    &(x)->lpConnectionPointContainerVtbl)
328 #define PERSTRINIT(x)    ((IPersistStreamInit*)           &(x)->lpPersistStreamInitVtbl)
329 #define CUSTOMDOC(x)     ((ICustomDoc*)                   &(x)->lpCustomDocVtbl)
330
331 #define NSWBCHROME(x)    ((nsIWebBrowserChrome*)          &(x)->lpWebBrowserChromeVtbl)
332 #define NSCML(x)         ((nsIContextMenuListener*)       &(x)->lpContextMenuListenerVtbl)
333 #define NSURICL(x)       ((nsIURIContentListener*)        &(x)->lpURIContentListenerVtbl)
334 #define NSEMBWNDS(x)     ((nsIEmbeddingSiteWindow*)       &(x)->lpEmbeddingSiteWindowVtbl)
335 #define NSIFACEREQ(x)    ((nsIInterfaceRequestor*)        &(x)->lpInterfaceRequestorVtbl)
336 #define NSTOOLTIP(x)     ((nsITooltipListener*)           &(x)->lpTooltipListenerVtbl)
337 #define NSEVENTLIST(x)   ((nsIDOMEventListener*)          &(x)->lpDOMEventListenerVtbl)
338 #define NSWEAKREF(x)     ((nsIWeakReference*)             &(x)->lpWeakReferenceVtbl)
339 #define NSSUPWEAKREF(x)  ((nsISupportsWeakReference*)     &(x)->lpSupportsWeakReferenceVtbl)
340
341 #define NSCHANNEL(x)     ((nsIChannel*)        &(x)->lpHttpChannelVtbl)
342 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*)    &(x)->lpHttpChannelVtbl)
343 #define NSUPCHANNEL(x)   ((nsIUploadChannel*)  &(x)->lpUploadChannelVtbl)
344
345 #define HTTPNEG(x)       ((IHttpNegotiate2*)              &(x)->lpHttpNegotiate2Vtbl)
346 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
347 #define BINDINFO(x)      ((IInternetBindInfo*)            &(x)->lpInternetBindInfoVtbl);
348
349 #define HTMLELEM(x)      ((IHTMLElement*)                 &(x)->lpHTMLElementVtbl)
350 #define HTMLELEM2(x)     ((IHTMLElement2*)                &(x)->lpHTMLElement2Vtbl)
351 #define HTMLDOMNODE(x)   ((IHTMLDOMNode*)                 &(x)->lpHTMLDOMNodeVtbl)
352
353 #define HTMLTEXTCONT(x)  ((IHTMLTextContainer*)           &(x)->lpHTMLTextContainerVtbl)
354
355 #define HTMLOPTFACTORY(x)  ((IHTMLOptionElementFactory*)  &(x)->lpHTMLOptionElementFactoryVtbl)
356
357 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
358 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
359
360 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
361 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
362
363 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
364 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
365 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
366 void setup_nswindow(HTMLWindow*);
367
368 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
369 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
370 void HTMLDocument_Persist_Init(HTMLDocument*);
371 void HTMLDocument_OleCmd_Init(HTMLDocument*);
372 void HTMLDocument_OleObj_Init(HTMLDocument*);
373 void HTMLDocument_View_Init(HTMLDocument*);
374 void HTMLDocument_Window_Init(HTMLDocument*);
375 void HTMLDocument_Service_Init(HTMLDocument*);
376 void HTMLDocument_Hlink_Init(HTMLDocument*);
377
378 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
379 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
380 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
381
382 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
383 void NSContainer_Release(NSContainer*);
384
385 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
386 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
387 void notif_focus(HTMLDocument*);
388
389 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
390 void hide_tooltip(HTMLDocument*);
391 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
392
393 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
394
395 BOOL load_gecko(BOOL);
396 void close_gecko(void);
397 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
398 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
399 BOOL install_wine_gecko(BOOL);
400
401 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
402
403 void call_property_onchanged(ConnectionPoint*,DISPID);
404 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
405
406 void *nsalloc(size_t);
407 void nsfree(void*);
408
409 void nsACString_Init(nsACString*,const char*);
410 void nsACString_SetData(nsACString*,const char*);
411 PRUint32 nsACString_GetData(const nsACString*,const char**);
412 void nsACString_Finish(nsACString*);
413
414 void nsAString_Init(nsAString*,const PRUnichar*);
415 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
416 void nsAString_Finish(nsAString*);
417
418 nsIInputStream *create_nsstream(const char*,PRInt32);
419 nsICommandParams *create_nscommand_params(void);
420 nsIMutableArray *create_nsarray(void);
421 nsIWritableVariant *create_nsvariant(void);
422 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
423 void get_editor_controller(NSContainer*);
424 void init_nsevents(NSContainer*);
425 nsresult get_nsinterface(nsISupports*,REFIID,void**);
426
427 BSCallback *create_bscallback(IMoniker*);
428 HRESULT start_binding(HTMLDocument*,BSCallback*);
429 HRESULT load_stream(BSCallback*,IStream*);
430 void set_document_bscallback(HTMLDocument*,BSCallback*);
431 void set_current_mon(HTMLDocument*,IMoniker*);
432
433 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
434 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
435 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
436 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
437 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
438
439 void detach_selection(HTMLDocument*);
440 void detach_ranges(HTMLDocument*);
441
442 HTMLElement *HTMLElement_Create(nsIDOMNode*);
443 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
444 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
445 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
446 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
447 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
448 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
449 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
450
451 void HTMLElement_Init(HTMLElement*);
452 void HTMLElement2_Init(HTMLElement*);
453 void HTMLTextContainer_Init(HTMLTextContainer*);
454
455 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
456 void HTMLDOMNode_destructor(HTMLDOMNode*);
457
458 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
459 void HTMLElement_destructor(HTMLDOMNode*);
460
461 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
462 void release_nodes(HTMLDocument*);
463
464 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
465
466 /* commands */
467 typedef struct {
468     DWORD id;
469     HRESULT (*query)(HTMLDocument*,OLECMD*);
470     HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
471 } cmdtable_t;
472
473 extern const cmdtable_t editmode_cmds[];
474
475 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
476
477 /* timer */
478 #define UPDATE_UI       0x0001
479 #define UPDATE_TITLE    0x0002
480
481 void update_doc(HTMLDocument *This, DWORD flags);
482 void update_title(HTMLDocument*);
483
484 /* editor */
485 void init_editor(HTMLDocument*);
486 void set_ns_editmode(NSContainer*);
487 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
488 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
489 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
490 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
491 void handle_edit_load(HTMLDocument *This);
492 HRESULT editor_is_dirty(HTMLDocument*);
493
494 extern DWORD mshtml_tls;
495
496 typedef struct task_t {
497     HTMLDocument *doc;
498
499     enum {
500         TASK_SETDOWNLOADSTATE,
501         TASK_PARSECOMPLETE,
502         TASK_SETPROGRESS,
503         TASK_START_BINDING
504     } task_id;
505
506     BSCallback *bscallback;
507
508     struct task_t *next;
509 } task_t;
510
511 typedef struct {
512     HWND thread_hwnd;
513     task_t *task_queue_head;
514     task_t *task_queue_tail;
515 } thread_data_t;
516
517 thread_data_t *get_thread_data(BOOL);
518 HWND get_thread_hwnd(void);
519 void push_task(task_t*);
520 void remove_doc_tasks(const HTMLDocument*);
521
522 /* typelibs */
523 enum tid_t {
524     IHTMLWindow2_tid,
525     LAST_tid
526 };
527
528 HRESULT get_typeinfo(enum tid_t, ITypeInfo**);
529
530 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
531 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
532 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
533 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
534 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
535
536 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
537
538 extern LONG module_ref;
539 #define LOCK_MODULE()   InterlockedIncrement(&module_ref)
540 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
541
542 /* memory allocation functions */
543
544 static inline void *heap_alloc(size_t len)
545 {
546     return HeapAlloc(GetProcessHeap(), 0, len);
547 }
548
549 static inline void *heap_alloc_zero(size_t len)
550 {
551     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
552 }
553
554 static inline void *heap_realloc(void *mem, size_t len)
555 {
556     return HeapReAlloc(GetProcessHeap(), 0, mem, len);
557 }
558
559 static inline BOOL heap_free(void *mem)
560 {
561     return HeapFree(GetProcessHeap(), 0, mem);
562 }
563
564 HINSTANCE get_shdoclc(void);
565
566 extern HINSTANCE hInst;