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