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
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 */
68 const IDispatchExVtbl
*lpIDispatchExVtbl
;
73 void init_dispex(DispatchEx
*,IUnknown
*);
76 const IHTMLWindow2Vtbl
*lpHTMLWindow2Vtbl
;
77 const IHTMLWindow3Vtbl
*lpHTMLWindow3Vtbl
;
82 nsIDOMWindow
*nswindow
;
94 const IConnectionPointContainerVtbl
*lpConnectionPointContainerVtbl
;
96 ConnectionPoint
*cp_list
;
98 } ConnectionPointContainer
;
100 struct ConnectionPoint
{
101 const IConnectionPointVtbl
*lpConnectionPointVtbl
;
103 IConnectionPointContainer
*container
;
108 IPropertyNotifySink
*propnotif
;
114 ConnectionPoint
*next
;
118 const IHTMLLocationVtbl
*lpHTMLLocationVtbl
;
126 const IHTMLOptionElementFactoryVtbl
*lpHTMLOptionElementFactoryVtbl
;
131 } HTMLOptionElementFactory
;
133 struct HTMLDocument
{
134 const IHTMLDocument2Vtbl
*lpHTMLDocument2Vtbl
;
135 const IHTMLDocument3Vtbl
*lpHTMLDocument3Vtbl
;
136 const IHTMLDocument4Vtbl
*lpHTMLDocument4Vtbl
;
137 const IHTMLDocument5Vtbl
*lpHTMLDocument5Vtbl
;
138 const IPersistMonikerVtbl
*lpPersistMonikerVtbl
;
139 const IPersistFileVtbl
*lpPersistFileVtbl
;
140 const IMonikerPropVtbl
*lpMonikerPropVtbl
;
141 const IOleObjectVtbl
*lpOleObjectVtbl
;
142 const IOleDocumentVtbl
*lpOleDocumentVtbl
;
143 const IOleDocumentViewVtbl
*lpOleDocumentViewVtbl
;
144 const IOleInPlaceActiveObjectVtbl
*lpOleInPlaceActiveObjectVtbl
;
145 const IViewObject2Vtbl
*lpViewObject2Vtbl
;
146 const IOleInPlaceObjectWindowlessVtbl
*lpOleInPlaceObjectWindowlessVtbl
;
147 const IServiceProviderVtbl
*lpServiceProviderVtbl
;
148 const IOleCommandTargetVtbl
*lpOleCommandTargetVtbl
;
149 const IOleControlVtbl
*lpOleControlVtbl
;
150 const IHlinkTargetVtbl
*lpHlinkTargetVtbl
;
151 const IPersistStreamInitVtbl
*lpPersistStreamInitVtbl
;
152 const ICustomDocVtbl
*lpCustomDocVtbl
;
156 NSContainer
*nscontainer
;
159 IOleClientSite
*client
;
160 IDocHostUIHandler
*hostui
;
161 IOleInPlaceSite
*ipsite
;
162 IOleInPlaceFrame
*frame
;
163 IOleInPlaceUIWindow
*ip_window
;
165 IOleUndoManager
*undomgr
;
167 nsChannelBSC
*bscallback
;
170 struct list bindings
;
172 struct list script_hosts
;
177 DOCHOSTUIINFO hostinfo
;
180 READYSTATE readystate
;
181 BOOL in_place_active
;
185 BOOL container_locked
;
191 ConnectionPointContainer cp_container
;
192 ConnectionPoint cp_htmldocevents
;
193 ConnectionPoint cp_htmldocevents2
;
194 ConnectionPoint cp_propnotif
;
196 HTMLOptionElementFactory
*option_factory
;
197 HTMLLocation
*location
;
199 struct list selection_list
;
200 struct list range_list
;
206 const nsIDOMEventListenerVtbl
*lpDOMEventListenerVtbl
;
211 const nsIWebBrowserChromeVtbl
*lpWebBrowserChromeVtbl
;
212 const nsIContextMenuListenerVtbl
*lpContextMenuListenerVtbl
;
213 const nsIURIContentListenerVtbl
*lpURIContentListenerVtbl
;
214 const nsIEmbeddingSiteWindowVtbl
*lpEmbeddingSiteWindowVtbl
;
215 const nsITooltipListenerVtbl
*lpTooltipListenerVtbl
;
216 const nsIInterfaceRequestorVtbl
*lpInterfaceRequestorVtbl
;
217 const nsIWeakReferenceVtbl
*lpWeakReferenceVtbl
;
218 const nsISupportsWeakReferenceVtbl
*lpSupportsWeakReferenceVtbl
;
220 nsEventListener blur_listener
;
221 nsEventListener focus_listener
;
222 nsEventListener keypress_listener
;
223 nsEventListener load_listener
;
224 nsEventListener node_insert_listener
;
226 nsIWebBrowser
*webbrowser
;
227 nsIWebNavigation
*navigation
;
228 nsIBaseWindow
*window
;
229 nsIWebBrowserFocus
*focus
;
232 nsIController
*editor_controller
;
239 nsIURIContentListener
*content_listener
;
243 nsChannelBSC
*bscallback
; /* hack */
244 HWND reset_focus
; /* hack */
248 const nsIHttpChannelVtbl
*lpHttpChannelVtbl
;
249 const nsIUploadChannelVtbl
*lpUploadChannelVtbl
;
254 nsIHttpChannel
*http_channel
;
256 nsIInputStream
*post_data_stream
;
257 nsILoadGroup
*load_group
;
258 nsIInterfaceRequestor
*notif_callback
;
259 nsLoadFlags load_flags
;
260 nsIURI
*original_uri
;
266 HRESULT (*qi
)(HTMLDOMNode
*,REFIID
,void**);
267 void (*destructor
)(HTMLDOMNode
*);
271 const IHTMLDOMNodeVtbl
*lpHTMLDOMNodeVtbl
;
272 const NodeImplVtbl
*vtbl
;
278 event_target_t
*event_target
;
285 ConnectionPointContainer cp_container
;
287 const IHTMLElementVtbl
*lpHTMLElementVtbl
;
288 const IHTMLElement2Vtbl
*lpHTMLElement2Vtbl
;
290 nsIDOMHTMLElement
*nselem
;
296 const IHTMLTextContainerVtbl
*lpHTMLTextContainerVtbl
;
301 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
302 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
304 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
305 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
306 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
307 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
308 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
309 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
310 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
311 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
312 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
313 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
314 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
315 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
316 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
317 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
318 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
319 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
320 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
321 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
322 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
323 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
324 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
325 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
326 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
327 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
329 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
330 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
331 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
332 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
333 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
334 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
335 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
336 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
337 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
339 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
340 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
341 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
343 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
344 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
345 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
347 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
348 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
349 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
351 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
353 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
354 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
356 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
358 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
359 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
361 HRESULT
HTMLDocument_Create(IUnknown
*,REFIID
,void**);
362 HRESULT
HTMLLoadOptions_Create(IUnknown
*,REFIID
,void**);
364 HTMLWindow
*HTMLWindow_Create(HTMLDocument
*);
365 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*);
366 HTMLOptionElementFactory
*HTMLOptionElementFactory_Create(HTMLDocument
*);
367 HTMLLocation
*HTMLLocation_Create(HTMLDocument
*);
368 IOmNavigator
*OmNavigator_Create(void);
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);
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 void check_event_attr(HTMLDocument
*,nsIDOMElement
*);
432 void release_event_target(event_target_t
*);
434 void set_document_bscallback(HTMLDocument
*,nsChannelBSC
*);
435 void set_current_mon(HTMLDocument
*,IMoniker
*);
436 HRESULT
start_binding(HTMLDocument
*,BSCallback
*,IBindCtx
*);
438 HRESULT
bind_mon_to_buffer(HTMLDocument
*,IMoniker
*,void**,DWORD
*);
440 nsChannelBSC
*create_channelbsc(IMoniker
*);
441 HRESULT
channelbsc_load_stream(nsChannelBSC
*,IStream
*);
442 void channelbsc_set_channel(nsChannelBSC
*,nsChannel
*,nsIStreamListener
*,nsISupports
*);
443 IMoniker
*get_channelbsc_mon(nsChannelBSC
*);
445 IHTMLSelectionObject
*HTMLSelectionObject_Create(HTMLDocument
*,nsISelection
*);
446 IHTMLTxtRange
*HTMLTxtRange_Create(HTMLDocument
*,nsIDOMRange
*);
447 IHTMLStyle
*HTMLStyle_Create(nsIDOMCSSStyleDeclaration
*);
448 IHTMLStyleSheet
*HTMLStyleSheet_Create(nsIDOMStyleSheet
*);
449 IHTMLStyleSheetsCollection
*HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList
*);
451 void detach_selection(HTMLDocument
*);
452 void detach_ranges(HTMLDocument
*);
454 HTMLElement
*HTMLElement_Create(nsIDOMNode
*);
455 HTMLElement
*HTMLAnchorElement_Create(nsIDOMHTMLElement
*);
456 HTMLElement
*HTMLBodyElement_Create(nsIDOMHTMLElement
*);
457 HTMLElement
*HTMLInputElement_Create(nsIDOMHTMLElement
*);
458 HTMLElement
*HTMLOptionElement_Create(nsIDOMHTMLElement
*);
459 HTMLElement
*HTMLScriptElement_Create(nsIDOMHTMLElement
*);
460 HTMLElement
*HTMLSelectElement_Create(nsIDOMHTMLElement
*);
461 HTMLElement
*HTMLTable_Create(nsIDOMHTMLElement
*);
462 HTMLElement
*HTMLTextAreaElement_Create(nsIDOMHTMLElement
*);
464 void HTMLElement_Init(HTMLElement
*);
465 void HTMLElement2_Init(HTMLElement
*);
466 void HTMLTextContainer_Init(HTMLTextContainer
*);
468 HRESULT
HTMLDOMNode_QI(HTMLDOMNode
*,REFIID
,void**);
469 void HTMLDOMNode_destructor(HTMLDOMNode
*);
471 HRESULT
HTMLElement_QI(HTMLDOMNode
*,REFIID
,void**);
472 void HTMLElement_destructor(HTMLDOMNode
*);
474 HTMLDOMNode
*get_node(HTMLDocument
*,nsIDOMNode
*,BOOL
);
475 void release_nodes(HTMLDocument
*);
477 void release_script_hosts(HTMLDocument
*);
478 void connect_scripts(HTMLDocument
*);
479 void doc_insert_script(HTMLDocument
*,nsIDOMHTMLScriptElement
*);
480 IDispatch
*script_parse_event(HTMLDocument
*,LPCWSTR
);
482 IHTMLElementCollection
*create_all_collection(HTMLDOMNode
*);
487 HRESULT (*query
)(HTMLDocument
*,OLECMD
*);
488 HRESULT (*exec
)(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
491 extern const cmdtable_t editmode_cmds
[];
493 void do_ns_command(NSContainer
*,const char*,nsICommandParams
*);
496 #define UPDATE_UI 0x0001
497 #define UPDATE_TITLE 0x0002
499 void update_doc(HTMLDocument
*This
, DWORD flags
);
500 void update_title(HTMLDocument
*);
503 void init_editor(HTMLDocument
*);
504 void set_ns_editmode(NSContainer
*);
505 void handle_edit_event(HTMLDocument
*,nsIDOMEvent
*);
506 HRESULT
editor_exec_copy(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
507 HRESULT
editor_exec_cut(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
508 HRESULT
editor_exec_paste(HTMLDocument
*,DWORD
,VARIANT
*,VARIANT
*);
509 void handle_edit_load(HTMLDocument
*);
510 HRESULT
editor_is_dirty(HTMLDocument
*);
511 void set_dirty(HTMLDocument
*,VARIANT_BOOL
);
513 extern DWORD mshtml_tls
;
515 typedef struct task_t
{
519 TASK_SETDOWNLOADSTATE
,
525 nsChannelBSC
*bscallback
;
532 task_t
*task_queue_head
;
533 task_t
*task_queue_tail
;
536 thread_data_t
*get_thread_data(BOOL
);
537 HWND
get_thread_hwnd(void);
538 void push_task(task_t
*);
539 void remove_doc_tasks(const HTMLDocument
*);
541 HRESULT
get_typeinfo(tid_t
,ITypeInfo
**);
542 void release_typelib(void);
544 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
545 DEFINE_GUID(CLSID_JSProtocol
, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
546 DEFINE_GUID(CLSID_MailtoProtocol
, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
547 DEFINE_GUID(CLSID_ResProtocol
, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
548 DEFINE_GUID(CLSID_SysimageProtocol
, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
550 DEFINE_GUID(CLSID_CMarkup
,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
552 extern LONG module_ref
;
553 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
554 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
556 /* memory allocation functions */
558 static inline void *heap_alloc(size_t len
)
560 return HeapAlloc(GetProcessHeap(), 0, len
);
563 static inline void *heap_alloc_zero(size_t len
)
565 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
568 static inline void *heap_realloc(void *mem
, size_t len
)
570 return HeapReAlloc(GetProcessHeap(), 0, mem
, len
);
573 static inline BOOL
heap_free(void *mem
)
575 return HeapFree(GetProcessHeap(), 0, mem
);
578 static inline LPWSTR
heap_strdupW(LPCWSTR str
)
585 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
586 ret
= heap_alloc(size
);
587 memcpy(ret
, str
, size
);
593 static inline char *heap_strdupA(const char *str
)
600 size
= strlen(str
)+1;
601 ret
= heap_alloc(size
);
602 memcpy(ret
, str
, size
);
608 static inline WCHAR
*heap_strdupAtoW(const char *str
)
615 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
616 ret
= heap_alloc(len
*sizeof(WCHAR
));
617 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
623 static inline char *heap_strdupWtoA(LPCWSTR str
)
628 DWORD size
= WideCharToMultiByte(CP_ACP
, 0, str
, -1, NULL
, 0, NULL
, NULL
);
629 ret
= heap_alloc(size
);
630 WideCharToMultiByte(CP_ACP
, 0, str
, -1, ret
, size
, NULL
, NULL
);
636 HINSTANCE
get_shdoclc(void);
638 extern HINSTANCE hInst
;