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