msi: Fix a typo.
[wine.git] / dlls / mshtml / mshtml_private.h
blob569ab6c903b29730c4ce36c041db048331cb1d4c
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 IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
103 LONG ref;
105 HTMLDocument *doc;
106 } HTMLOptionElementFactory;
108 struct HTMLDocument {
109 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
110 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
111 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
112 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
113 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
114 const IPersistFileVtbl *lpPersistFileVtbl;
115 const IMonikerPropVtbl *lpMonikerPropVtbl;
116 const IOleObjectVtbl *lpOleObjectVtbl;
117 const IOleDocumentVtbl *lpOleDocumentVtbl;
118 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
119 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
120 const IViewObject2Vtbl *lpViewObject2Vtbl;
121 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
122 const IServiceProviderVtbl *lpServiceProviderVtbl;
123 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
124 const IOleControlVtbl *lpOleControlVtbl;
125 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
126 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
127 const ICustomDocVtbl *lpCustomDocVtbl;
129 LONG ref;
131 NSContainer *nscontainer;
132 HTMLWindow *window;
134 IOleClientSite *client;
135 IDocHostUIHandler *hostui;
136 IOleInPlaceSite *ipsite;
137 IOleInPlaceFrame *frame;
138 IOleInPlaceUIWindow *ip_window;
140 IOleUndoManager *undomgr;
142 nsChannelBSC *bscallback;
143 IMoniker *mon;
144 LPOLESTR url;
145 struct list bindings;
147 struct list script_hosts;
149 HWND hwnd;
150 HWND tooltips_hwnd;
152 DOCHOSTUIINFO hostinfo;
154 USERMODE usermode;
155 READYSTATE readystate;
156 BOOL in_place_active;
157 BOOL ui_active;
158 BOOL window_active;
159 BOOL has_key_path;
160 BOOL container_locked;
161 BOOL focus;
162 LPWSTR mime;
164 DWORD update;
166 ConnectionPointContainer cp_container;
167 ConnectionPoint cp_htmldocevents;
168 ConnectionPoint cp_htmldocevents2;
169 ConnectionPoint cp_propnotif;
171 HTMLOptionElementFactory *option_factory;
173 struct list selection_list;
174 struct list range_list;
176 HTMLDOMNode *nodes;
179 typedef struct {
180 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
181 NSContainer *This;
182 } nsEventListener;
184 struct NSContainer {
185 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
186 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
187 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
188 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
189 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
190 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
191 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
192 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
194 nsEventListener blur_listener;
195 nsEventListener focus_listener;
196 nsEventListener keypress_listener;
197 nsEventListener load_listener;
198 nsEventListener node_insert_listener;
200 nsIWebBrowser *webbrowser;
201 nsIWebNavigation *navigation;
202 nsIBaseWindow *window;
203 nsIWebBrowserFocus *focus;
205 nsIEditor *editor;
206 nsIController *editor_controller;
208 LONG ref;
210 NSContainer *parent;
211 HTMLDocument *doc;
213 nsIURIContentListener *content_listener;
215 HWND hwnd;
217 nsChannelBSC *bscallback; /* hack */
218 HWND reset_focus; /* hack */
221 typedef struct {
222 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
223 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
225 LONG ref;
227 nsIChannel *channel;
228 nsIHttpChannel *http_channel;
229 nsIWineURI *uri;
230 nsIInputStream *post_data_stream;
231 nsILoadGroup *load_group;
232 nsIInterfaceRequestor *notif_callback;
233 nsLoadFlags load_flags;
234 nsIURI *original_uri;
235 char *content;
236 char *charset;
237 } nsChannel;
239 typedef struct {
240 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
241 void (*destructor)(HTMLDOMNode*);
242 } NodeImplVtbl;
244 struct HTMLDOMNode {
245 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
246 const NodeImplVtbl *vtbl;
248 LONG ref;
250 nsIDOMNode *nsnode;
251 HTMLDocument *doc;
253 HTMLDOMNode *next;
256 typedef struct {
257 HTMLDOMNode node;
258 ConnectionPointContainer cp_container;
260 const IHTMLElementVtbl *lpHTMLElementVtbl;
261 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
263 nsIDOMHTMLElement *nselem;
264 } HTMLElement;
266 typedef struct {
267 HTMLElement element;
269 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
271 ConnectionPoint cp;
272 } HTMLTextContainer;
274 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
276 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
277 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
278 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
279 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
280 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
281 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
282 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
283 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
284 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
285 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
286 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
287 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
288 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
289 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
290 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
291 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
292 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
293 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
294 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
295 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
296 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
297 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
298 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
299 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
301 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
302 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
303 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
304 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
305 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
306 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
307 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
308 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
309 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
311 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
312 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
313 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
315 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
316 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
317 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
319 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
320 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
321 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
323 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
325 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
327 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
328 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
330 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
331 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
333 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
334 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
335 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
336 void setup_nswindow(HTMLWindow*);
338 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
339 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
340 void HTMLDocument_Persist_Init(HTMLDocument*);
341 void HTMLDocument_OleCmd_Init(HTMLDocument*);
342 void HTMLDocument_OleObj_Init(HTMLDocument*);
343 void HTMLDocument_View_Init(HTMLDocument*);
344 void HTMLDocument_Window_Init(HTMLDocument*);
345 void HTMLDocument_Service_Init(HTMLDocument*);
346 void HTMLDocument_Hlink_Init(HTMLDocument*);
348 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
349 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
350 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
352 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
353 void NSContainer_Release(NSContainer*);
355 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
356 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
357 void notif_focus(HTMLDocument*);
359 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
360 void hide_tooltip(HTMLDocument*);
361 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
363 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
365 BOOL load_gecko(BOOL);
366 void close_gecko(void);
367 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
368 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
369 BOOL install_wine_gecko(BOOL);
371 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
373 void call_property_onchanged(ConnectionPoint*,DISPID);
374 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
376 void *nsalloc(size_t);
377 void nsfree(void*);
379 void nsACString_Init(nsACString*,const char*);
380 void nsACString_SetData(nsACString*,const char*);
381 PRUint32 nsACString_GetData(const nsACString*,const char**);
382 void nsACString_Finish(nsACString*);
384 void nsAString_Init(nsAString*,const PRUnichar*);
385 void nsAString_SetData(nsAString*,const PRUnichar*);
386 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
387 void nsAString_Finish(nsAString*);
389 nsIInputStream *create_nsstream(const char*,PRInt32);
390 nsICommandParams *create_nscommand_params(void);
391 nsIMutableArray *create_nsarray(void);
392 nsIWritableVariant *create_nsvariant(void);
393 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
394 void get_editor_controller(NSContainer*);
395 void init_nsevents(NSContainer*);
396 nsresult get_nsinterface(nsISupports*,REFIID,void**);
398 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
399 void set_current_mon(HTMLDocument*,IMoniker*);
400 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
402 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**);
404 nsChannelBSC *create_channelbsc(IMoniker*);
405 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
406 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
407 IMoniker *get_channelbsc_mon(nsChannelBSC*);
409 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
410 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
411 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
412 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
413 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
415 void detach_selection(HTMLDocument*);
416 void detach_ranges(HTMLDocument*);
418 HTMLElement *HTMLElement_Create(nsIDOMNode*);
419 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
420 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
421 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
422 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
423 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
424 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
425 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
426 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
428 void HTMLElement_Init(HTMLElement*);
429 void HTMLElement2_Init(HTMLElement*);
430 void HTMLTextContainer_Init(HTMLTextContainer*);
432 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
433 void HTMLDOMNode_destructor(HTMLDOMNode*);
435 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
436 void HTMLElement_destructor(HTMLDOMNode*);
438 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
439 void release_nodes(HTMLDocument*);
441 void release_script_hosts(HTMLDocument*);
442 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
444 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
446 /* commands */
447 typedef struct {
448 DWORD id;
449 HRESULT (*query)(HTMLDocument*,OLECMD*);
450 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
451 } cmdtable_t;
453 extern const cmdtable_t editmode_cmds[];
455 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
457 /* timer */
458 #define UPDATE_UI 0x0001
459 #define UPDATE_TITLE 0x0002
461 void update_doc(HTMLDocument *This, DWORD flags);
462 void update_title(HTMLDocument*);
464 /* editor */
465 void init_editor(HTMLDocument*);
466 void set_ns_editmode(NSContainer*);
467 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
468 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
469 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
470 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
471 void handle_edit_load(HTMLDocument*);
472 HRESULT editor_is_dirty(HTMLDocument*);
473 void set_dirty(HTMLDocument*,VARIANT_BOOL);
475 extern DWORD mshtml_tls;
477 typedef struct task_t {
478 HTMLDocument *doc;
480 enum {
481 TASK_SETDOWNLOADSTATE,
482 TASK_PARSECOMPLETE,
483 TASK_SETPROGRESS,
484 TASK_START_BINDING
485 } task_id;
487 nsChannelBSC *bscallback;
489 struct task_t *next;
490 } task_t;
492 typedef struct {
493 HWND thread_hwnd;
494 task_t *task_queue_head;
495 task_t *task_queue_tail;
496 } thread_data_t;
498 thread_data_t *get_thread_data(BOOL);
499 HWND get_thread_hwnd(void);
500 void push_task(task_t*);
501 void remove_doc_tasks(const HTMLDocument*);
503 /* typelibs */
504 enum tid_t {
505 IHTMLWindow2_tid,
506 LAST_tid
509 HRESULT get_typeinfo(enum tid_t, ITypeInfo**);
511 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
512 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
513 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
514 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
515 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
517 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
519 extern LONG module_ref;
520 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
521 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
523 /* memory allocation functions */
525 static inline void *heap_alloc(size_t len)
527 return HeapAlloc(GetProcessHeap(), 0, len);
530 static inline void *heap_alloc_zero(size_t len)
532 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
535 static inline void *heap_realloc(void *mem, size_t len)
537 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
540 static inline BOOL heap_free(void *mem)
542 return HeapFree(GetProcessHeap(), 0, mem);
545 static inline LPWSTR heap_strdupW(LPCWSTR str)
547 LPWSTR ret = NULL;
549 if(str) {
550 DWORD size;
552 size = (strlenW(str)+1)*sizeof(WCHAR);
553 ret = heap_alloc(size);
554 memcpy(ret, str, size);
557 return ret;
560 static inline WCHAR *heap_strdupAtoW(const char *str)
562 LPWSTR ret = NULL;
564 if(str) {
565 DWORD len;
567 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
568 ret = heap_alloc(len*sizeof(WCHAR));
569 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, -1);
572 return ret;
575 HINSTANCE get_shdoclc(void);
577 extern HINSTANCE hInst;