2011-07-23 18:40:54 +02:00
|
|
|
/*
|
2011-07-29 12:18:33 +02:00
|
|
|
* Header includes for ieframe.dll
|
2011-07-23 18:40:54 +02:00
|
|
|
*
|
|
|
|
* Copyright 2011 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
|
|
|
|
#include "ole2.h"
|
2011-07-27 14:46:48 +02:00
|
|
|
#include "olectl.h"
|
2011-07-26 12:03:49 +02:00
|
|
|
#include "shlobj.h"
|
2011-07-27 14:46:48 +02:00
|
|
|
#include "mshtmhst.h"
|
|
|
|
#include "exdisp.h"
|
|
|
|
#include "hlink.h"
|
2012-01-02 16:42:40 +01:00
|
|
|
#include "htiface.h"
|
2011-11-15 13:28:15 +01:00
|
|
|
#include "shdeprecated.h"
|
|
|
|
#include "docobjectservice.h"
|
2011-07-23 18:40:54 +02:00
|
|
|
|
2018-01-30 23:41:03 +01:00
|
|
|
#include "wine/heap.h"
|
2011-07-27 14:46:48 +02:00
|
|
|
#include "wine/list.h"
|
|
|
|
|
|
|
|
typedef struct ConnectionPoint ConnectionPoint;
|
|
|
|
typedef struct DocHost DocHost;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
IConnectionPointContainer IConnectionPointContainer_iface;
|
|
|
|
|
|
|
|
ConnectionPoint *wbe2;
|
|
|
|
ConnectionPoint *wbe;
|
|
|
|
ConnectionPoint *pns;
|
|
|
|
|
|
|
|
IUnknown *impl;
|
|
|
|
} ConnectionPointContainer;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
IHlinkFrame IHlinkFrame_iface;
|
2016-03-30 11:31:08 +02:00
|
|
|
ITargetFrame ITargetFrame_iface;
|
2011-07-27 14:46:48 +02:00
|
|
|
ITargetFrame2 ITargetFrame2_iface;
|
2012-01-02 16:42:40 +01:00
|
|
|
ITargetFramePriv2 ITargetFramePriv2_iface;
|
2014-03-13 14:13:11 +01:00
|
|
|
IWebBrowserPriv2IE9 IWebBrowserPriv2IE9_iface;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
IUnknown *outer;
|
|
|
|
DocHost *doc_host;
|
|
|
|
} HlinkFrame;
|
|
|
|
|
|
|
|
struct _task_header_t;
|
|
|
|
|
|
|
|
typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);
|
|
|
|
typedef void (*task_destr_t)(struct _task_header_t*);
|
|
|
|
|
|
|
|
typedef struct _task_header_t {
|
|
|
|
struct list entry;
|
|
|
|
task_proc_t proc;
|
|
|
|
task_destr_t destr;
|
|
|
|
} task_header_t;
|
|
|
|
|
2011-11-15 13:28:15 +01:00
|
|
|
typedef struct {
|
|
|
|
IShellBrowser IShellBrowser_iface;
|
|
|
|
IBrowserService IBrowserService_iface;
|
|
|
|
IDocObjectService IDocObjectService_iface;
|
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
DocHost *doc_host;
|
|
|
|
} ShellBrowser;
|
|
|
|
|
2012-01-06 12:59:58 +01:00
|
|
|
typedef struct {
|
|
|
|
IHTMLWindow2 IHTMLWindow2_iface;
|
|
|
|
DocHost *doc_host;
|
|
|
|
} IEHTMLWindow;
|
|
|
|
|
2012-01-06 13:00:22 +01:00
|
|
|
typedef struct {
|
|
|
|
INewWindowManager INewWindowManager_iface;
|
|
|
|
DocHost *doc_host;
|
|
|
|
} NewWindowManager;
|
|
|
|
|
2012-01-20 15:16:10 +01:00
|
|
|
typedef struct {
|
|
|
|
WCHAR *url;
|
2013-04-02 17:39:45 +02:00
|
|
|
IStream *stream;
|
2012-01-20 15:16:10 +01:00
|
|
|
} travellog_entry_t;
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
typedef struct _IDocHostContainerVtbl
|
|
|
|
{
|
|
|
|
ULONG (*addref)(DocHost*);
|
|
|
|
ULONG (*release)(DocHost*);
|
2015-11-09 17:53:11 +01:00
|
|
|
void (*get_docobj_rect)(DocHost*,RECT*);
|
|
|
|
HRESULT (*set_status_text)(DocHost*,const WCHAR*);
|
2015-11-09 17:53:00 +01:00
|
|
|
void (*on_command_state_change)(DocHost*,LONG,BOOL);
|
2015-11-09 17:53:11 +01:00
|
|
|
void (*set_url)(DocHost*,const WCHAR*);
|
2011-07-27 14:46:48 +02:00
|
|
|
} IDocHostContainerVtbl;
|
|
|
|
|
|
|
|
struct DocHost {
|
|
|
|
IOleClientSite IOleClientSite_iface;
|
|
|
|
IOleInPlaceSiteEx IOleInPlaceSiteEx_iface;
|
|
|
|
IDocHostUIHandler2 IDocHostUIHandler2_iface;
|
|
|
|
IOleDocumentSite IOleDocumentSite_iface;
|
|
|
|
IOleControlSite IOleControlSite_iface;
|
|
|
|
IOleCommandTarget IOleCommandTarget_iface;
|
|
|
|
IDispatch IDispatch_iface;
|
|
|
|
IPropertyNotifySink IPropertyNotifySink_iface;
|
|
|
|
IServiceProvider IServiceProvider_iface;
|
|
|
|
|
|
|
|
/* Interfaces of InPlaceFrame object */
|
|
|
|
IOleInPlaceFrame IOleInPlaceFrame_iface;
|
|
|
|
|
2012-01-09 17:56:05 +01:00
|
|
|
IWebBrowser2 *wb;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
IDispatch *client_disp;
|
|
|
|
IDocHostUIHandler *hostui;
|
|
|
|
IOleInPlaceFrame *frame;
|
2015-08-14 16:30:45 +02:00
|
|
|
IOleCommandTarget *olecmd;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
IUnknown *document;
|
|
|
|
IOleDocumentView *view;
|
|
|
|
IUnknown *doc_navigate;
|
|
|
|
|
|
|
|
const IDocHostContainerVtbl *container_vtbl;
|
|
|
|
|
|
|
|
HWND hwnd;
|
|
|
|
HWND frame_hwnd;
|
|
|
|
|
|
|
|
struct list task_queue;
|
|
|
|
|
|
|
|
LPOLESTR url;
|
|
|
|
|
|
|
|
VARIANT_BOOL silent;
|
|
|
|
VARIANT_BOOL offline;
|
|
|
|
VARIANT_BOOL busy;
|
|
|
|
|
|
|
|
READYSTATE ready_state;
|
|
|
|
READYSTATE doc_state;
|
|
|
|
DWORD prop_notif_cookie;
|
|
|
|
BOOL is_prop_notif;
|
|
|
|
|
2011-11-15 13:28:15 +01:00
|
|
|
ShellBrowser *browser_service;
|
2012-05-16 13:21:02 +02:00
|
|
|
IShellUIHelper2 *shell_ui_helper;
|
2011-11-15 13:28:15 +01:00
|
|
|
|
2013-04-02 17:39:07 +02:00
|
|
|
struct {
|
|
|
|
travellog_entry_t *log;
|
|
|
|
unsigned size;
|
|
|
|
unsigned length;
|
|
|
|
unsigned position;
|
2013-04-02 17:39:21 +02:00
|
|
|
int loading_pos;
|
2013-04-02 17:39:07 +02:00
|
|
|
} travellog;
|
2012-01-20 15:16:10 +01:00
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
ConnectionPointContainer cps;
|
2012-01-06 12:59:58 +01:00
|
|
|
IEHTMLWindow html_window;
|
2012-01-06 13:00:22 +01:00
|
|
|
NewWindowManager nwm;
|
2011-07-27 14:46:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct WebBrowser {
|
2019-12-10 13:44:44 +01:00
|
|
|
IUnknown IUnknown_inner;
|
2011-07-27 14:46:48 +02:00
|
|
|
IWebBrowser2 IWebBrowser2_iface;
|
|
|
|
IOleObject IOleObject_iface;
|
|
|
|
IOleInPlaceObject IOleInPlaceObject_iface;
|
|
|
|
IOleControl IOleControl_iface;
|
|
|
|
IPersistStorage IPersistStorage_iface;
|
|
|
|
IPersistMemory IPersistMemory_iface;
|
|
|
|
IPersistStreamInit IPersistStreamInit_iface;
|
|
|
|
IProvideClassInfo2 IProvideClassInfo2_iface;
|
|
|
|
IViewObject2 IViewObject2_iface;
|
|
|
|
IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
|
|
|
|
IOleCommandTarget IOleCommandTarget_iface;
|
|
|
|
IServiceProvider IServiceProvider_iface;
|
|
|
|
IDataObject IDataObject_iface;
|
|
|
|
HlinkFrame hlink_frame;
|
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
INT version;
|
|
|
|
|
|
|
|
IOleClientSite *client;
|
2016-04-11 18:46:09 +02:00
|
|
|
IOleClientSite *client_closed;
|
2011-07-27 14:46:48 +02:00
|
|
|
IOleContainer *container;
|
|
|
|
IOleInPlaceSiteEx *inplace;
|
|
|
|
|
2015-07-17 12:35:45 +02:00
|
|
|
IAdviseSink *sink;
|
|
|
|
DWORD sink_aspects;
|
|
|
|
DWORD sink_flags;
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
/* window context */
|
|
|
|
|
|
|
|
HWND frame_hwnd;
|
|
|
|
IOleInPlaceUIWindow *uiwindow;
|
|
|
|
RECT pos_rect;
|
|
|
|
RECT clip_rect;
|
|
|
|
OLEINPLACEFRAMEINFO frameinfo;
|
|
|
|
SIZEL extent;
|
|
|
|
|
|
|
|
HWND shell_embedding_hwnd;
|
|
|
|
|
|
|
|
VARIANT_BOOL register_browser;
|
|
|
|
VARIANT_BOOL visible;
|
|
|
|
VARIANT_BOOL menu_bar;
|
|
|
|
VARIANT_BOOL address_bar;
|
|
|
|
VARIANT_BOOL status_bar;
|
|
|
|
VARIANT_BOOL tool_bar;
|
|
|
|
VARIANT_BOOL full_screen;
|
|
|
|
VARIANT_BOOL theater_mode;
|
|
|
|
|
|
|
|
DocHost doc_host;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct InternetExplorer {
|
2013-05-24 10:39:31 +02:00
|
|
|
DocHost doc_host;
|
2011-07-27 14:46:48 +02:00
|
|
|
IWebBrowser2 IWebBrowser2_iface;
|
2013-05-10 10:42:20 +02:00
|
|
|
IExternalConnection IExternalConnection_iface;
|
2012-01-06 12:59:23 +01:00
|
|
|
IServiceProvider IServiceProvider_iface;
|
2011-07-27 14:46:48 +02:00
|
|
|
HlinkFrame hlink_frame;
|
|
|
|
|
|
|
|
LONG ref;
|
2013-05-24 10:39:20 +02:00
|
|
|
LONG extern_ref;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
HWND frame_hwnd;
|
|
|
|
HWND status_hwnd;
|
2015-11-09 17:52:46 +01:00
|
|
|
HWND toolbar_hwnd;
|
2011-07-27 14:46:48 +02:00
|
|
|
HMENU menu;
|
|
|
|
BOOL nohome;
|
|
|
|
|
|
|
|
struct list entry;
|
|
|
|
};
|
|
|
|
|
|
|
|
void WebBrowser_OleObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
|
|
|
|
void WebBrowser_ViewObject_Init(WebBrowser*) DECLSPEC_HIDDEN;
|
|
|
|
void WebBrowser_Persist_Init(WebBrowser*) DECLSPEC_HIDDEN;
|
|
|
|
void WebBrowser_ClassInfo_Init(WebBrowser*) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
void WebBrowser_OleObject_Destroy(WebBrowser*) DECLSPEC_HIDDEN;
|
|
|
|
|
2012-01-09 17:56:05 +01:00
|
|
|
void DocHost_Init(DocHost*,IWebBrowser2*,const IDocHostContainerVtbl*) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
void DocHost_Release(DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
void DocHost_ClientSite_Init(DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
void DocHost_ClientSite_Release(DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
void DocHost_Frame_Init(DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
void release_dochost_client(DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
|
2012-01-06 12:59:58 +01:00
|
|
|
void IEHTMLWindow_Init(DocHost*) DECLSPEC_HIDDEN;
|
2012-01-06 13:00:22 +01:00
|
|
|
void NewWindowManager_Init(DocHost*) DECLSPEC_HIDDEN;
|
2012-01-06 12:59:58 +01:00
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN;
|
|
|
|
|
2011-11-15 13:28:15 +01:00
|
|
|
HRESULT create_browser_service(DocHost*,ShellBrowser**) DECLSPEC_HIDDEN;
|
|
|
|
void detach_browser_service(ShellBrowser*) DECLSPEC_HIDDEN;
|
2012-05-16 13:21:02 +02:00
|
|
|
HRESULT create_shell_ui_helper(IShellUIHelper2**) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN;
|
|
|
|
void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT go_home(DocHost*) DECLSPEC_HIDDEN;
|
2012-01-20 15:16:10 +01:00
|
|
|
HRESULT go_back(DocHost*) DECLSPEC_HIDDEN;
|
2013-04-02 17:40:14 +02:00
|
|
|
HRESULT go_forward(DocHost*) DECLSPEC_HIDDEN;
|
2014-09-25 13:38:24 +02:00
|
|
|
HRESULT refresh_document(DocHost*,const VARIANT*) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN;
|
2011-11-15 13:28:47 +01:00
|
|
|
HRESULT set_dochost_url(DocHost*,const WCHAR*) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT dochost_object_available(DocHost*,IUnknown*) DECLSPEC_HIDDEN;
|
|
|
|
void set_doc_state(DocHost*,READYSTATE) DECLSPEC_HIDDEN;
|
|
|
|
void deactivate_document(DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
void create_doc_view_hwnd(DocHost*) DECLSPEC_HIDDEN;
|
2015-11-25 10:04:59 +01:00
|
|
|
void on_commandstate_change(DocHost*,LONG,BOOL) DECLSPEC_HIDDEN;
|
2015-08-14 16:30:57 +02:00
|
|
|
void notify_download_state(DocHost*,BOOL) DECLSPEC_HIDDEN;
|
2015-08-18 14:01:01 +02:00
|
|
|
void update_navigation_commands(DocHost *dochost) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
#define WM_DOCHOSTTASK (WM_USER+0x300)
|
|
|
|
void push_dochost_task(DocHost*,task_header_t*,task_proc_t,task_destr_t,BOOL) DECLSPEC_HIDDEN;
|
|
|
|
void abort_dochost_tasks(DocHost*,task_proc_t) DECLSPEC_HIDDEN;
|
|
|
|
LRESULT process_dochost_tasks(DocHost*) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
void InternetExplorer_WebBrowser_Init(InternetExplorer*) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR) DECLSPEC_HIDDEN;
|
|
|
|
void released_obj(void) DECLSPEC_HIDDEN;
|
2013-05-24 10:39:20 +02:00
|
|
|
DWORD release_extern_ref(InternetExplorer*,BOOL) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
void register_iewindow_class(void) DECLSPEC_HIDDEN;
|
|
|
|
void unregister_iewindow_class(void) DECLSPEC_HIDDEN;
|
|
|
|
|
2012-02-10 12:36:29 +01:00
|
|
|
#define TID_LIST \
|
2012-02-10 12:36:53 +01:00
|
|
|
XCLSID(WebBrowser) \
|
|
|
|
XCLSID(WebBrowser_V1) \
|
2012-02-10 12:36:29 +01:00
|
|
|
XIID(IWebBrowser2)
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
#define XIID(iface) iface ## _tid,
|
2012-02-10 12:36:53 +01:00
|
|
|
#define XCLSID(class) class ## _tid,
|
2012-02-10 12:36:29 +01:00
|
|
|
TID_LIST
|
|
|
|
#undef XIID
|
2012-02-10 12:36:53 +01:00
|
|
|
#undef XCLSID
|
2012-02-10 12:36:29 +01:00
|
|
|
LAST_tid
|
|
|
|
} tid_t;
|
|
|
|
|
|
|
|
HRESULT get_typeinfo(tid_t,ITypeInfo**) DECLSPEC_HIDDEN;
|
2011-07-23 18:40:54 +02:00
|
|
|
|
2011-07-26 12:03:33 +02:00
|
|
|
HRESULT WINAPI CUrlHistory_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
HRESULT WINAPI InternetExplorer_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
2011-07-26 12:03:33 +02:00
|
|
|
HRESULT WINAPI InternetShortcut_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
HRESULT WINAPI WebBrowser_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
|
|
|
HRESULT WINAPI WebBrowserV1_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
2017-09-15 18:33:19 +02:00
|
|
|
HRESULT WINAPI InternetExplorerManager_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
extern IClassFactory InternetExplorerFactory DECLSPEC_HIDDEN;
|
|
|
|
extern IClassFactory InternetExplorerManagerFactory DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
|
2011-07-23 18:40:54 +02:00
|
|
|
extern LONG module_ref DECLSPEC_HIDDEN;
|
2011-07-27 14:46:48 +02:00
|
|
|
extern HINSTANCE ieframe_instance DECLSPEC_HIDDEN;
|
2011-07-23 18:40:54 +02:00
|
|
|
|
|
|
|
static inline void lock_module(void) {
|
|
|
|
InterlockedIncrement(&module_ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void unlock_module(void) {
|
|
|
|
InterlockedDecrement(&module_ref);
|
|
|
|
}
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
static inline LPWSTR heap_strdupW(LPCWSTR str)
|
|
|
|
{
|
|
|
|
LPWSTR ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD size;
|
|
|
|
|
2019-06-05 08:39:04 +02:00
|
|
|
size = (lstrlenW(str)+1)*sizeof(WCHAR);
|
2011-07-27 14:46:48 +02:00
|
|
|
ret = heap_alloc(size);
|
|
|
|
if(ret)
|
|
|
|
memcpy(ret, str, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-07-23 18:40:54 +02:00
|
|
|
static inline LPWSTR co_strdupW(LPCWSTR str)
|
|
|
|
{
|
2019-06-05 08:39:04 +02:00
|
|
|
WCHAR *ret = CoTaskMemAlloc((lstrlenW(str) + 1)*sizeof(WCHAR));
|
2011-07-23 18:40:54 +02:00
|
|
|
if (ret)
|
|
|
|
lstrcpyW(ret, str);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline LPWSTR co_strdupAtoW(LPCSTR str)
|
|
|
|
{
|
|
|
|
INT len;
|
|
|
|
WCHAR *ret;
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
|
|
|
ret = CoTaskMemAlloc(len*sizeof(WCHAR));
|
|
|
|
if (ret)
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline LPSTR co_strdupWtoA(LPCWSTR str)
|
|
|
|
{
|
|
|
|
INT len;
|
|
|
|
CHAR *ret;
|
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
|
|
|
|
ret = CoTaskMemAlloc(len);
|
|
|
|
if (ret)
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
|
|
|
|
return ret;
|
|
|
|
}
|