2 * Copyright 2005-2008 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 DispHTMLInputElement_tid,
68 DispHTMLOptionElement_tid,
69 DispHTMLUnknownElement_tid,
80 IHTMLElementCollection_tid,
81 IHTMLInputElement_tid,
82 IHTMLOptionElement_tid,
89 typedef struct dispex_data_t dispex_data_t;
91 #define MSHTML_DISPID_CUSTOM_MIN 0x60000000
92 #define MSHTML_DISPID_CUSTOM_MAX 0x6fffffff
95 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
96 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
97 } dispex_static_data_vtbl_t;
100 const dispex_static_data_vtbl_t *vtbl;
101 const tid_t disp_tid;
103 const tid_t iface_tids[];
104 } dispex_static_data_t;
107 const IDispatchExVtbl *lpIDispatchExVtbl;
111 dispex_static_data_t *data;
114 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
118 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
119 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
120 const IDispatchExVtbl *lpIDispatchExVtbl;
125 nsIDOMWindow *nswindow;
127 IHTMLEventObj *event;
139 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
141 ConnectionPoint *cp_list;
143 } ConnectionPointContainer;
145 struct ConnectionPoint {
146 const IConnectionPointVtbl *lpConnectionPointVtbl;
148 IConnectionPointContainer *container;
153 IPropertyNotifySink *propnotif;
159 ConnectionPoint *next;
163 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
171 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
176 } HTMLOptionElementFactory;
178 struct HTMLDocument {
180 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
181 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
182 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
183 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
184 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
185 const IPersistFileVtbl *lpPersistFileVtbl;
186 const IMonikerPropVtbl *lpMonikerPropVtbl;
187 const IOleObjectVtbl *lpOleObjectVtbl;
188 const IOleDocumentVtbl *lpOleDocumentVtbl;
189 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
190 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
191 const IViewObject2Vtbl *lpViewObject2Vtbl;
192 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
193 const IServiceProviderVtbl *lpServiceProviderVtbl;
194 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
195 const IOleControlVtbl *lpOleControlVtbl;
196 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
197 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
198 const ICustomDocVtbl *lpCustomDocVtbl;
199 const IDispatchExVtbl *lpIDispatchExVtbl;
203 NSContainer *nscontainer;
206 IOleClientSite *client;
207 IDocHostUIHandler *hostui;
208 IOleInPlaceSite *ipsite;
209 IOleInPlaceFrame *frame;
210 IOleInPlaceUIWindow *ip_window;
212 IOleUndoManager *undomgr;
214 nsChannelBSC *bscallback;
217 struct list bindings;
219 struct list script_hosts;
224 DOCHOSTUIINFO hostinfo;
227 READYSTATE readystate;
228 BOOL in_place_active;
232 BOOL container_locked;
238 ConnectionPointContainer cp_container;
239 ConnectionPoint cp_htmldocevents;
240 ConnectionPoint cp_htmldocevents2;
241 ConnectionPoint cp_propnotif;
243 HTMLOptionElementFactory *option_factory;
244 HTMLLocation *location;
246 struct list selection_list;
247 struct list range_list;
253 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
258 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
259 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
260 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
261 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
262 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
263 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
264 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
265 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
267 nsEventListener blur_listener;
268 nsEventListener focus_listener;
269 nsEventListener keypress_listener;
270 nsEventListener load_listener;
271 nsEventListener node_insert_listener;
273 nsIWebBrowser *webbrowser;
274 nsIWebNavigation *navigation;
275 nsIBaseWindow *window;
276 nsIWebBrowserFocus *focus;
279 nsIController *editor_controller;
286 nsIURIContentListener *content_listener;
290 nsChannelBSC *bscallback; /* hack */
291 HWND reset_focus; /* hack */
295 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
296 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
301 nsIHttpChannel *http_channel;
303 nsIInputStream *post_data_stream;
304 nsILoadGroup *load_group;
305 nsIInterfaceRequestor *notif_callback;
306 nsLoadFlags load_flags;
307 nsIURI *original_uri;
313 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
314 void (*destructor)(HTMLDOMNode*);
319 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
320 const IHTMLDOMNode2Vtbl *lpHTMLDOMNode2Vtbl;
321 const NodeImplVtbl *vtbl;
327 event_target_t *event_target;
334 ConnectionPointContainer cp_container;
336 const IHTMLElementVtbl *lpHTMLElementVtbl;
337 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
339 nsIDOMHTMLElement *nselem;
345 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
350 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
351 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
353 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
354 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
355 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
356 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
357 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
358 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
359 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
360 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
361 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
362 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
363 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
364 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
365 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
366 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
367 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
368 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
369 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
370 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
371 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
372 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
373 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
374 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
375 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
376 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
378 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
379 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
380 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
381 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
382 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
383 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
384 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
385 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
386 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
388 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
389 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
390 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
392 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
393 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
394 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
396 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
397 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
398 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
399 #define HTMLDOMNODE2(x) ((IHTMLDOMNode2*) &(x)->lpHTMLDOMNode2Vtbl)
401 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
403 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
404 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
406 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
408 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
409 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
411 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
412 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
414 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
415 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
416 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
417 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
418 IOmNavigator *OmNavigator_Create(void);
419 void setup_nswindow(HTMLWindow*);
421 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
422 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
423 void HTMLDocument_Persist_Init(HTMLDocument*);
424 void HTMLDocument_OleCmd_Init(HTMLDocument*);
425 void HTMLDocument_OleObj_Init(HTMLDocument*);
426 void HTMLDocument_View_Init(HTMLDocument*);
427 void HTMLDocument_Window_Init(HTMLDocument*);
428 void HTMLDocument_Service_Init(HTMLDocument*);
429 void HTMLDocument_Hlink_Init(HTMLDocument*);
431 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
432 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
433 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
435 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
436 void NSContainer_Release(NSContainer*);
438 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
439 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
440 void notif_focus(HTMLDocument*);
442 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
443 void hide_tooltip(HTMLDocument*);
444 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
446 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
448 BOOL load_gecko(BOOL);
449 void close_gecko(void);
450 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
451 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
452 BOOL install_wine_gecko(BOOL);
454 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
456 void call_property_onchanged(ConnectionPoint*,DISPID);
457 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
459 void *nsalloc(size_t);
462 void nsACString_Init(nsACString*,const char*);
463 void nsACString_SetData(nsACString*,const char*);
464 PRUint32 nsACString_GetData(const nsACString*,const char**);
465 void nsACString_Finish(nsACString*);
467 void nsAString_Init(nsAString*,const PRUnichar*);
468 void nsAString_SetData(nsAString*,const PRUnichar*);
469 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
470 void nsAString_Finish(nsAString*);
472 nsIInputStream *create_nsstream(const char*,PRInt32);
473 nsICommandParams *create_nscommand_params(void);
474 nsIMutableArray *create_nsarray(void);
475 nsIWritableVariant *create_nsvariant(void);
476 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
477 void get_editor_controller(NSContainer*);
478 void init_nsevents(NSContainer*);
479 nsresult get_nsinterface(nsISupports*,REFIID,void**);
486 void check_event_attr(HTMLDocument*,nsIDOMElement*);
487 void release_event_target(event_target_t*);
488 void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
490 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
491 void set_current_mon(HTMLDocument*,IMoniker*);
492 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
494 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
496 nsChannelBSC *create_channelbsc(IMoniker*);
497 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
498 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
499 IMoniker *get_channelbsc_mon(nsChannelBSC*);
501 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
502 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
503 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
504 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
505 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
507 void detach_selection(HTMLDocument*);
508 void detach_ranges(HTMLDocument*);
510 HTMLDOMNode *HTMLDOMTextNode_Create(nsIDOMNode*);
512 HTMLElement *HTMLElement_Create(nsIDOMNode*);
513 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
514 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
515 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
516 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
517 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
518 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
519 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
520 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
522 void HTMLElement_Init(HTMLElement*);
523 void HTMLElement2_Init(HTMLElement*);
524 void HTMLTextContainer_Init(HTMLTextContainer*);
526 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
527 void HTMLDOMNode_destructor(HTMLDOMNode*);
529 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
530 void HTMLElement_destructor(HTMLDOMNode*);
532 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
533 void release_nodes(HTMLDocument*);
535 void release_script_hosts(HTMLDocument*);
536 void connect_scripts(HTMLDocument*);
537 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
538 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
540 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
545 HRESULT (*query)(HTMLDocument*,OLECMD*);
546 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
549 extern const cmdtable_t editmode_cmds[];
551 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
554 #define UPDATE_UI 0x0001
555 #define UPDATE_TITLE 0x0002
557 void update_doc(HTMLDocument *This, DWORD flags);
558 void update_title(HTMLDocument*);
561 void init_editor(HTMLDocument*);
562 void set_ns_editmode(NSContainer*);
563 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
564 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
565 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
566 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
567 void handle_edit_load(HTMLDocument*);
568 HRESULT editor_is_dirty(HTMLDocument*);
569 void set_dirty(HTMLDocument*,VARIANT_BOOL);
571 extern DWORD mshtml_tls;
573 typedef struct task_t {
577 TASK_SETDOWNLOADSTATE,
583 nsChannelBSC *bscallback;
590 task_t *task_queue_head;
591 task_t *task_queue_tail;
592 struct list timer_list;
595 thread_data_t *get_thread_data(BOOL);
596 HWND get_thread_hwnd(void);
597 void push_task(task_t*);
598 void remove_doc_tasks(const HTMLDocument*);
599 DWORD set_task_timer(HTMLDocument*,DWORD,IDispatch*);
601 HRESULT get_typeinfo(tid_t,ITypeInfo**);
602 void release_typelib(void);
603 void call_disp_func(HTMLDocument*,IDispatch*);
605 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
606 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
607 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
608 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
609 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
611 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
613 extern LONG module_ref;
614 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
615 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
617 /* memory allocation functions */
619 static inline void *heap_alloc(size_t len)
621 return HeapAlloc(GetProcessHeap(), 0, len);
624 static inline void *heap_alloc_zero(size_t len)
626 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
629 static inline void *heap_realloc(void *mem, size_t len)
631 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
634 static inline BOOL heap_free(void *mem)
636 return HeapFree(GetProcessHeap(), 0, mem);
639 static inline LPWSTR heap_strdupW(LPCWSTR str)
646 size = (strlenW(str)+1)*sizeof(WCHAR);
647 ret = heap_alloc(size);
648 memcpy(ret, str, size);
654 static inline char *heap_strdupA(const char *str)
661 size = strlen(str)+1;
662 ret = heap_alloc(size);
663 memcpy(ret, str, size);
669 static inline WCHAR *heap_strdupAtoW(const char *str)
676 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
677 ret = heap_alloc(len*sizeof(WCHAR));
678 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
684 static inline char *heap_strdupWtoA(LPCWSTR str)
689 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
690 ret = heap_alloc(size);
691 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
697 HINSTANCE get_shdoclc(void);
699 extern HINSTANCE hInst;