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