msi: Downgrade a few messages to WARN.
[wine.git] / dlls / mshtml / mshtml_private.h
blob350ffbfa2436014a920f75925e1c75704021238f
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;
57 typedef struct nsChannelBSC nsChannelBSC;
59 typedef struct {
60 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
62 LONG ref;
64 HTMLDocument *doc;
65 nsIDOMWindow *nswindow;
67 struct list entry;
68 } HTMLWindow;
70 typedef enum {
71 UNKNOWN_USERMODE,
72 BROWSEMODE,
73 EDITMODE
74 } USERMODE;
76 typedef struct {
77 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
79 ConnectionPoint *cp_list;
80 IUnknown *outer;
81 } ConnectionPointContainer;
83 struct ConnectionPoint {
84 const IConnectionPointVtbl *lpConnectionPointVtbl;
86 IConnectionPointContainer *container;
88 union {
89 IUnknown *unk;
90 IDispatch *disp;
91 IPropertyNotifySink *propnotif;
92 } *sinks;
93 DWORD sinks_size;
95 const IID *iid;
97 ConnectionPoint *next;
100 typedef struct {
101 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
103 LONG ref;
105 HTMLDocument *doc;
106 } HTMLLocation;
108 typedef struct {
109 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
111 LONG ref;
113 HTMLDocument *doc;
114 } HTMLOptionElementFactory;
116 struct HTMLDocument {
117 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
118 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
119 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
120 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
121 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
122 const IPersistFileVtbl *lpPersistFileVtbl;
123 const IMonikerPropVtbl *lpMonikerPropVtbl;
124 const IOleObjectVtbl *lpOleObjectVtbl;
125 const IOleDocumentVtbl *lpOleDocumentVtbl;
126 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
127 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
128 const IViewObject2Vtbl *lpViewObject2Vtbl;
129 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
130 const IServiceProviderVtbl *lpServiceProviderVtbl;
131 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
132 const IOleControlVtbl *lpOleControlVtbl;
133 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
134 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
135 const ICustomDocVtbl *lpCustomDocVtbl;
137 LONG ref;
139 NSContainer *nscontainer;
140 HTMLWindow *window;
142 IOleClientSite *client;
143 IDocHostUIHandler *hostui;
144 IOleInPlaceSite *ipsite;
145 IOleInPlaceFrame *frame;
146 IOleInPlaceUIWindow *ip_window;
148 IOleUndoManager *undomgr;
150 nsChannelBSC *bscallback;
151 IMoniker *mon;
152 LPOLESTR url;
153 struct list bindings;
155 struct list script_hosts;
157 HWND hwnd;
158 HWND tooltips_hwnd;
160 DOCHOSTUIINFO hostinfo;
162 USERMODE usermode;
163 READYSTATE readystate;
164 BOOL in_place_active;
165 BOOL ui_active;
166 BOOL window_active;
167 BOOL has_key_path;
168 BOOL container_locked;
169 BOOL focus;
170 LPWSTR mime;
172 DWORD update;
174 ConnectionPointContainer cp_container;
175 ConnectionPoint cp_htmldocevents;
176 ConnectionPoint cp_htmldocevents2;
177 ConnectionPoint cp_propnotif;
179 HTMLOptionElementFactory *option_factory;
180 HTMLLocation *location;
182 struct list selection_list;
183 struct list range_list;
185 HTMLDOMNode *nodes;
188 typedef struct {
189 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
190 NSContainer *This;
191 } nsEventListener;
193 struct NSContainer {
194 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
195 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
196 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
197 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
198 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
199 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
200 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
201 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
203 nsEventListener blur_listener;
204 nsEventListener focus_listener;
205 nsEventListener keypress_listener;
206 nsEventListener load_listener;
207 nsEventListener node_insert_listener;
209 nsIWebBrowser *webbrowser;
210 nsIWebNavigation *navigation;
211 nsIBaseWindow *window;
212 nsIWebBrowserFocus *focus;
214 nsIEditor *editor;
215 nsIController *editor_controller;
217 LONG ref;
219 NSContainer *parent;
220 HTMLDocument *doc;
222 nsIURIContentListener *content_listener;
224 HWND hwnd;
226 nsChannelBSC *bscallback; /* hack */
227 HWND reset_focus; /* hack */
230 typedef struct {
231 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
232 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
234 LONG ref;
236 nsIChannel *channel;
237 nsIHttpChannel *http_channel;
238 nsIWineURI *uri;
239 nsIInputStream *post_data_stream;
240 nsILoadGroup *load_group;
241 nsIInterfaceRequestor *notif_callback;
242 nsLoadFlags load_flags;
243 nsIURI *original_uri;
244 char *content_type;
245 char *charset;
246 } nsChannel;
248 typedef struct {
249 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
250 void (*destructor)(HTMLDOMNode*);
251 } NodeImplVtbl;
253 struct HTMLDOMNode {
254 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
255 const NodeImplVtbl *vtbl;
257 LONG ref;
259 nsIDOMNode *nsnode;
260 HTMLDocument *doc;
262 HTMLDOMNode *next;
265 typedef struct {
266 HTMLDOMNode node;
267 ConnectionPointContainer cp_container;
269 const IHTMLElementVtbl *lpHTMLElementVtbl;
270 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
272 nsIDOMHTMLElement *nselem;
273 } HTMLElement;
275 typedef struct {
276 HTMLElement element;
278 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
280 ConnectionPoint cp;
281 } HTMLTextContainer;
283 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
285 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
286 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
287 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
288 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
289 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
290 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
291 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
292 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
293 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
294 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
295 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
296 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
297 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
298 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
299 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
300 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
301 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
302 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
303 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
304 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
305 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
306 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
307 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
308 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
310 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
311 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
312 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
313 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
314 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
315 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
316 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
317 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
318 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
320 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
321 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
322 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
324 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
325 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
326 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
328 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
329 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
330 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
332 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
334 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
335 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
337 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
338 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
340 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
341 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
343 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
344 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
345 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
346 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
347 void setup_nswindow(HTMLWindow*);
349 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
350 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
351 void HTMLDocument_Persist_Init(HTMLDocument*);
352 void HTMLDocument_OleCmd_Init(HTMLDocument*);
353 void HTMLDocument_OleObj_Init(HTMLDocument*);
354 void HTMLDocument_View_Init(HTMLDocument*);
355 void HTMLDocument_Window_Init(HTMLDocument*);
356 void HTMLDocument_Service_Init(HTMLDocument*);
357 void HTMLDocument_Hlink_Init(HTMLDocument*);
359 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
360 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
361 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
363 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
364 void NSContainer_Release(NSContainer*);
366 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
367 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
368 void notif_focus(HTMLDocument*);
370 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
371 void hide_tooltip(HTMLDocument*);
372 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
374 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
376 BOOL load_gecko(BOOL);
377 void close_gecko(void);
378 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
379 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
380 BOOL install_wine_gecko(BOOL);
382 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
384 void call_property_onchanged(ConnectionPoint*,DISPID);
385 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
387 void *nsalloc(size_t);
388 void nsfree(void*);
390 void nsACString_Init(nsACString*,const char*);
391 void nsACString_SetData(nsACString*,const char*);
392 PRUint32 nsACString_GetData(const nsACString*,const char**);
393 void nsACString_Finish(nsACString*);
395 void nsAString_Init(nsAString*,const PRUnichar*);
396 void nsAString_SetData(nsAString*,const PRUnichar*);
397 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
398 void nsAString_Finish(nsAString*);
400 nsIInputStream *create_nsstream(const char*,PRInt32);
401 nsICommandParams *create_nscommand_params(void);
402 nsIMutableArray *create_nsarray(void);
403 nsIWritableVariant *create_nsvariant(void);
404 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
405 void get_editor_controller(NSContainer*);
406 void init_nsevents(NSContainer*);
407 nsresult get_nsinterface(nsISupports*,REFIID,void**);
409 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
410 void set_current_mon(HTMLDocument*,IMoniker*);
411 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
413 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**);
415 nsChannelBSC *create_channelbsc(IMoniker*);
416 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
417 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
418 IMoniker *get_channelbsc_mon(nsChannelBSC*);
420 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
421 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
422 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
423 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
424 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
426 void detach_selection(HTMLDocument*);
427 void detach_ranges(HTMLDocument*);
429 HTMLElement *HTMLElement_Create(nsIDOMNode*);
430 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
431 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
432 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
433 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
434 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
435 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
436 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
437 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
439 void HTMLElement_Init(HTMLElement*);
440 void HTMLElement2_Init(HTMLElement*);
441 void HTMLTextContainer_Init(HTMLTextContainer*);
443 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
444 void HTMLDOMNode_destructor(HTMLDOMNode*);
446 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
447 void HTMLElement_destructor(HTMLDOMNode*);
449 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
450 void release_nodes(HTMLDocument*);
452 void release_script_hosts(HTMLDocument*);
453 void connect_scripts(HTMLDocument*);
454 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
456 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
458 /* commands */
459 typedef struct {
460 DWORD id;
461 HRESULT (*query)(HTMLDocument*,OLECMD*);
462 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
463 } cmdtable_t;
465 extern const cmdtable_t editmode_cmds[];
467 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
469 /* timer */
470 #define UPDATE_UI 0x0001
471 #define UPDATE_TITLE 0x0002
473 void update_doc(HTMLDocument *This, DWORD flags);
474 void update_title(HTMLDocument*);
476 /* editor */
477 void init_editor(HTMLDocument*);
478 void set_ns_editmode(NSContainer*);
479 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
480 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
481 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
482 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
483 void handle_edit_load(HTMLDocument*);
484 HRESULT editor_is_dirty(HTMLDocument*);
485 void set_dirty(HTMLDocument*,VARIANT_BOOL);
487 extern DWORD mshtml_tls;
489 typedef struct task_t {
490 HTMLDocument *doc;
492 enum {
493 TASK_SETDOWNLOADSTATE,
494 TASK_PARSECOMPLETE,
495 TASK_SETPROGRESS,
496 TASK_START_BINDING
497 } task_id;
499 nsChannelBSC *bscallback;
501 struct task_t *next;
502 } task_t;
504 typedef struct {
505 HWND thread_hwnd;
506 task_t *task_queue_head;
507 task_t *task_queue_tail;
508 } thread_data_t;
510 thread_data_t *get_thread_data(BOOL);
511 HWND get_thread_hwnd(void);
512 void push_task(task_t*);
513 void remove_doc_tasks(const HTMLDocument*);
515 /* typelibs */
516 enum tid_t {
517 IHTMLWindow2_tid,
518 LAST_tid
521 HRESULT get_typeinfo(enum tid_t, ITypeInfo**);
523 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
524 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
525 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
526 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
527 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
529 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
531 extern LONG module_ref;
532 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
533 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
535 /* memory allocation functions */
537 static inline void *heap_alloc(size_t len)
539 return HeapAlloc(GetProcessHeap(), 0, len);
542 static inline void *heap_alloc_zero(size_t len)
544 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
547 static inline void *heap_realloc(void *mem, size_t len)
549 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
552 static inline BOOL heap_free(void *mem)
554 return HeapFree(GetProcessHeap(), 0, mem);
557 static inline LPWSTR heap_strdupW(LPCWSTR str)
559 LPWSTR ret = NULL;
561 if(str) {
562 DWORD size;
564 size = (strlenW(str)+1)*sizeof(WCHAR);
565 ret = heap_alloc(size);
566 memcpy(ret, str, size);
569 return ret;
572 static inline char *heap_strdupA(const char *str)
574 char *ret = NULL;
576 if(str) {
577 DWORD size;
579 size = strlen(str)+1;
580 ret = heap_alloc(size);
581 memcpy(ret, str, size);
584 return ret;
587 static inline WCHAR *heap_strdupAtoW(const char *str)
589 LPWSTR ret = NULL;
591 if(str) {
592 DWORD len;
594 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
595 ret = heap_alloc(len*sizeof(WCHAR));
596 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
599 return ret;
602 static inline char *heap_strdupWtoA(LPCWSTR str)
604 char *ret = NULL;
606 if(str) {
607 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
608 ret = heap_alloc(size);
609 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
612 return ret;
615 HINSTANCE get_shdoclc(void);
617 extern HINSTANCE hInst;