mshtml: Don't access BSCallback directly in nsio.c.
[wine/hacks.git] / dlls / mshtml / mshtml_private.h
blob66bb11d241f762bcc79c82d6c45907f6219acc2e
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;
195 nsEventListener node_insert_listener;
197 nsIWebBrowser *webbrowser;
198 nsIWebNavigation *navigation;
199 nsIBaseWindow *window;
200 nsIWebBrowserFocus *focus;
202 nsIEditor *editor;
203 nsIController *editor_controller;
205 LONG ref;
207 NSContainer *parent;
208 HTMLDocument *doc;
210 nsIURIContentListener *content_listener;
212 HWND hwnd;
214 BSCallback *bscallback; /* hack */
215 HWND reset_focus; /* hack */
218 typedef struct {
219 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
220 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
222 LONG ref;
224 nsIChannel *channel;
225 nsIHttpChannel *http_channel;
226 nsIWineURI *uri;
227 nsIInputStream *post_data_stream;
228 nsILoadGroup *load_group;
229 nsIInterfaceRequestor *notif_callback;
230 nsLoadFlags load_flags;
231 nsIURI *original_uri;
232 char *content;
233 char *charset;
234 } nsChannel;
236 typedef struct {
237 const nsIInputStreamVtbl *lpInputStreamVtbl;
239 LONG ref;
241 char buf[1024];
242 DWORD buf_size;
243 } nsProtocolStream;
245 struct BSCallback {
246 const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
247 const IServiceProviderVtbl *lpServiceProviderVtbl;
248 const IHttpNegotiate2Vtbl *lpHttpNegotiate2Vtbl;
249 const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
251 LONG ref;
253 LPWSTR headers;
254 HGLOBAL post_data;
255 ULONG post_data_len;
256 ULONG readed;
258 nsChannel *nschannel;
259 nsIStreamListener *nslistener;
260 nsISupports *nscontext;
262 IMoniker *mon;
263 IBinding *binding;
265 HTMLDocument *doc;
267 nsProtocolStream *nsstream;
269 struct list entry;
272 typedef struct {
273 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
274 void (*destructor)(HTMLDOMNode*);
275 } NodeImplVtbl;
277 struct HTMLDOMNode {
278 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
279 const NodeImplVtbl *vtbl;
281 LONG ref;
283 nsIDOMNode *nsnode;
284 HTMLDocument *doc;
286 HTMLDOMNode *next;
289 typedef struct {
290 HTMLDOMNode node;
291 ConnectionPointContainer cp_container;
293 const IHTMLElementVtbl *lpHTMLElementVtbl;
294 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
296 nsIDOMHTMLElement *nselem;
297 } HTMLElement;
299 typedef struct {
300 HTMLElement element;
302 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
304 ConnectionPoint cp;
305 } HTMLTextContainer;
307 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
309 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
310 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
311 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
312 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
313 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
314 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
315 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
316 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
317 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
318 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
319 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
320 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
321 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
322 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
323 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
324 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
325 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
326 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
327 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
328 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
329 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
330 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
331 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
332 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
334 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
335 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
336 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
337 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
338 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
339 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
340 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
341 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
342 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
344 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
345 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
346 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
348 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
349 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
350 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
352 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
353 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
354 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
356 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
358 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
360 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
361 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
363 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
364 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
366 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
367 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
368 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
369 void setup_nswindow(HTMLWindow*);
371 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
372 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
373 void HTMLDocument_Persist_Init(HTMLDocument*);
374 void HTMLDocument_OleCmd_Init(HTMLDocument*);
375 void HTMLDocument_OleObj_Init(HTMLDocument*);
376 void HTMLDocument_View_Init(HTMLDocument*);
377 void HTMLDocument_Window_Init(HTMLDocument*);
378 void HTMLDocument_Service_Init(HTMLDocument*);
379 void HTMLDocument_Hlink_Init(HTMLDocument*);
381 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
382 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
383 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
385 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
386 void NSContainer_Release(NSContainer*);
388 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
389 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
390 void notif_focus(HTMLDocument*);
392 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
393 void hide_tooltip(HTMLDocument*);
394 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
396 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
398 BOOL load_gecko(BOOL);
399 void close_gecko(void);
400 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
401 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
402 BOOL install_wine_gecko(BOOL);
404 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
406 void call_property_onchanged(ConnectionPoint*,DISPID);
407 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
409 void *nsalloc(size_t);
410 void nsfree(void*);
412 void nsACString_Init(nsACString*,const char*);
413 void nsACString_SetData(nsACString*,const char*);
414 PRUint32 nsACString_GetData(const nsACString*,const char**);
415 void nsACString_Finish(nsACString*);
417 void nsAString_Init(nsAString*,const PRUnichar*);
418 void nsAString_SetData(nsAString*,const PRUnichar*);
419 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
420 void nsAString_Finish(nsAString*);
422 nsIInputStream *create_nsstream(const char*,PRInt32);
423 nsICommandParams *create_nscommand_params(void);
424 nsIMutableArray *create_nsarray(void);
425 nsIWritableVariant *create_nsvariant(void);
426 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
427 void get_editor_controller(NSContainer*);
428 void init_nsevents(NSContainer*);
429 nsresult get_nsinterface(nsISupports*,REFIID,void**);
431 BSCallback *create_bscallback(IMoniker*);
432 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
433 HRESULT load_stream(BSCallback*,IStream*);
434 void set_document_bscallback(HTMLDocument*,BSCallback*);
435 void set_current_mon(HTMLDocument*,IMoniker*);
437 void channelbsc_set_channel(BSCallback*,nsChannel*,nsIStreamListener*,nsISupports*);
439 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
440 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
441 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
442 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
443 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
445 void detach_selection(HTMLDocument*);
446 void detach_ranges(HTMLDocument*);
448 HTMLElement *HTMLElement_Create(nsIDOMNode*);
449 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
450 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
451 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
452 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
453 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
454 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
455 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
456 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
458 void HTMLElement_Init(HTMLElement*);
459 void HTMLElement2_Init(HTMLElement*);
460 void HTMLTextContainer_Init(HTMLTextContainer*);
462 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
463 void HTMLDOMNode_destructor(HTMLDOMNode*);
465 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
466 void HTMLElement_destructor(HTMLDOMNode*);
468 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
469 void release_nodes(HTMLDocument*);
471 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
473 /* commands */
474 typedef struct {
475 DWORD id;
476 HRESULT (*query)(HTMLDocument*,OLECMD*);
477 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
478 } cmdtable_t;
480 extern const cmdtable_t editmode_cmds[];
482 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
484 /* timer */
485 #define UPDATE_UI 0x0001
486 #define UPDATE_TITLE 0x0002
488 void update_doc(HTMLDocument *This, DWORD flags);
489 void update_title(HTMLDocument*);
491 /* editor */
492 void init_editor(HTMLDocument*);
493 void set_ns_editmode(NSContainer*);
494 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
495 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
496 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
497 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
498 void handle_edit_load(HTMLDocument*);
499 HRESULT editor_is_dirty(HTMLDocument*);
500 void set_dirty(HTMLDocument*,VARIANT_BOOL);
502 extern DWORD mshtml_tls;
504 typedef struct task_t {
505 HTMLDocument *doc;
507 enum {
508 TASK_SETDOWNLOADSTATE,
509 TASK_PARSECOMPLETE,
510 TASK_SETPROGRESS,
511 TASK_START_BINDING
512 } task_id;
514 BSCallback *bscallback;
516 struct task_t *next;
517 } task_t;
519 typedef struct {
520 HWND thread_hwnd;
521 task_t *task_queue_head;
522 task_t *task_queue_tail;
523 } thread_data_t;
525 thread_data_t *get_thread_data(BOOL);
526 HWND get_thread_hwnd(void);
527 void push_task(task_t*);
528 void remove_doc_tasks(const HTMLDocument*);
530 /* typelibs */
531 enum tid_t {
532 IHTMLWindow2_tid,
533 LAST_tid
536 HRESULT get_typeinfo(enum tid_t, ITypeInfo**);
538 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
539 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
540 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
541 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
542 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
544 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
546 extern LONG module_ref;
547 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
548 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
550 /* memory allocation functions */
552 static inline void *heap_alloc(size_t len)
554 return HeapAlloc(GetProcessHeap(), 0, len);
557 static inline void *heap_alloc_zero(size_t len)
559 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
562 static inline void *heap_realloc(void *mem, size_t len)
564 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
567 static inline BOOL heap_free(void *mem)
569 return HeapFree(GetProcessHeap(), 0, mem);
572 static inline LPWSTR heap_strdupW(LPCWSTR str)
574 LPWSTR ret = NULL;
576 if(str) {
577 DWORD size;
579 size = (strlenW(str)+1)*sizeof(WCHAR);
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, -1);
599 return ret;
602 HINSTANCE get_shdoclc(void);
604 extern HINSTANCE hInst;