Added support for shadowing of element pseudo-variables.
[wine/multimedia.git] / dlls / mshtml / mshtml_private.h
blob3376084d8070621a57e61be7de3d63e8a3eeec61
1 /*
2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
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.
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.
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
19 #include "wingdi.h"
20 #include "docobj.h"
21 #include "docobjectservice.h"
22 #include "comcat.h"
23 #include "mshtml.h"
24 #include "mshtmhst.h"
25 #include "hlink.h"
26 #include "perhist.h"
27 #include "dispex.h"
28 #include "objsafe.h"
29 #include "htiframe.h"
30 #include "tlogstg.h"
32 #include "wine/list.h"
33 #include "wine/unicode.h"
35 #ifdef INIT_GUID
36 #include "initguid.h"
37 #endif
39 #include "nsiface.h"
41 #define NS_ERROR_GENERATE_FAILURE(module,code) \
42 ((nsresult) (((PRUint32)(1<<31)) | ((PRUint32)(module+0x45)<<16) | ((PRUint32)(code))))
44 #define NS_OK ((nsresult)0x00000000L)
45 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
46 #define NS_ERROR_OUT_OF_MEMORY ((nsresult)0x8007000EL)
47 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
48 #define NS_NOINTERFACE ((nsresult)0x80004002L)
49 #define NS_ERROR_INVALID_POINTER ((nsresult)0x80004003L)
50 #define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
51 #define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
52 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
53 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
55 #define NS_ERROR_MODULE_NETWORK 6
57 #define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
58 #define NS_ERROR_UNKNOWN_PROTOCOL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 18)
60 #define NS_FAILED(res) ((res) & 0x80000000)
61 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
63 #define NSAPI WINAPI
65 #define MSHTML_E_NODOC 0x800a025c
67 typedef struct HTMLDOMNode HTMLDOMNode;
68 typedef struct ConnectionPoint ConnectionPoint;
69 typedef struct BSCallback BSCallback;
70 typedef struct event_target_t event_target_t;
72 #define TID_LIST \
73 XIID(NULL) \
74 XDIID(DispCEventObj) \
75 XDIID(DispCPlugins) \
76 XDIID(DispDOMChildrenCollection) \
77 XDIID(DispHTMLAnchorElement) \
78 XDIID(DispHTMLAttributeCollection) \
79 XDIID(DispHTMLBody) \
80 XDIID(DispHTMLCommentElement) \
81 XDIID(DispHTMLCurrentStyle) \
82 XDIID(DispHTMLDocument) \
83 XDIID(DispHTMLDOMAttribute) \
84 XDIID(DispHTMLDOMTextNode) \
85 XDIID(DispHTMLElementCollection) \
86 XDIID(DispHTMLEmbed) \
87 XDIID(DispHTMLFormElement) \
88 XDIID(DispHTMLGenericElement) \
89 XDIID(DispHTMLFrameElement) \
90 XDIID(DispHTMLHeadElement) \
91 XDIID(DispHTMLIFrame) \
92 XDIID(DispHTMLImg) \
93 XDIID(DispHTMLInputElement) \
94 XDIID(DispHTMLLocation) \
95 XDIID(DispHTMLMetaElement) \
96 XDIID(DispHTMLNavigator) \
97 XDIID(DispHTMLObjectElement) \
98 XDIID(DispHTMLOptionElement) \
99 XDIID(DispHTMLScreen) \
100 XDIID(DispHTMLScriptElement) \
101 XDIID(DispHTMLSelectElement) \
102 XDIID(DispHTMLStyle) \
103 XDIID(DispHTMLStyleElement) \
104 XDIID(DispHTMLStyleSheetsCollection) \
105 XDIID(DispHTMLTable) \
106 XDIID(DispHTMLTableCell) \
107 XDIID(DispHTMLTableRow) \
108 XDIID(DispHTMLTextAreaElement) \
109 XDIID(DispHTMLTitleElement) \
110 XDIID(DispHTMLUnknownElement) \
111 XDIID(DispHTMLWindow2) \
112 XDIID(HTMLDocumentEvents) \
113 XIID(IHTMLAnchorElement) \
114 XIID(IHTMLAttributeCollection) \
115 XIID(IHTMLAttributeCollection2) \
116 XIID(IHTMLAttributeCollection3) \
117 XIID(IHTMLBodyElement) \
118 XIID(IHTMLBodyElement2) \
119 XIID(IHTMLCommentElement) \
120 XIID(IHTMLCurrentStyle) \
121 XIID(IHTMLCurrentStyle2) \
122 XIID(IHTMLCurrentStyle3) \
123 XIID(IHTMLCurrentStyle4) \
124 XIID(IHTMLDocument2) \
125 XIID(IHTMLDocument3) \
126 XIID(IHTMLDocument4) \
127 XIID(IHTMLDocument5) \
128 XIID(IHTMLDOMAttribute) \
129 XIID(IHTMLDOMChildrenCollection) \
130 XIID(IHTMLDOMNode) \
131 XIID(IHTMLDOMNode2) \
132 XIID(IHTMLDOMTextNode) \
133 XIID(IHTMLElement) \
134 XIID(IHTMLElement2) \
135 XIID(IHTMLElement3) \
136 XIID(IHTMLElement4) \
137 XIID(IHTMLElementCollection) \
138 XIID(IHTMLEmbedElement) \
139 XIID(IHTMLEventObj) \
140 XIID(IHTMLFiltersCollection) \
141 XIID(IHTMLFormElement) \
142 XIID(IHTMLFrameBase) \
143 XIID(IHTMLFrameBase2) \
144 XIID(IHTMLFrameElement3) \
145 XIID(IHTMLGenericElement) \
146 XIID(IHTMLHeadElement) \
147 XIID(IHTMLIFrameElement) \
148 XIID(IHTMLImageElementFactory) \
149 XIID(IHTMLImgElement) \
150 XIID(IHTMLInputElement) \
151 XIID(IHTMLLocation) \
152 XIID(IHTMLMetaElement) \
153 XIID(IHTMLMimeTypesCollection) \
154 XIID(IHTMLObjectElement) \
155 XIID(IHTMLObjectElement2) \
156 XIID(IHTMLOptionElement) \
157 XIID(IHTMLPluginsCollection) \
158 XIID(IHTMLRect) \
159 XIID(IHTMLScreen) \
160 XIID(IHTMLScriptElement) \
161 XIID(IHTMLSelectElement) \
162 XIID(IHTMLStyle) \
163 XIID(IHTMLStyle2) \
164 XIID(IHTMLStyle3) \
165 XIID(IHTMLStyle4) \
166 XIID(IHTMLStyle5) \
167 XIID(IHTMLStyle6) \
168 XIID(IHTMLStyleElement) \
169 XIID(IHTMLStyleSheetsCollection) \
170 XIID(IHTMLTable) \
171 XIID(IHTMLTable2) \
172 XIID(IHTMLTable3) \
173 XIID(IHTMLTableCell) \
174 XIID(IHTMLTableRow) \
175 XIID(IHTMLTextAreaElement) \
176 XIID(IHTMLTextContainer) \
177 XIID(IHTMLTitleElement) \
178 XIID(IHTMLUniqueName) \
179 XIID(IHTMLWindow2) \
180 XIID(IHTMLWindow3) \
181 XIID(IHTMLWindow4) \
182 XIID(IHTMLWindow6) \
183 XIID(IOmNavigator)
185 typedef enum {
186 #define XIID(iface) iface ## _tid,
187 #define XDIID(iface) iface ## _tid,
188 TID_LIST
189 #undef XIID
190 #undef XDIID
191 LAST_tid
192 } tid_t;
194 typedef struct dispex_data_t dispex_data_t;
195 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
197 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
198 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
199 #define MSHTML_CUSTOM_DISPID_CNT (MSHTML_DISPID_CUSTOM_MAX-MSHTML_DISPID_CUSTOM_MIN)
201 typedef struct DispatchEx DispatchEx;
203 typedef struct {
204 HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
205 HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
206 HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
207 HRESULT (*populate_props)(DispatchEx*);
208 } dispex_static_data_vtbl_t;
210 typedef struct {
211 const dispex_static_data_vtbl_t *vtbl;
212 const tid_t disp_tid;
213 dispex_data_t *data;
214 const tid_t* const iface_tids;
215 } dispex_static_data_t;
217 struct DispatchEx {
218 IDispatchEx IDispatchEx_iface;
220 IUnknown *outer;
222 dispex_static_data_t *data;
223 dispex_dynamic_data_t *dynamic_data;
226 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
227 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
228 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
229 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
230 HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
231 HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN;
232 HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
233 void release_typelib(void) DECLSPEC_HIDDEN;
234 HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
236 typedef struct HTMLWindow HTMLWindow;
237 typedef struct HTMLDocumentNode HTMLDocumentNode;
238 typedef struct HTMLDocumentObj HTMLDocumentObj;
239 typedef struct HTMLFrameBase HTMLFrameBase;
240 typedef struct NSContainer NSContainer;
241 typedef struct HTMLAttributeCollection HTMLAttributeCollection;
243 typedef enum {
244 SCRIPTMODE_GECKO,
245 SCRIPTMODE_ACTIVESCRIPT
246 } SCRIPTMODE;
248 typedef struct ScriptHost ScriptHost;
250 typedef enum {
251 GLOBAL_SCRIPTVAR,
252 GLOBAL_ELEMENTVAR,
253 GLOBAL_DISPEXVAR
254 } global_prop_type_t;
256 typedef struct {
257 global_prop_type_t type;
258 WCHAR *name;
259 ScriptHost *script_host;
260 DISPID id;
261 } global_prop_t;
263 typedef struct {
264 IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
266 LONG ref;
268 HTMLWindow *window;
269 } HTMLOptionElementFactory;
271 typedef struct {
272 DispatchEx dispex;
273 IHTMLImageElementFactory IHTMLImageElementFactory_iface;
275 LONG ref;
277 HTMLWindow *window;
278 } HTMLImageElementFactory;
280 struct HTMLLocation {
281 DispatchEx dispex;
282 IHTMLLocation IHTMLLocation_iface;
284 LONG ref;
286 HTMLWindow *window;
289 typedef struct {
290 HTMLWindow *window;
291 LONG ref;
292 } windowref_t;
294 typedef struct nsChannelBSC nsChannelBSC;
296 struct HTMLWindow {
297 DispatchEx dispex;
298 IHTMLWindow2 IHTMLWindow2_iface;
299 IHTMLWindow3 IHTMLWindow3_iface;
300 IHTMLWindow4 IHTMLWindow4_iface;
301 IHTMLWindow5 IHTMLWindow5_iface;
302 IHTMLWindow6 IHTMLWindow6_iface;
303 IHTMLPrivateWindow IHTMLPrivateWindow_iface;
304 IDispatchEx IDispatchEx_iface;
305 IServiceProvider IServiceProvider_iface;
306 ITravelLogClient ITravelLogClient_iface;
308 LONG ref;
310 windowref_t *window_ref;
311 LONG task_magic;
313 HTMLDocumentNode *doc;
314 HTMLDocumentObj *doc_obj;
315 nsIDOMWindow *nswindow;
316 HTMLWindow *parent;
317 HTMLFrameBase *frame_element;
318 READYSTATE readystate;
320 nsChannelBSC *bscallback;
321 IMoniker *mon;
322 IUri *uri;
323 BSTR url;
325 IHTMLEventObj *event;
327 SCRIPTMODE scriptmode;
328 struct list script_hosts;
330 IInternetSecurityManager *secmgr;
332 HTMLOptionElementFactory *option_factory;
333 HTMLImageElementFactory *image_factory;
334 HTMLLocation *location;
335 IHTMLScreen *screen;
337 global_prop_t *global_props;
338 DWORD global_prop_cnt;
339 DWORD global_prop_size;
341 struct list children;
342 struct list sibling_entry;
343 struct list entry;
346 typedef enum {
347 UNKNOWN_USERMODE,
348 BROWSEMODE,
349 EDITMODE
350 } USERMODE;
352 typedef struct _cp_static_data_t {
353 tid_t tid;
354 void (*on_advise)(IUnknown*,struct _cp_static_data_t*);
355 DWORD id_cnt;
356 DISPID *ids;
357 } cp_static_data_t;
359 typedef struct ConnectionPointContainer {
360 IConnectionPointContainer IConnectionPointContainer_iface;
362 ConnectionPoint *cp_list;
363 IUnknown *outer;
364 struct ConnectionPointContainer *forward_container;
365 } ConnectionPointContainer;
367 struct ConnectionPoint {
368 IConnectionPoint IConnectionPoint_iface;
370 ConnectionPointContainer *container;
372 union {
373 IUnknown *unk;
374 IDispatch *disp;
375 IPropertyNotifySink *propnotif;
376 } *sinks;
377 DWORD sinks_size;
379 const IID *iid;
380 cp_static_data_t *data;
382 ConnectionPoint *next;
385 struct HTMLDocument {
386 IHTMLDocument2 IHTMLDocument2_iface;
387 IHTMLDocument3 IHTMLDocument3_iface;
388 IHTMLDocument4 IHTMLDocument4_iface;
389 IHTMLDocument5 IHTMLDocument5_iface;
390 IHTMLDocument6 IHTMLDocument6_iface;
391 IPersistMoniker IPersistMoniker_iface;
392 IPersistFile IPersistFile_iface;
393 IPersistHistory IPersistHistory_iface;
394 IMonikerProp IMonikerProp_iface;
395 IOleObject IOleObject_iface;
396 IOleDocument IOleDocument_iface;
397 IOleDocumentView IOleDocumentView_iface;
398 IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
399 IViewObjectEx IViewObjectEx_iface;
400 IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
401 IServiceProvider IServiceProvider_iface;
402 IOleCommandTarget IOleCommandTarget_iface;
403 IOleControl IOleControl_iface;
404 IHlinkTarget IHlinkTarget_iface;
405 IPersistStreamInit IPersistStreamInit_iface;
406 IDispatchEx IDispatchEx_iface;
407 ISupportErrorInfo ISupportErrorInfo_iface;
408 IObjectWithSite IObjectWithSite_iface;
409 IOleContainer IOleContainer_iface;
410 IObjectSafety IObjectSafety_iface;
411 IProvideClassInfo IProvideClassInfo_iface;
413 IUnknown *unk_impl;
414 IDispatchEx *dispex;
416 HTMLDocumentObj *doc_obj;
417 HTMLDocumentNode *doc_node;
419 HTMLWindow *window;
421 LONG task_magic;
423 ConnectionPointContainer cp_container;
424 ConnectionPoint cp_htmldocevents;
425 ConnectionPoint cp_htmldocevents2;
426 ConnectionPoint cp_propnotif;
427 ConnectionPoint cp_dispatch;
429 IOleAdviseHolder *advise_holder;
432 static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
434 return IUnknown_QueryInterface(This->unk_impl, riid, ppv);
437 static inline ULONG htmldoc_addref(HTMLDocument *This)
439 return IUnknown_AddRef(This->unk_impl);
442 static inline ULONG htmldoc_release(HTMLDocument *This)
444 return IUnknown_Release(This->unk_impl);
447 struct HTMLDocumentObj {
448 HTMLDocument basedoc;
449 DispatchEx dispex;
450 ICustomDoc ICustomDoc_iface;
451 ITargetContainer ITargetContainer_iface;
453 LONG ref;
455 NSContainer *nscontainer;
457 IOleClientSite *client;
458 IDocHostUIHandler *hostui;
459 BOOL custom_hostui;
460 IOleInPlaceSite *ipsite;
461 IOleInPlaceFrame *frame;
462 IOleInPlaceUIWindow *ip_window;
463 IAdviseSink *view_sink;
464 IDocObjectService *doc_object_service;
466 DOCHOSTUIINFO hostinfo;
468 IOleUndoManager *undomgr;
470 HWND hwnd;
471 HWND tooltips_hwnd;
473 BOOL request_uiactivate;
474 BOOL in_place_active;
475 BOOL ui_active;
476 BOOL window_active;
477 BOOL hostui_setup;
478 BOOL is_webbrowser;
479 BOOL container_locked;
480 BOOL focus;
481 BOOL has_popup;
482 INT download_state;
484 USERMODE usermode;
485 LPWSTR mime;
487 DWORD update;
490 typedef struct nsWeakReference nsWeakReference;
492 struct NSContainer {
493 nsIWebBrowserChrome nsIWebBrowserChrome_iface;
494 nsIContextMenuListener nsIContextMenuListener_iface;
495 nsIURIContentListener nsIURIContentListener_iface;
496 nsIEmbeddingSiteWindow nsIEmbeddingSiteWindow_iface;
497 nsITooltipListener nsITooltipListener_iface;
498 nsIInterfaceRequestor nsIInterfaceRequestor_iface;
499 nsISupportsWeakReference nsISupportsWeakReference_iface;
501 nsIWebBrowser *webbrowser;
502 nsIWebNavigation *navigation;
503 nsIBaseWindow *window;
504 nsIWebBrowserFocus *focus;
506 nsIEditor *editor;
507 nsIController *editor_controller;
509 LONG ref;
511 nsWeakReference *weak_reference;
513 NSContainer *parent;
514 HTMLDocumentObj *doc;
516 nsIURIContentListener *content_listener;
518 HWND hwnd;
521 typedef struct {
522 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
523 void (*destructor)(HTMLDOMNode*);
524 HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
525 HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
526 event_target_t **(*get_event_target)(HTMLDOMNode*);
527 HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
528 HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
529 HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
530 HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
531 HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
532 HRESULT (*get_readystate)(HTMLDOMNode*,BSTR*);
533 HRESULT (*get_dispid)(HTMLDOMNode*,BSTR,DWORD,DISPID*);
534 HRESULT (*invoke)(HTMLDOMNode*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
535 HRESULT (*bind_to_tree)(HTMLDOMNode*);
536 } NodeImplVtbl;
538 struct HTMLDOMNode {
539 DispatchEx dispex;
540 IHTMLDOMNode IHTMLDOMNode_iface;
541 IHTMLDOMNode2 IHTMLDOMNode2_iface;
542 const NodeImplVtbl *vtbl;
544 LONG ref;
546 nsIDOMNode *nsnode;
547 HTMLDocumentNode *doc;
548 event_target_t *event_target;
549 ConnectionPointContainer *cp_container;
551 HTMLDOMNode *next;
554 typedef struct {
555 HTMLDOMNode node;
556 ConnectionPointContainer cp_container;
558 IHTMLElement IHTMLElement_iface;
559 IHTMLElement2 IHTMLElement2_iface;
560 IHTMLElement3 IHTMLElement3_iface;
561 IHTMLElement4 IHTMLElement4_iface;
563 nsIDOMHTMLElement *nselem;
564 HTMLStyle *style;
565 HTMLAttributeCollection *attrs;
566 WCHAR *filter;
567 } HTMLElement;
569 #define HTMLELEMENT_TIDS \
570 IHTMLDOMNode_tid, \
571 IHTMLDOMNode2_tid, \
572 IHTMLElement_tid, \
573 IHTMLElement2_tid, \
574 IHTMLElement3_tid, \
575 IHTMLElement4_tid
577 typedef struct {
578 HTMLElement element;
580 IHTMLTextContainer IHTMLTextContainer_iface;
582 ConnectionPoint cp;
583 } HTMLTextContainer;
585 struct HTMLFrameBase {
586 HTMLElement element;
588 IHTMLFrameBase IHTMLFrameBase_iface;
589 IHTMLFrameBase2 IHTMLFrameBase2_iface;
591 HTMLWindow *content_window;
593 nsIDOMHTMLFrameElement *nsframe;
594 nsIDOMHTMLIFrameElement *nsiframe;
597 typedef struct nsDocumentEventListener nsDocumentEventListener;
599 struct HTMLDocumentNode {
600 HTMLDOMNode node;
601 HTMLDocument basedoc;
603 IInternetHostSecurityManager IInternetHostSecurityManager_iface;
605 nsIDocumentObserver nsIDocumentObserver_iface;
607 LONG ref;
609 nsIDOMHTMLDocument *nsdoc;
610 HTMLDOMNode *nodes;
611 BOOL content_ready;
612 event_target_t *body_event_target;
614 ICatInformation *catmgr;
615 nsDocumentEventListener *nsevent_listener;
616 BOOL *event_vector;
618 WCHAR **elem_vars;
619 unsigned elem_vars_size;
620 unsigned elem_vars_cnt;
622 BOOL skip_mutation_notif;
624 struct list bindings;
625 struct list selection_list;
626 struct list range_list;
627 struct list plugin_hosts;
630 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
631 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
632 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLWindow*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
633 HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
635 HRESULT HTMLWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLWindow*,HTMLWindow**) DECLSPEC_HIDDEN;
636 void update_window_doc(HTMLWindow*) DECLSPEC_HIDDEN;
637 HTMLWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
638 void get_top_window(HTMLWindow*,HTMLWindow**) DECLSPEC_HIDDEN;
639 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*) DECLSPEC_HIDDEN;
640 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLWindow*) DECLSPEC_HIDDEN;
641 HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
642 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
643 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
645 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*) DECLSPEC_HIDDEN;
646 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*) DECLSPEC_HIDDEN;
647 void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN;
648 void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN;
649 void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN;
650 void HTMLDocument_View_Init(HTMLDocument*) DECLSPEC_HIDDEN;
651 void HTMLDocument_Window_Init(HTMLDocument*) DECLSPEC_HIDDEN;
652 void HTMLDocument_Service_Init(HTMLDocument*) DECLSPEC_HIDDEN;
653 void HTMLDocument_Hlink_Init(HTMLDocument*) DECLSPEC_HIDDEN;
655 void TargetContainer_Init(HTMLDocumentObj*) DECLSPEC_HIDDEN;
657 void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*) DECLSPEC_HIDDEN;
659 HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**) DECLSPEC_HIDDEN;
661 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID,cp_static_data_t*) DECLSPEC_HIDDEN;
662 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
663 void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
665 HRESULT create_nscontainer(HTMLDocumentObj*,NSContainer*,NSContainer**) DECLSPEC_HIDDEN;
666 void NSContainer_Release(NSContainer*) DECLSPEC_HIDDEN;
667 nsresult create_chrome_window(nsIWebBrowserChrome*,nsIWebBrowserChrome**) DECLSPEC_HIDDEN;
669 void init_mutation(nsIComponentManager*) DECLSPEC_HIDDEN;
670 void init_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
671 void release_document_mutation(HTMLDocumentNode*) DECLSPEC_HIDDEN;
673 void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL) DECLSPEC_HIDDEN;
674 void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*) DECLSPEC_HIDDEN;
675 void notif_focus(HTMLDocumentObj*) DECLSPEC_HIDDEN;
677 void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
678 void hide_tooltip(HTMLDocumentObj*) DECLSPEC_HIDDEN;
679 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*) DECLSPEC_HIDDEN;
681 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**) DECLSPEC_HIDDEN;
683 BOOL load_gecko(void) DECLSPEC_HIDDEN;
684 void close_gecko(void) DECLSPEC_HIDDEN;
685 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*) DECLSPEC_HIDDEN;
686 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*) DECLSPEC_HIDDEN;
687 void release_nsio(void) DECLSPEC_HIDDEN;
688 BOOL is_gecko_path(const char*) DECLSPEC_HIDDEN;
690 HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*) DECLSPEC_HIDDEN;
691 BOOL compare_ignoring_frag(IUri*,IUri*) DECLSPEC_HIDDEN;
693 HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
694 HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*) DECLSPEC_HIDDEN;
696 void call_property_onchanged(ConnectionPoint*,DISPID) DECLSPEC_HIDDEN;
697 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*) DECLSPEC_HIDDEN;
699 void *nsalloc(size_t) __WINE_ALLOC_SIZE(1) DECLSPEC_HIDDEN;
700 void nsfree(void*) DECLSPEC_HIDDEN;
702 void nsACString_InitDepend(nsACString*,const char*) DECLSPEC_HIDDEN;
703 void nsACString_SetData(nsACString*,const char*) DECLSPEC_HIDDEN;
704 PRUint32 nsACString_GetData(const nsACString*,const char**) DECLSPEC_HIDDEN;
705 void nsACString_Finish(nsACString*) DECLSPEC_HIDDEN;
707 BOOL nsAString_Init(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
708 void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
709 void nsAString_SetData(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
710 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
711 void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
712 HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
714 nsICommandParams *create_nscommand_params(void) DECLSPEC_HIDDEN;
715 HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*) DECLSPEC_HIDDEN;
716 void get_editor_controller(NSContainer*) DECLSPEC_HIDDEN;
717 nsresult get_nsinterface(nsISupports*,REFIID,void**) DECLSPEC_HIDDEN;
718 nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
720 void set_window_bscallback(HTMLWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
721 void set_current_mon(HTMLWindow*,IMoniker*) DECLSPEC_HIDDEN;
722 void set_current_uri(HTMLWindow*,IUri*) DECLSPEC_HIDDEN;
723 HRESULT start_binding(HTMLWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
724 HRESULT async_start_doc_binding(HTMLWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
725 void abort_document_bindings(HTMLDocumentNode*) DECLSPEC_HIDDEN;
726 void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
728 HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN;
730 void set_ready_state(HTMLWindow*,READYSTATE) DECLSPEC_HIDDEN;
732 HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN;
733 HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN;
734 HRESULT HTMLStyle_Create(HTMLElement*,nsIDOMCSSStyleDeclaration*,HTMLStyle**) DECLSPEC_HIDDEN;
735 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN;
736 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;
738 void detach_selection(HTMLDocumentNode*) DECLSPEC_HIDDEN;
739 void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
740 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
741 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
743 HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
745 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
747 struct HTMLAttributeCollection {
748 DispatchEx dispex;
749 IHTMLAttributeCollection IHTMLAttributeCollection_iface;
750 IHTMLAttributeCollection2 IHTMLAttributeCollection2_iface;
751 IHTMLAttributeCollection3 IHTMLAttributeCollection3_iface;
753 LONG ref;
755 HTMLElement *elem;
756 struct list attrs;
759 typedef struct {
760 DispatchEx dispex;
761 IHTMLDOMAttribute IHTMLDOMAttribute_iface;
763 LONG ref;
765 DISPID dispid;
766 HTMLElement *elem;
767 struct list entry;
768 } HTMLDOMAttribute;
770 HRESULT HTMLDOMAttribute_Create(HTMLElement*,DISPID,HTMLDOMAttribute**) DECLSPEC_HIDDEN;
772 HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**) DECLSPEC_HIDDEN;
773 HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**) DECLSPEC_HIDDEN;
774 HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
775 HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
776 HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
777 HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
778 HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
779 HRESULT HTMLHeadElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
780 HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
781 HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
782 HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
783 HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
784 HRESULT HTMLMetaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
785 HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
786 HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
787 HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
788 HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
789 HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
790 HRESULT HTMLTableCell_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
791 HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
792 HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
793 HRESULT HTMLTitleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
794 HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**) DECLSPEC_HIDDEN;
796 void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*) DECLSPEC_HIDDEN;
797 void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
798 void HTMLElement2_Init(HTMLElement*) DECLSPEC_HIDDEN;
799 void HTMLElement3_Init(HTMLElement*) DECLSPEC_HIDDEN;
800 void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
801 void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*) DECLSPEC_HIDDEN;
803 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
804 void HTMLDOMNode_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
806 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
807 void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
808 HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
809 HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
811 HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
812 void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;
814 HRESULT get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLDOMNode**) DECLSPEC_HIDDEN;
815 void release_nodes(HTMLDocumentNode*) DECLSPEC_HIDDEN;
817 HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
819 void release_script_hosts(HTMLWindow*) DECLSPEC_HIDDEN;
820 void connect_scripts(HTMLWindow*) DECLSPEC_HIDDEN;
821 void doc_insert_script(HTMLWindow*,nsIDOMHTMLScriptElement*) DECLSPEC_HIDDEN;
822 IDispatch *script_parse_event(HTMLWindow*,LPCWSTR) DECLSPEC_HIDDEN;
823 HRESULT exec_script(HTMLWindow*,const WCHAR*,const WCHAR*,VARIANT*) DECLSPEC_HIDDEN;
824 void set_script_mode(HTMLWindow*,SCRIPTMODE) DECLSPEC_HIDDEN;
825 BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*) DECLSPEC_HIDDEN;
826 IDispatch *get_script_disp(ScriptHost*) DECLSPEC_HIDDEN;
827 HRESULT search_window_props(HTMLWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN;
829 HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN;
831 IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL) DECLSPEC_HIDDEN;
832 IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*) DECLSPEC_HIDDEN;
833 IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*) DECLSPEC_HIDDEN;
835 /* commands */
836 typedef struct {
837 DWORD id;
838 HRESULT (*query)(HTMLDocument*,OLECMD*);
839 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
840 } cmdtable_t;
842 extern const cmdtable_t editmode_cmds[] DECLSPEC_HIDDEN;
844 void do_ns_command(HTMLDocument*,const char*,nsICommandParams*) DECLSPEC_HIDDEN;
846 /* timer */
847 #define UPDATE_UI 0x0001
848 #define UPDATE_TITLE 0x0002
850 void update_doc(HTMLDocument*,DWORD) DECLSPEC_HIDDEN;
851 void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
853 HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
855 /* editor */
856 void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
857 void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
858 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
859 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
860 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
861 void handle_edit_load(HTMLDocument*) DECLSPEC_HIDDEN;
862 HRESULT editor_is_dirty(HTMLDocument*) DECLSPEC_HIDDEN;
863 void set_dirty(HTMLDocument*,VARIANT_BOOL) DECLSPEC_HIDDEN;
865 extern DWORD mshtml_tls DECLSPEC_HIDDEN;
867 typedef struct task_t task_t;
868 typedef void (*task_proc_t)(task_t*);
870 struct task_t {
871 LONG target_magic;
872 task_proc_t proc;
873 task_proc_t destr;
874 struct task_t *next;
877 typedef struct {
878 task_t header;
879 HTMLDocumentObj *doc;
880 } docobj_task_t;
882 typedef struct {
883 HWND thread_hwnd;
884 task_t *task_queue_head;
885 task_t *task_queue_tail;
886 struct list timer_list;
887 } thread_data_t;
889 thread_data_t *get_thread_data(BOOL) DECLSPEC_HIDDEN;
890 HWND get_thread_hwnd(void) DECLSPEC_HIDDEN;
892 LONG get_task_target_magic(void) DECLSPEC_HIDDEN;
893 void push_task(task_t*,task_proc_t,task_proc_t,LONG) DECLSPEC_HIDDEN;
894 void remove_target_tasks(LONG) DECLSPEC_HIDDEN;
896 DWORD set_task_timer(HTMLDocument*,DWORD,BOOL,IDispatch*) DECLSPEC_HIDDEN;
897 HRESULT clear_task_timer(HTMLDocument*,BOOL,DWORD) DECLSPEC_HIDDEN;
899 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
901 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
902 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
903 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
904 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
905 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
907 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
909 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
911 /* memory allocation functions */
913 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
915 return HeapAlloc(GetProcessHeap(), 0, len);
918 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
920 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
923 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
925 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
928 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
930 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
933 static inline BOOL heap_free(void *mem)
935 return HeapFree(GetProcessHeap(), 0, mem);
938 static inline LPWSTR heap_strdupW(LPCWSTR str)
940 LPWSTR ret = NULL;
942 if(str) {
943 DWORD size;
945 size = (strlenW(str)+1)*sizeof(WCHAR);
946 ret = heap_alloc(size);
947 memcpy(ret, str, size);
950 return ret;
953 static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
955 LPWSTR ret = NULL;
957 if(str) {
958 ret = heap_alloc((len+1)*sizeof(WCHAR));
959 memcpy(ret, str, len*sizeof(WCHAR));
960 ret[len] = 0;
963 return ret;
966 static inline char *heap_strdupA(const char *str)
968 char *ret = NULL;
970 if(str) {
971 DWORD size;
973 size = strlen(str)+1;
974 ret = heap_alloc(size);
975 memcpy(ret, str, size);
978 return ret;
981 static inline WCHAR *heap_strdupAtoW(const char *str)
983 LPWSTR ret = NULL;
985 if(str) {
986 DWORD len;
988 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
989 ret = heap_alloc(len*sizeof(WCHAR));
990 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
993 return ret;
996 static inline char *heap_strdupWtoA(LPCWSTR str)
998 char *ret = NULL;
1000 if(str) {
1001 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
1002 ret = heap_alloc(size);
1003 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
1006 return ret;
1009 static inline void windowref_addref(windowref_t *ref)
1011 InterlockedIncrement(&ref->ref);
1014 static inline void windowref_release(windowref_t *ref)
1016 if(!InterlockedDecrement(&ref->ref))
1017 heap_free(ref);
1020 HDC get_display_dc(void) DECLSPEC_HIDDEN;
1021 HINSTANCE get_shdoclc(void) DECLSPEC_HIDDEN;
1022 void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
1024 extern HINSTANCE hInst DECLSPEC_HIDDEN;