2 * Copyright 2005-2006 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
26 #include "wine/list.h"
27 #include "wine/unicode.h"
35 #define GENERATE_MSHTML_NS_FAILURE(code) \
36 ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))
38 #define NS_OK ((nsresult)0x00000000L)
39 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
40 #define NS_NOINTERFACE ((nsresult)0x80004002L)
41 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
42 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
43 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
44 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
46 #define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)
48 #define NS_FAILED(res) ((res) & 0x80000000)
49 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
53 #define MSHTML_E_NODOC 0x800a025c
55 typedef struct HTMLDOMNode HTMLDOMNode;
56 typedef struct ConnectionPoint ConnectionPoint;
57 typedef struct BSCallback BSCallback;
58 typedef struct nsChannelBSC nsChannelBSC;
59 typedef struct event_target_t event_target_t;
61 /* NOTE: make sure to keep in sync with dispex.c */
65 DispHTMLDOMTextNode_tid,
66 DispHTMLElementCollection_tid,
67 DispHTMLUnknownElement_tid,
78 IHTMLElementCollection_tid,
85 typedef struct dispex_data_t dispex_data_t;
90 const tid_t iface_tids[];
91 } dispex_static_data_t;
94 const IDispatchExVtbl *lpIDispatchExVtbl;
98 dispex_static_data_t *data;
101 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
105 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
106 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
107 const IDispatchExVtbl *lpIDispatchExVtbl;
112 nsIDOMWindow *nswindow;
114 IHTMLEventObj *event;
126 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
128 ConnectionPoint *cp_list;
130 } ConnectionPointContainer;
132 struct ConnectionPoint {
133 const IConnectionPointVtbl *lpConnectionPointVtbl;
135 IConnectionPointContainer *container;
140 IPropertyNotifySink *propnotif;
146 ConnectionPoint *next;
150 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
158 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
163 } HTMLOptionElementFactory;
165 struct HTMLDocument {
167 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
168 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
169 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
170 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
171 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
172 const IPersistFileVtbl *lpPersistFileVtbl;
173 const IMonikerPropVtbl *lpMonikerPropVtbl;
174 const IOleObjectVtbl *lpOleObjectVtbl;
175 const IOleDocumentVtbl *lpOleDocumentVtbl;
176 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
177 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
178 const IViewObject2Vtbl *lpViewObject2Vtbl;
179 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
180 const IServiceProviderVtbl *lpServiceProviderVtbl;
181 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
182 const IOleControlVtbl *lpOleControlVtbl;
183 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
184 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
185 const ICustomDocVtbl *lpCustomDocVtbl;
186 const IDispatchExVtbl *lpIDispatchExVtbl;
190 NSContainer *nscontainer;
193 IOleClientSite *client;
194 IDocHostUIHandler *hostui;
195 IOleInPlaceSite *ipsite;
196 IOleInPlaceFrame *frame;
197 IOleInPlaceUIWindow *ip_window;
199 IOleUndoManager *undomgr;
201 nsChannelBSC *bscallback;
204 struct list bindings;
206 struct list script_hosts;
211 DOCHOSTUIINFO hostinfo;
214 READYSTATE readystate;
215 BOOL in_place_active;
219 BOOL container_locked;
225 ConnectionPointContainer cp_container;
226 ConnectionPoint cp_htmldocevents;
227 ConnectionPoint cp_htmldocevents2;
228 ConnectionPoint cp_propnotif;
230 HTMLOptionElementFactory *option_factory;
231 HTMLLocation *location;
233 struct list selection_list;
234 struct list range_list;
240 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
245 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
246 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
247 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
248 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
249 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
250 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
251 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
252 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
254 nsEventListener blur_listener;
255 nsEventListener focus_listener;
256 nsEventListener keypress_listener;
257 nsEventListener load_listener;
258 nsEventListener node_insert_listener;
260 nsIWebBrowser *webbrowser;
261 nsIWebNavigation *navigation;
262 nsIBaseWindow *window;
263 nsIWebBrowserFocus *focus;
266 nsIController *editor_controller;
273 nsIURIContentListener *content_listener;
277 nsChannelBSC *bscallback; /* hack */
278 HWND reset_focus; /* hack */
282 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
283 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
288 nsIHttpChannel *http_channel;
290 nsIInputStream *post_data_stream;
291 nsILoadGroup *load_group;
292 nsIInterfaceRequestor *notif_callback;
293 nsLoadFlags load_flags;
294 nsIURI *original_uri;
300 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
301 void (*destructor)(HTMLDOMNode*);
306 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
307 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
308 const NodeImplVtbl *vtbl;
314 event_target_t *event_target;
321 ConnectionPointContainer cp_container;
323 const IHTMLElementVtbl *lpHTMLElementVtbl;
324 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
326 nsIDOMHTMLElement *nselem;
332 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
337 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
338 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
340 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
341 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
342 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
343 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
344 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
345 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
346 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
347 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
348 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
349 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
350 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
351 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
352 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
353 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
354 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
355 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
356 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
357 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
358 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
359 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
360 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
361 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
362 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
363 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
365 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
366 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
367 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
368 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
369 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
370 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
371 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
372 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
373 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
375 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
376 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
377 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
379 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
380 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
381 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
383 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
384 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
385 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
386 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
388 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
390 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
391 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
393 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
395 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
396 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
398 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
399 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
401 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
402 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
403 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
404 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
405 IOmNavigator *OmNavigator_Create(void);
406 void setup_nswindow(HTMLWindow*);
408 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
409 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
410 void HTMLDocument_Persist_Init(HTMLDocument*);
411 void HTMLDocument_OleCmd_Init(HTMLDocument*);
412 void HTMLDocument_OleObj_Init(HTMLDocument*);
413 void HTMLDocument_View_Init(HTMLDocument*);
414 void HTMLDocument_Window_Init(HTMLDocument*);
415 void HTMLDocument_Service_Init(HTMLDocument*);
416 void HTMLDocument_Hlink_Init(HTMLDocument*);
418 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
419 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
420 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
422 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
423 void NSContainer_Release(NSContainer*);
425 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
426 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
427 void notif_focus(HTMLDocument*);
429 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
430 void hide_tooltip(HTMLDocument*);
431 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
433 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
435 BOOL load_gecko(BOOL);
436 void close_gecko(void);
437 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
438 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
439 BOOL install_wine_gecko(BOOL);
441 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
443 void call_property_onchanged(ConnectionPoint*,DISPID);
444 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
446 void *nsalloc(size_t);
449 void nsACString_Init(nsACString*,const char*);
450 void nsACString_SetData(nsACString*,const char*);
451 PRUint32 nsACString_GetData(const nsACString*,const char**);
452 void nsACString_Finish(nsACString*);
454 void nsAString_Init(nsAString*,const PRUnichar*);
455 void nsAString_SetData(nsAString*,const PRUnichar*);
456 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
457 void nsAString_Finish(nsAString*);
459 nsIInputStream *create_nsstream(const char*,PRInt32);
460 nsICommandParams *create_nscommand_params(void);
461 nsIMutableArray *create_nsarray(void);
462 nsIWritableVariant *create_nsvariant(void);
463 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
464 void get_editor_controller(NSContainer*);
465 void init_nsevents(NSContainer*);
466 nsresult get_nsinterface(nsISupports*,REFIID,void**);
473 void check_event_attr(HTMLDocument*,nsIDOMElement*);
474 void release_event_target(event_target_t*);
475 void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
477 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
478 void set_current_mon(HTMLDocument*,IMoniker*);
479 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
481 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
483 nsChannelBSC *create_channelbsc(IMoniker*);
484 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
485 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
486 IMoniker *get_channelbsc_mon(nsChannelBSC*);
488 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
489 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
490 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
491 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
492 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
494 void detach_selection(HTMLDocument*);
495 void detach_ranges(HTMLDocument*);
497 HTMLDOMNode *HTMLDOMTextNode_Create(nsIDOMNode*);
499 HTMLElement *HTMLElement_Create(nsIDOMNode*);
500 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
501 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
502 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
503 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
504 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
505 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
506 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
507 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
509 void HTMLElement_Init(HTMLElement*);
510 void HTMLElement2_Init(HTMLElement*);
511 void HTMLTextContainer_Init(HTMLTextContainer*);
513 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
514 void HTMLDOMNode_destructor(HTMLDOMNode*);
516 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
517 void HTMLElement_destructor(HTMLDOMNode*);
519 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
520 void release_nodes(HTMLDocument*);
522 void release_script_hosts(HTMLDocument*);
523 void connect_scripts(HTMLDocument*);
524 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
525 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
527 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
532 HRESULT (*query)(HTMLDocument*,OLECMD*);
533 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
536 extern const cmdtable_t editmode_cmds[];
538 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
541 #define UPDATE_UI 0x0001
542 #define UPDATE_TITLE 0x0002
544 void update_doc(HTMLDocument *This, DWORD flags);
545 void update_title(HTMLDocument*);
548 void init_editor(HTMLDocument*);
549 void set_ns_editmode(NSContainer*);
550 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
551 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
552 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
553 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
554 void handle_edit_load(HTMLDocument*);
555 HRESULT editor_is_dirty(HTMLDocument*);
556 void set_dirty(HTMLDocument*,VARIANT_BOOL);
558 extern DWORD mshtml_tls;
560 typedef struct task_t {
564 TASK_SETDOWNLOADSTATE,
570 nsChannelBSC *bscallback;
577 task_t *task_queue_head;
578 task_t *task_queue_tail;
579 struct list timer_list;
582 thread_data_t *get_thread_data(BOOL);
583 HWND get_thread_hwnd(void);
584 void push_task(task_t*);
585 void remove_doc_tasks(const HTMLDocument*);
586 DWORD set_task_timer(HTMLDocument*,DWORD,IDispatch*);
588 HRESULT get_typeinfo(tid_t,ITypeInfo**);
589 void release_typelib(void);
590 void call_disp_func(HTMLDocument*,IDispatch*);
592 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
593 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
594 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
595 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
596 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
598 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
600 extern LONG module_ref;
601 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
602 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
604 /* memory allocation functions */
606 static inline void *heap_alloc(size_t len)
608 return HeapAlloc(GetProcessHeap(), 0, len);
611 static inline void *heap_alloc_zero(size_t len)
613 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
616 static inline void *heap_realloc(void *mem, size_t len)
618 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
621 static inline BOOL heap_free(void *mem)
623 return HeapFree(GetProcessHeap(), 0, mem);
626 static inline LPWSTR heap_strdupW(LPCWSTR str)
633 size = (strlenW(str)+1)*sizeof(WCHAR);
634 ret = heap_alloc(size);
635 memcpy(ret, str, size);
641 static inline char *heap_strdupA(const char *str)
648 size = strlen(str)+1;
649 ret = heap_alloc(size);
650 memcpy(ret, str, size);
656 static inline WCHAR *heap_strdupAtoW(const char *str)
663 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
664 ret = heap_alloc(len*sizeof(WCHAR));
665 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
671 static inline char *heap_strdupWtoA(LPCWSTR str)
676 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
677 ret = heap_alloc(size);
678 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
684 HINSTANCE get_shdoclc(void);
686 extern HINSTANCE hInst;