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 */
69 typedef struct dispex_data_t dispex_data_t;
74 const tid_t iface_tids[];
75 } dispex_static_data_t;
78 const IDispatchExVtbl *lpIDispatchExVtbl;
82 dispex_static_data_t *data;
85 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
88 const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;
89 const IHTMLWindow3Vtbl *lpHTMLWindow3Vtbl;
94 nsIDOMWindow *nswindow;
108 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
110 ConnectionPoint *cp_list;
112 } ConnectionPointContainer;
114 struct ConnectionPoint {
115 const IConnectionPointVtbl *lpConnectionPointVtbl;
117 IConnectionPointContainer *container;
122 IPropertyNotifySink *propnotif;
128 ConnectionPoint *next;
132 const IHTMLLocationVtbl *lpHTMLLocationVtbl;
140 const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
145 } HTMLOptionElementFactory;
147 struct HTMLDocument {
148 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
149 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
150 const IHTMLDocument4Vtbl *lpHTMLDocument4Vtbl;
151 const IHTMLDocument5Vtbl *lpHTMLDocument5Vtbl;
152 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
153 const IPersistFileVtbl *lpPersistFileVtbl;
154 const IMonikerPropVtbl *lpMonikerPropVtbl;
155 const IOleObjectVtbl *lpOleObjectVtbl;
156 const IOleDocumentVtbl *lpOleDocumentVtbl;
157 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
158 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
159 const IViewObject2Vtbl *lpViewObject2Vtbl;
160 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
161 const IServiceProviderVtbl *lpServiceProviderVtbl;
162 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
163 const IOleControlVtbl *lpOleControlVtbl;
164 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
165 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
166 const ICustomDocVtbl *lpCustomDocVtbl;
170 NSContainer *nscontainer;
173 IOleClientSite *client;
174 IDocHostUIHandler *hostui;
175 IOleInPlaceSite *ipsite;
176 IOleInPlaceFrame *frame;
177 IOleInPlaceUIWindow *ip_window;
179 IOleUndoManager *undomgr;
181 nsChannelBSC *bscallback;
184 struct list bindings;
186 struct list script_hosts;
191 DOCHOSTUIINFO hostinfo;
194 READYSTATE readystate;
195 BOOL in_place_active;
199 BOOL container_locked;
205 ConnectionPointContainer cp_container;
206 ConnectionPoint cp_htmldocevents;
207 ConnectionPoint cp_htmldocevents2;
208 ConnectionPoint cp_propnotif;
210 HTMLOptionElementFactory *option_factory;
211 HTMLLocation *location;
213 struct list selection_list;
214 struct list range_list;
220 const nsIDOMEventListenerVtbl *lpDOMEventListenerVtbl;
225 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
226 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
227 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
228 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
229 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
230 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
231 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
232 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
234 nsEventListener blur_listener;
235 nsEventListener focus_listener;
236 nsEventListener keypress_listener;
237 nsEventListener load_listener;
238 nsEventListener node_insert_listener;
240 nsIWebBrowser *webbrowser;
241 nsIWebNavigation *navigation;
242 nsIBaseWindow *window;
243 nsIWebBrowserFocus *focus;
246 nsIController *editor_controller;
253 nsIURIContentListener *content_listener;
257 nsChannelBSC *bscallback; /* hack */
258 HWND reset_focus; /* hack */
262 const nsIHttpChannelVtbl *lpHttpChannelVtbl;
263 const nsIUploadChannelVtbl *lpUploadChannelVtbl;
268 nsIHttpChannel *http_channel;
270 nsIInputStream *post_data_stream;
271 nsILoadGroup *load_group;
272 nsIInterfaceRequestor *notif_callback;
273 nsLoadFlags load_flags;
274 nsIURI *original_uri;
280 HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
281 void (*destructor)(HTMLDOMNode*);
285 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
286 const NodeImplVtbl *vtbl;
292 event_target_t *event_target;
299 ConnectionPointContainer cp_container;
301 const IHTMLElementVtbl *lpHTMLElementVtbl;
302 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
304 nsIDOMHTMLElement *nselem;
310 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
315 #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
316 #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
318 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
319 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
320 #define HTMLDOC4(x) ((IHTMLDocument4*) &(x)->lpHTMLDocument4Vtbl)
321 #define HTMLDOC5(x) ((IHTMLDocument5*) &(x)->lpHTMLDocument5Vtbl)
322 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
323 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
324 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
325 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
326 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
327 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
328 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
329 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
330 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
331 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
332 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
333 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
334 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
335 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
336 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
337 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
338 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
339 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
340 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
341 #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl)
343 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
344 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
345 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
346 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
347 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
348 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
349 #define NSEVENTLIST(x) ((nsIDOMEventListener*) &(x)->lpDOMEventListenerVtbl)
350 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
351 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
353 #define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
354 #define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
355 #define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
357 #define HTTPNEG(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
358 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
359 #define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl);
361 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
362 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
363 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
365 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
367 #define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
368 #define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
370 #define DISPATCHEX(x) ((IDispatchEx*) &(x)->lpIDispatchExVtbl)
372 #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
373 #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
375 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
376 HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
378 HTMLWindow *HTMLWindow_Create(HTMLDocument*);
379 HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
380 HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
381 HTMLLocation *HTMLLocation_Create(HTMLDocument*);
382 IOmNavigator *OmNavigator_Create(void);
383 void setup_nswindow(HTMLWindow*);
385 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
386 void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
387 void HTMLDocument_Persist_Init(HTMLDocument*);
388 void HTMLDocument_OleCmd_Init(HTMLDocument*);
389 void HTMLDocument_OleObj_Init(HTMLDocument*);
390 void HTMLDocument_View_Init(HTMLDocument*);
391 void HTMLDocument_Window_Init(HTMLDocument*);
392 void HTMLDocument_Service_Init(HTMLDocument*);
393 void HTMLDocument_Hlink_Init(HTMLDocument*);
395 void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID);
396 void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
397 void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
399 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
400 void NSContainer_Release(NSContainer*);
402 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
403 void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
404 void notif_focus(HTMLDocument*);
406 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
407 void hide_tooltip(HTMLDocument*);
408 HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
410 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
412 BOOL load_gecko(BOOL);
413 void close_gecko(void);
414 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
415 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
416 BOOL install_wine_gecko(BOOL);
418 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
420 void call_property_onchanged(ConnectionPoint*,DISPID);
421 HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
423 void *nsalloc(size_t);
426 void nsACString_Init(nsACString*,const char*);
427 void nsACString_SetData(nsACString*,const char*);
428 PRUint32 nsACString_GetData(const nsACString*,const char**);
429 void nsACString_Finish(nsACString*);
431 void nsAString_Init(nsAString*,const PRUnichar*);
432 void nsAString_SetData(nsAString*,const PRUnichar*);
433 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
434 void nsAString_Finish(nsAString*);
436 nsIInputStream *create_nsstream(const char*,PRInt32);
437 nsICommandParams *create_nscommand_params(void);
438 nsIMutableArray *create_nsarray(void);
439 nsIWritableVariant *create_nsvariant(void);
440 void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
441 void get_editor_controller(NSContainer*);
442 void init_nsevents(NSContainer*);
443 nsresult get_nsinterface(nsISupports*,REFIID,void**);
450 void check_event_attr(HTMLDocument*,nsIDOMElement*);
451 void release_event_target(event_target_t*);
452 void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*);
454 void set_document_bscallback(HTMLDocument*,nsChannelBSC*);
455 void set_current_mon(HTMLDocument*,IMoniker*);
456 HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
458 HRESULT bind_mon_to_buffer(HTMLDocument*,IMoniker*,void**,DWORD*);
460 nsChannelBSC *create_channelbsc(IMoniker*);
461 HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
462 void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
463 IMoniker *get_channelbsc_mon(nsChannelBSC*);
465 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
466 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
467 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
468 IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
469 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
471 void detach_selection(HTMLDocument*);
472 void detach_ranges(HTMLDocument*);
474 HTMLElement *HTMLElement_Create(nsIDOMNode*);
475 HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
476 HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
477 HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
478 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
479 HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement*);
480 HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
481 HTMLElement *HTMLTable_Create(nsIDOMHTMLElement*);
482 HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
484 void HTMLElement_Init(HTMLElement*);
485 void HTMLElement2_Init(HTMLElement*);
486 void HTMLTextContainer_Init(HTMLTextContainer*);
488 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
489 void HTMLDOMNode_destructor(HTMLDOMNode*);
491 HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
492 void HTMLElement_destructor(HTMLDOMNode*);
494 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
495 void release_nodes(HTMLDocument*);
497 void release_script_hosts(HTMLDocument*);
498 void connect_scripts(HTMLDocument*);
499 void doc_insert_script(HTMLDocument*,nsIDOMHTMLScriptElement*);
500 IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
502 IHTMLElementCollection *create_all_collection(HTMLDOMNode*);
507 HRESULT (*query)(HTMLDocument*,OLECMD*);
508 HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
511 extern const cmdtable_t editmode_cmds[];
513 void do_ns_command(NSContainer*,const char*,nsICommandParams*);
516 #define UPDATE_UI 0x0001
517 #define UPDATE_TITLE 0x0002
519 void update_doc(HTMLDocument *This, DWORD flags);
520 void update_title(HTMLDocument*);
523 void init_editor(HTMLDocument*);
524 void set_ns_editmode(NSContainer*);
525 void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
526 HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
527 HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
528 HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
529 void handle_edit_load(HTMLDocument*);
530 HRESULT editor_is_dirty(HTMLDocument*);
531 void set_dirty(HTMLDocument*,VARIANT_BOOL);
533 extern DWORD mshtml_tls;
535 typedef struct task_t {
539 TASK_SETDOWNLOADSTATE,
545 nsChannelBSC *bscallback;
552 task_t *task_queue_head;
553 task_t *task_queue_tail;
556 thread_data_t *get_thread_data(BOOL);
557 HWND get_thread_hwnd(void);
558 void push_task(task_t*);
559 void remove_doc_tasks(const HTMLDocument*);
561 HRESULT get_typeinfo(tid_t,ITypeInfo**);
562 void release_typelib(void);
563 void call_disp_func(HTMLDocument*,IDispatch*);
565 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
566 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
567 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
568 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
569 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
571 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
573 extern LONG module_ref;
574 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
575 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
577 /* memory allocation functions */
579 static inline void *heap_alloc(size_t len)
581 return HeapAlloc(GetProcessHeap(), 0, len);
584 static inline void *heap_alloc_zero(size_t len)
586 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
589 static inline void *heap_realloc(void *mem, size_t len)
591 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
594 static inline BOOL heap_free(void *mem)
596 return HeapFree(GetProcessHeap(), 0, mem);
599 static inline LPWSTR heap_strdupW(LPCWSTR str)
606 size = (strlenW(str)+1)*sizeof(WCHAR);
607 ret = heap_alloc(size);
608 memcpy(ret, str, size);
614 static inline char *heap_strdupA(const char *str)
621 size = strlen(str)+1;
622 ret = heap_alloc(size);
623 memcpy(ret, str, size);
629 static inline WCHAR *heap_strdupAtoW(const char *str)
636 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
637 ret = heap_alloc(len*sizeof(WCHAR));
638 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
644 static inline char *heap_strdupWtoA(LPCWSTR str)
649 DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
650 ret = heap_alloc(size);
651 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
657 HINSTANCE get_shdoclc(void);
659 extern HINSTANCE hInst;