diff --git a/dlls/ieframe/Makefile.in b/dlls/ieframe/Makefile.in index a310dd9424b..7d730e68ead 100644 --- a/dlls/ieframe/Makefile.in +++ b/dlls/ieframe/Makefile.in @@ -1,12 +1,25 @@ MODULE = ieframe.dll IMPORTLIB = ieframe -IMPORTS = uuid urlmon shell32 ole32 advapi32 +IMPORTS = uuid urlmon shell32 comctl32 shlwapi oleaut32 ole32 user32 gdi32 advapi32 C_SRCS = \ + classinfo.c \ + client.c \ + dochost.c \ + events.c \ + frame.c \ + ie.c \ ieframe_main.c \ + iexplore.c \ intshcut.c \ + navigate.c \ + oleobject.c \ + persist.c \ + shellbrowser.c \ taskbarlist.c \ - urlhist.c + urlhist.c \ + view.c \ + webbrowser.c RC_SRCS = \ De.rc \ diff --git a/dlls/shdocvw/classinfo.c b/dlls/ieframe/classinfo.c similarity index 96% rename from dlls/shdocvw/classinfo.c rename to dlls/ieframe/classinfo.c index 6092c7dbf22..8e687540e32 100644 --- a/dlls/shdocvw/classinfo.c +++ b/dlls/ieframe/classinfo.c @@ -18,12 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "ieframe.h" -#include "windef.h" -#include "winbase.h" -#include "shdocvw.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); diff --git a/dlls/shdocvw/client.c b/dlls/ieframe/client.c similarity index 99% rename from dlls/shdocvw/client.c rename to dlls/ieframe/client.c index 9b1b71c3a90..e9d6ad9ae2f 100644 --- a/dlls/shdocvw/client.c +++ b/dlls/ieframe/client.c @@ -18,11 +18,13 @@ #include -#include "wine/debug.h" -#include "shdocvw.h" +#include "ieframe.h" + #include "mshtmdid.h" #include "idispids.h" +#include "wine/debug.h" + WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static inline DocHost *impl_from_IOleClientSite(IOleClientSite *iface) diff --git a/dlls/shdocvw/dochost.c b/dlls/ieframe/dochost.c similarity index 99% rename from dlls/shdocvw/dochost.c rename to dlls/ieframe/dochost.c index 2ab79758d95..ffe65a17162 100644 --- a/dlls/shdocvw/dochost.c +++ b/dlls/ieframe/dochost.c @@ -16,13 +16,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/debug.h" -#include "shdocvw.h" -#include "hlink.h" +#include "ieframe.h" + #include "exdispid.h" #include "mshtml.h" #include "initguid.h" +#include "wine/debug.h" + WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0); @@ -340,7 +341,7 @@ void create_doc_view_hwnd(DocHost *This) NULL }; - wndclass.hInstance = shdocvw_hinstance; + wndclass.hInstance = ieframe_instance; doc_view_atom = RegisterClassExW(&wndclass); } @@ -350,7 +351,7 @@ void create_doc_view_hwnd(DocHost *This) wszShell_DocObject_View, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP, rect.left, rect.top, rect.right, rect.bottom, This->frame_hwnd, - NULL, shdocvw_hinstance, This); + NULL, ieframe_instance, This); } void deactivate_document(DocHost *This) diff --git a/dlls/shdocvw/events.c b/dlls/ieframe/events.c similarity index 99% rename from dlls/shdocvw/events.c rename to dlls/ieframe/events.c index 694e300dfed..d2c6f1f68ec 100644 --- a/dlls/shdocvw/events.c +++ b/dlls/ieframe/events.c @@ -23,8 +23,10 @@ */ #include + +#include "ieframe.h" + #include "wine/debug.h" -#include "shdocvw.h" WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); diff --git a/dlls/shdocvw/frame.c b/dlls/ieframe/frame.c similarity index 99% rename from dlls/shdocvw/frame.c rename to dlls/ieframe/frame.c index 2323772ef30..ef060640fee 100644 --- a/dlls/shdocvw/frame.c +++ b/dlls/ieframe/frame.c @@ -16,8 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "ieframe.h" + #include "wine/debug.h" -#include "shdocvw.h" WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); diff --git a/dlls/shdocvw/ie.c b/dlls/ieframe/ie.c similarity index 99% rename from dlls/shdocvw/ie.c rename to dlls/ieframe/ie.c index 780c2c93e37..c1f9cfdf79d 100644 --- a/dlls/shdocvw/ie.c +++ b/dlls/ieframe/ie.c @@ -16,8 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "ieframe.h" + #include "wine/debug.h" -#include "shdocvw.h" WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); diff --git a/dlls/ieframe/ieframe.h b/dlls/ieframe/ieframe.h index f4493695634..f657ce46b28 100644 --- a/dlls/ieframe/ieframe.h +++ b/dlls/ieframe/ieframe.h @@ -29,15 +29,231 @@ #include "winuser.h" #include "ole2.h" +#include "olectl.h" #include "shlobj.h" +#include "mshtmhst.h" +#include "exdisp.h" +#include "hlink.h" +#include "htiframe.h" #include "wine/unicode.h" +#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; + ITargetFrame2 ITargetFrame2_iface; + + 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; + +typedef struct _IDocHostContainerVtbl +{ + ULONG (*addref)(DocHost*); + ULONG (*release)(DocHost*); + void (WINAPI* GetDocObjRect)(DocHost*,RECT*); + HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR); + void (WINAPI* SetURL)(DocHost*,LPCWSTR); + HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*); +} 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; + + IDispatch *disp; + + IDispatch *client_disp; + IDocHostUIHandler *hostui; + IOleInPlaceFrame *frame; + + 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; + + ConnectionPointContainer cps; +}; + +struct WebBrowser { + 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; + IOleContainer *container; + IOleInPlaceSiteEx *inplace; + + /* 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; +}; + +typedef struct { + DocHost doc_host; + + LONG ref; + + InternetExplorer *ie; +} IEDocHost; + +struct InternetExplorer { + IWebBrowser2 IWebBrowser2_iface; + HlinkFrame hlink_frame; + + LONG ref; + + HWND frame_hwnd; + HWND status_hwnd; + HMENU menu; + BOOL nohome; + + struct list entry; + IEDocHost *doc_host; +}; + +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; + +void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*) DECLSPEC_HIDDEN; +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; + +void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN; +BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN; + +HRESULT ShellBrowser_Create(IShellBrowser**) DECLSPEC_HIDDEN; + +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; +HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN; +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; + +#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; + +void register_iewindow_class(void) DECLSPEC_HIDDEN; +void unregister_iewindow_class(void) DECLSPEC_HIDDEN; + +HRESULT get_typeinfo(ITypeInfo**) DECLSPEC_HIDDEN; +HRESULT register_class_object(BOOL) DECLSPEC_HIDDEN; HRESULT WINAPI CUrlHistory_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; +HRESULT WINAPI InternetExplorer_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT WINAPI InternetShortcut_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT WINAPI TaskbarList_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; +HRESULT WINAPI WebBrowser_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; +HRESULT WINAPI WebBrowserV1_Create(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; + +const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN; extern LONG module_ref DECLSPEC_HIDDEN; +extern HINSTANCE ieframe_instance DECLSPEC_HIDDEN; static inline void lock_module(void) { InterlockedIncrement(&module_ref); @@ -57,11 +273,32 @@ static inline void *heap_alloc_zero(size_t len) return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } +static inline void *heap_realloc(void *mem, size_t len) +{ + return HeapReAlloc(GetProcessHeap(), 0, mem, len); +} + static inline BOOL heap_free(void *mem) { return HeapFree(GetProcessHeap(), 0, mem); } +static inline LPWSTR heap_strdupW(LPCWSTR str) +{ + LPWSTR ret = NULL; + + if(str) { + DWORD size; + + size = (strlenW(str)+1)*sizeof(WCHAR); + ret = heap_alloc(size); + if(ret) + memcpy(ret, str, size); + } + + return ret; +} + static inline LPWSTR co_strdupW(LPCWSTR str) { WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR)); diff --git a/dlls/ieframe/ieframe.spec b/dlls/ieframe/ieframe.spec index b0220786404..59e783f5d1d 100644 --- a/dlls/ieframe/ieframe.spec +++ b/dlls/ieframe/ieframe.spec @@ -1,3 +1,6 @@ +# ordinal exports +101 stdcall -noname IEWinMain(str long) + @ stdcall -private DllCanUnloadNow() @ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllRegisterServer() diff --git a/dlls/ieframe/ieframe_main.c b/dlls/ieframe/ieframe_main.c index 1b8a3d7dd41..4f4aaf8ab2b 100644 --- a/dlls/ieframe/ieframe_main.c +++ b/dlls/ieframe/ieframe_main.c @@ -26,6 +26,57 @@ WINE_DEFAULT_DEBUG_CHANNEL(ieframe); LONG module_ref = 0; +HINSTANCE ieframe_instance; + +const char *debugstr_variant(const VARIANT *v) +{ + if(!v) + return "(null)"; + + switch(V_VT(v)) { + case VT_EMPTY: + return "{VT_EMPTY}"; + case VT_NULL: + return "{VT_NULL}"; + case VT_I4: + return wine_dbg_sprintf("{VT_I4: %d}", V_I4(v)); + case VT_R8: + return wine_dbg_sprintf("{VT_R8: %lf}", V_R8(v)); + case VT_BSTR: + return wine_dbg_sprintf("{VT_BSTR: %s}", debugstr_w(V_BSTR(v))); + case VT_DISPATCH: + return wine_dbg_sprintf("{VT_DISPATCH: %p}", V_DISPATCH(v)); + case VT_BOOL: + return wine_dbg_sprintf("{VT_BOOL: %x}", V_BOOL(v)); + default: + return wine_dbg_sprintf("{vt %d}", V_VT(v)); + } +} + +static ITypeInfo *wb_typeinfo = NULL; + +HRESULT get_typeinfo(ITypeInfo **typeinfo) +{ + ITypeLib *typelib; + HRESULT hres; + + if(wb_typeinfo) { + *typeinfo = wb_typeinfo; + return S_OK; + } + + hres = LoadRegTypeLib(&LIBID_SHDocVw, 1, 1, LOCALE_SYSTEM_DEFAULT, &typelib); + if(FAILED(hres)) { + ERR("LoadRegTypeLib failed: %08x\n", hres); + return hres; + } + + hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IWebBrowser2, &wb_typeinfo); + ITypeLib_Release(typelib); + + *typeinfo = wb_typeinfo; + return hres; +} static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) { @@ -66,6 +117,26 @@ static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock) return S_OK; } +static const IClassFactoryVtbl WebBrowserFactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + WebBrowser_Create, + ClassFactory_LockServer +}; + +static IClassFactory WebBrowserFactory = { &WebBrowserFactoryVtbl }; + +static const IClassFactoryVtbl WebBrowserV1FactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + WebBrowserV1_Create, + ClassFactory_LockServer +}; + +static IClassFactory WebBrowserV1Factory = { &WebBrowserV1FactoryVtbl }; + static const IClassFactoryVtbl InternetShortcutFactoryVtbl = { ClassFactory_QueryInterface, ClassFactory_AddRef, @@ -108,8 +179,14 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hInstDLL); + ieframe_instance = hInstDLL; + register_iewindow_class(); + DisableThreadLibraryCalls(ieframe_instance); break; + case DLL_PROCESS_DETACH: + unregister_iewindow_class(); + if(wb_typeinfo) + ITypeInfo_Release(wb_typeinfo); } return TRUE; @@ -120,6 +197,17 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { + if(IsEqualGUID(&CLSID_WebBrowser, rclsid)) { + TRACE("(CLSID_WebBrowser %s %p)\n", debugstr_guid(riid), ppv); + return IClassFactory_QueryInterface(&WebBrowserFactory, riid, ppv); + } + + if(IsEqualGUID(&CLSID_WebBrowser_V1, rclsid)) { + TRACE("(CLSID_WebBrowser_V1 %s %p)\n", debugstr_guid(riid), ppv); + return IClassFactory_QueryInterface(&WebBrowserV1Factory, riid, ppv); + } + + if(IsEqualGUID(rclsid, &CLSID_InternetShortcut)) { TRACE("(CLSID_InternetShortcut %s %p)\n", debugstr_guid(riid), ppv); return IClassFactory_QueryInterface(&InternetShortcutFactory, riid, ppv); @@ -140,6 +228,41 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return CLASS_E_CLASSNOTAVAILABLE; } +static const IClassFactoryVtbl InternetExplorerFactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + InternetExplorer_Create, + ClassFactory_LockServer +}; + +static IClassFactory InternetExplorerFactory = { &InternetExplorerFactoryVtbl }; + +HRESULT register_class_object(BOOL do_reg) +{ + HRESULT hres; + + static DWORD cookie; + + if(do_reg) { + hres = CoRegisterClassObject(&CLSID_InternetExplorer, + (IUnknown*)&InternetExplorerFactory, CLSCTX_SERVER, + REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie); + if (FAILED(hres)) { + ERR("failed to register object %08x\n", hres); + return hres; + } + + hres = CoResumeClassObjects(); + if(SUCCEEDED(hres)) + return hres; + + ERR("failed to resume object %08x\n", hres); + } + + return CoRevokeClassObject(cookie); +} + /*********************************************************************** * DllCanUnloadNow (ieframe.@) */ diff --git a/dlls/shdocvw/iexplore.c b/dlls/ieframe/iexplore.c similarity index 94% rename from dlls/shdocvw/iexplore.c rename to dlls/ieframe/iexplore.c index 449b95d9353..76bef14178b 100644 --- a/dlls/shdocvw/iexplore.c +++ b/dlls/ieframe/iexplore.c @@ -1,5 +1,5 @@ /* - * SHDOCVW - Internet Explorer main frame window + * ieframe - Internet Explorer main frame window * * Copyright 2006 Mike McCormack (for CodeWeavers) * Copyright 2006 Jacek Caban (for CodeWeavers) @@ -22,8 +22,10 @@ #define COBJMACROS #include -#include "windef.h" -#include "winbase.h" + +#include "ieframe.h" +#include "resource.h" + #include "winuser.h" #include "wingdi.h" #include "winnls.h" @@ -31,7 +33,6 @@ #include "exdisp.h" #include "oleidl.h" -#include "shdocvw.h" #include "mshtmcid.h" #include "shellapi.h" #include "winreg.h" @@ -45,6 +46,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); #define IDI_APPICON 1 +#define WM_UPDATEADDRBAR (WM_APP+1) + static const WCHAR szIEWinFrame[] = { 'I','E','F','r','a','m','e',0 }; /* Windows uses "Microsoft Internet Explorer" */ @@ -54,7 +57,7 @@ static const WCHAR wszWineInternetExplorer[] = static LONG obj_cnt; static DWORD dde_inst; static HSZ ddestr_iexplore, ddestr_openurl; -static struct list ie_list; +static struct list ie_list = LIST_INIT(ie_list); HRESULT update_ie_statustext(InternetExplorer* This, LPCWSTR text) { @@ -314,7 +317,7 @@ static void add_tbs_to_menu(HMENU menu) static HMENU create_ie_menu(void) { - HMENU menu = LoadMenuW(get_ieframe_instance(), MAKEINTRESOURCEW(IDR_BROWSE_MAIN_MENU)); + HMENU menu = LoadMenuW(ieframe_instance, MAKEINTRESOURCEW(IDR_BROWSE_MAIN_MENU)); HMENU favmenu = get_fav_menu(menu); WCHAR path[MAX_PATH]; @@ -415,7 +418,7 @@ static void add_tb_button(HWND hwnd, int bmp, int cmd, int strId) TBBUTTON btn; WCHAR buf[30]; - LoadStringW(get_ieframe_instance(), strId, buf, sizeof(buf)/sizeof(buf[0])); + LoadStringW(ieframe_instance, strId, buf, sizeof(buf)/sizeof(buf[0])); btn.iBitmap = bmp; btn.idCommand = cmd; @@ -438,9 +441,11 @@ static void create_rebar(HWND hwnd) HIMAGELIST imagelist; WCHAR idb_ietoolbar[] = {'I','D','B','_','I','E','T','O','O','L','B','A','R',0}; - LoadStringW(get_ieframe_instance(), IDS_ADDRESS, addr, sizeof(addr)/sizeof(addr[0])); + LoadStringW(ieframe_instance, IDS_ADDRESS, addr, sizeof(addr)/sizeof(addr[0])); - hwndRebar = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAMEW, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|RBS_VARHEIGHT|CCS_TOP|CCS_NODIVIDER, 0, 0, 0, 0, hwnd, (HMENU)IDC_BROWSE_REBAR, shdocvw_hinstance, NULL); + hwndRebar = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAMEW, NULL, + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|RBS_VARHEIGHT|CCS_TOP|CCS_NODIVIDER, 0, 0, 0, 0, + hwnd, (HMENU)IDC_BROWSE_REBAR, ieframe_instance, NULL); rebarinf.cbSize = sizeof(rebarinf); rebarinf.fMask = 0; @@ -449,9 +454,10 @@ static void create_rebar(HWND hwnd) SendMessageW(hwndRebar, RB_SETBARINFO, 0, (LPARAM)&rebarinf); - hwndToolbar = CreateWindowExW(TBSTYLE_EX_MIXEDBUTTONS, TOOLBARCLASSNAMEW, NULL, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndRebar, (HMENU)IDC_BROWSE_TOOLBAR, shdocvw_hinstance, NULL); + hwndToolbar = CreateWindowExW(TBSTYLE_EX_MIXEDBUTTONS, TOOLBARCLASSNAMEW, NULL, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE, + 0, 0, 0, 0, hwndRebar, (HMENU)IDC_BROWSE_TOOLBAR, ieframe_instance, NULL); - imagelist = ImageList_LoadImageW(shdocvw_hinstance, idb_ietoolbar, 32, 0, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION); + imagelist = ImageList_LoadImageW(ieframe_instance, idb_ietoolbar, 32, 0, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION); SendMessageW(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)imagelist); SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); @@ -474,7 +480,8 @@ static void create_rebar(HWND hwnd) SendMessageW(hwndRebar, RB_INSERTBANDW, -1, (LPARAM)&bandinf); - hwndAddress = CreateWindowExW(0, WC_COMBOBOXEXW, NULL, WS_BORDER|WS_CHILD|WS_VISIBLE|CBS_DROPDOWN, 0, 0, 100,20,hwndRebar, (HMENU)IDC_BROWSE_ADDRESSBAR, shdocvw_hinstance, NULL); + hwndAddress = CreateWindowExW(0, WC_COMBOBOXEXW, NULL, WS_BORDER|WS_CHILD|WS_VISIBLE|CBS_DROPDOWN, + 0, 0, 100,20,hwndRebar, (HMENU)IDC_BROWSE_ADDRESSBAR, ieframe_instance, NULL); bandinf.fMask |= RBBIM_TEXT; bandinf.fStyle = RBBS_CHILDEDGE | RBBS_BREAK; @@ -566,7 +573,7 @@ static LRESULT iewnd_OnCommand(InternetExplorer *This, HWND hwnd, UINT msg, WPAR switch(LOWORD(wparam)) { case ID_BROWSE_OPEN: - DialogBoxParamW(get_ieframe_instance(), MAKEINTRESOURCEW(IDD_BROWSE_OPEN), hwnd, ie_dialog_open_proc, (LPARAM)This); + DialogBoxParamW(ieframe_instance, MAKEINTRESOURCEW(IDD_BROWSE_OPEN), hwnd, ie_dialog_open_proc, (LPARAM)This); break; case ID_BROWSE_PRINT: @@ -620,8 +627,7 @@ static LRESULT update_addrbar(InternetExplorer *This, LPARAM lparam) return 0; } -static LRESULT CALLBACK -ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +static LRESULT WINAPI ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { InternetExplorer *This = (InternetExplorer*) GetWindowLongPtrW(hwnd, 0); @@ -666,7 +672,7 @@ void register_iewindow_class(void) wc.lpfnWndProc = ie_window_proc; wc.cbClsExtra = 0; wc.cbWndExtra = sizeof(InternetExplorer*); - wc.hInstance = shdocvw_hinstance; + wc.hInstance = ieframe_instance; wc.hIcon = LoadIconW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDI_APPICON)); wc.hIconSm = LoadImageW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDI_APPICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); @@ -680,7 +686,7 @@ void register_iewindow_class(void) void unregister_iewindow_class(void) { - UnregisterClassW(szIEWinFrame, shdocvw_hinstance); + UnregisterClassW(szIEWinFrame, ieframe_instance); } static void create_frame_hwnd(InternetExplorer *This) @@ -691,7 +697,7 @@ static void create_frame_hwnd(InternetExplorer *This) WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL /* FIXME */, shdocvw_hinstance, This); + NULL, NULL /* FIXME */, ieframe_instance, This); } static inline IEDocHost *impl_from_DocHost(DocHost *iface) @@ -795,7 +801,7 @@ static HRESULT create_ie(InternetExplorer **ret_obj) return S_OK; } -HRESULT InternetExplorer_Create(IUnknown *pOuter, REFIID riid, void **ppv) +HRESULT WINAPI InternetExplorer_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv) { InternetExplorer *ret; HRESULT hres; @@ -1014,22 +1020,13 @@ static void release_dde(void) * * Only returns on error. */ -DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow) +DWORD WINAPI IEWinMain(const char *szCommandLine, int nShowWindow) { MSG msg; HRESULT hres; TRACE("%s %d\n", debugstr_a(szCommandLine), nShowWindow); - list_init(&ie_list); - - if(*szCommandLine == '-' || *szCommandLine == '/') { - if(!strcasecmp(szCommandLine+1, "regserver")) - return register_iexplore(TRUE); - if(!strcasecmp(szCommandLine+1, "unregserver")) - return register_iexplore(FALSE); - } - CoInitialize(NULL); hres = register_class_object(TRUE); diff --git a/dlls/shdocvw/navigate.c b/dlls/ieframe/navigate.c similarity index 99% rename from dlls/shdocvw/navigate.c rename to dlls/ieframe/navigate.c index 1f8e6a44a72..35c550df933 100644 --- a/dlls/shdocvw/navigate.c +++ b/dlls/ieframe/navigate.c @@ -19,9 +19,8 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include "wine/debug.h" +#include "ieframe.h" -#include "shdocvw.h" #include "exdispid.h" #include "shellapi.h" #include "winreg.h" @@ -29,6 +28,8 @@ #include "wininet.h" #include "mshtml.h" +#include "wine/debug.h" + WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static const WCHAR emptyW[] = {0}; @@ -560,7 +561,7 @@ static BOOL try_application_url(LPCWSTR url) return FALSE; TRACE("openning application %s\n", debugstr_w(app)); - + memset(&exec_info, 0, sizeof(exec_info)); exec_info.cbSize = sizeof(exec_info); exec_info.lpFile = url; @@ -840,7 +841,7 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags, TRACE("navigating to %s\n", debugstr_w(url)); - if((Flags && V_VT(Flags) != VT_EMPTY) + if((Flags && V_VT(Flags) != VT_EMPTY) || (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY)) FIXME("Unsupported args (Flags %p:%d; TargetFrameName %p:%d)\n", Flags, Flags ? V_VT(Flags) : -1, TargetFrameName, diff --git a/dlls/shdocvw/oleobject.c b/dlls/ieframe/oleobject.c similarity index 99% rename from dlls/shdocvw/oleobject.c rename to dlls/ieframe/oleobject.c index b1164869ab9..e4ee7173c20 100644 --- a/dlls/shdocvw/oleobject.c +++ b/dlls/ieframe/oleobject.c @@ -24,12 +24,15 @@ */ #include -#include "wine/debug.h" -#include "shdocvw.h" + +#include "ieframe.h" + #include "htiframe.h" #include "idispids.h" #include "mshtmdid.h" +#include "wine/debug.h" + WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); /* shlwapi.dll */ @@ -88,7 +91,7 @@ static void create_shell_embedding_hwnd(WebBrowser *This) wszShellEmbedding, NULL }; - wndclass.hInstance = shdocvw_hinstance; + wndclass.hInstance = ieframe_instance; RegisterClassExW(&wndclass); } @@ -105,7 +108,7 @@ static void create_shell_embedding_hwnd(WebBrowser *This) WS_CLIPSIBLINGS | WS_CLIPCHILDREN | (parent ? WS_CHILD | WS_TABSTOP : WS_POPUP | WS_MAXIMIZEBOX), 0, 0, 0, 0, parent, - NULL, shdocvw_hinstance, This); + NULL, ieframe_instance, This); TRACE("parent=%p hwnd=%p\n", parent, This->shell_embedding_hwnd); } diff --git a/dlls/shdocvw/persist.c b/dlls/ieframe/persist.c similarity index 99% rename from dlls/shdocvw/persist.c rename to dlls/ieframe/persist.c index c525934de0a..93716bbc08d 100644 --- a/dlls/shdocvw/persist.c +++ b/dlls/ieframe/persist.c @@ -19,8 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "ieframe.h" + #include "wine/debug.h" -#include "shdocvw.h" WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); diff --git a/dlls/shdocvw/shellbrowser.c b/dlls/ieframe/shellbrowser.c similarity index 99% rename from dlls/shdocvw/shellbrowser.c rename to dlls/ieframe/shellbrowser.c index 1ccf379229e..48f0e203741 100644 --- a/dlls/shdocvw/shellbrowser.c +++ b/dlls/ieframe/shellbrowser.c @@ -18,11 +18,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/debug.h" -#include "shdocvw.h" +#include "ieframe.h" + #include "shdeprecated.h" #include "docobjectservice.h" +#include "wine/debug.h" + WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); typedef struct { diff --git a/dlls/shdocvw/view.c b/dlls/ieframe/view.c similarity index 99% rename from dlls/shdocvw/view.c rename to dlls/ieframe/view.c index 8c9a59b13ae..5d0c87d24e1 100644 --- a/dlls/shdocvw/view.c +++ b/dlls/ieframe/view.c @@ -17,8 +17,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "ieframe.h" + #include "wine/debug.h" -#include "shdocvw.h" WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); diff --git a/dlls/shdocvw/webbrowser.c b/dlls/ieframe/webbrowser.c similarity index 98% rename from dlls/shdocvw/webbrowser.c rename to dlls/ieframe/webbrowser.c index 5df1f03296a..c398786f895 100644 --- a/dlls/shdocvw/webbrowser.c +++ b/dlls/ieframe/webbrowser.c @@ -19,12 +19,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "wine/debug.h" -#include "shdocvw.h" +#include "ieframe.h" + #include "exdispid.h" #include "mshtml.h" #include "shdeprecated.h" +#include "wine/debug.h" + WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); static inline WebBrowser *impl_from_IWebBrowser2(IWebBrowser2 *iface) @@ -173,7 +175,7 @@ static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface) WebBrowser_OleObject_Destroy(This); heap_free(This); - SHDOCVW_UnlockModule(); + unlock_module(); } return ref; @@ -1234,12 +1236,12 @@ static const IDocHostContainerVtbl DocHostContainerVtbl = { DocHostContainer_exec }; -static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv) +static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void **ppv) { WebBrowser *ret; HRESULT hres; - TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version); + TRACE("(%p %s %p) version=%d\n", outer, debugstr_guid(riid), ppv, version); ret = heap_alloc_zero(sizeof(WebBrowser)); @@ -1263,7 +1265,7 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)&ret->IWebBrowser2_iface, &ret->doc_host); - SHDOCVW_LockModule(); + lock_module(); hres = IWebBrowser_QueryInterface(&ret->IWebBrowser2_iface, riid, ppv); @@ -1271,12 +1273,12 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi return hres; } -HRESULT WebBrowserV1_Create(IUnknown *pOuter, REFIID riid, void **ppv) +HRESULT WINAPI WebBrowserV1_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv) { - return WebBrowser_Create(1, pOuter, riid, ppv); + return create_webbrowser(1, pOuter, riid, ppv); } -HRESULT WebBrowserV2_Create(IUnknown *pOuter, REFIID riid, void **ppv) +HRESULT WINAPI WebBrowser_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv) { - return WebBrowser_Create(2, pOuter, riid, ppv); + return create_webbrowser(2, pOuter, riid, ppv); } diff --git a/dlls/shdocvw/Makefile.in b/dlls/shdocvw/Makefile.in index 894585b110c..d7f160e5553 100644 --- a/dlls/shdocvw/Makefile.in +++ b/dlls/shdocvw/Makefile.in @@ -1,26 +1,13 @@ EXTRADEFS = -D_SHDOCVW_ MODULE = shdocvw.dll IMPORTLIB = shdocvw -IMPORTS = uuid shell32 comctl32 shlwapi user32 gdi32 advapi32 -DELAYIMPORTS = version urlmon ole32 oleaut32 ieframe +IMPORTS = uuid shlwapi +DELAYIMPORTS = version ole32 oleaut32 ieframe C_SRCS = \ - classinfo.c \ - client.c \ - dochost.c \ - events.c \ factory.c \ - frame.c \ - ie.c \ - iexplore.c \ - navigate.c \ - oleobject.c \ - persist.c \ shdocvw_main.c \ - shellbrowser.c \ - shlinstobj.c \ - view.c \ - webbrowser.c + shlinstobj.c RC_SRCS = \ shdocvw.rc diff --git a/dlls/shdocvw/factory.c b/dlls/shdocvw/factory.c index 32888132bfe..5c0f106521e 100644 --- a/dlls/shdocvw/factory.c +++ b/dlls/shdocvw/factory.c @@ -37,97 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); * Implement the WebBrowser class factory */ -typedef struct -{ - /* IUnknown fields */ - IClassFactory IClassFactory_iface; - HRESULT (*cf)(LPUNKNOWN, REFIID, LPVOID *); - LONG ref; -} IClassFactoryImpl; - -static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) -{ - return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface); -} - - -/********************************************************************** - * WBCF_QueryInterface (IUnknown) - */ -static HRESULT WINAPI WBCF_QueryInterface(LPCLASSFACTORY iface, - REFIID riid, LPVOID *ppobj) -{ - TRACE("(%s %p)\n", debugstr_guid(riid), ppobj); - - if (!ppobj) - return E_POINTER; - - if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) { - *ppobj = iface; - IClassFactory_AddRef(iface); - return S_OK; - } - - WARN("Not supported interface %s\n", debugstr_guid(riid)); - - *ppobj = NULL; - return E_NOINTERFACE; -} - -/************************************************************************ - * WBCF_AddRef (IUnknown) - */ -static ULONG WINAPI WBCF_AddRef(LPCLASSFACTORY iface) -{ - SHDOCVW_LockModule(); - - return 2; /* non-heap based object */ -} - -/************************************************************************ - * WBCF_Release (IUnknown) - */ -static ULONG WINAPI WBCF_Release(LPCLASSFACTORY iface) -{ - SHDOCVW_UnlockModule(); - - return 1; /* non-heap based object */ -} - -/************************************************************************ - * WBCF_CreateInstance (IClassFactory) - */ -static HRESULT WINAPI WBCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, - REFIID riid, LPVOID *ppobj) -{ - IClassFactoryImpl *This = (IClassFactoryImpl *) iface; - return This->cf(pOuter, riid, ppobj); -} - -/************************************************************************ - * WBCF_LockServer (IClassFactory) - */ -static HRESULT WINAPI WBCF_LockServer(LPCLASSFACTORY iface, BOOL dolock) -{ - TRACE("(%d)\n", dolock); - - if (dolock) - SHDOCVW_LockModule(); - else - SHDOCVW_UnlockModule(); - - return S_OK; -} - -static const IClassFactoryVtbl WBCF_Vtbl = -{ - WBCF_QueryInterface, - WBCF_AddRef, - WBCF_Release, - WBCF_CreateInstance, - WBCF_LockServer -}; - static HRESULT get_ieframe_object(REFCLSID rclsid, REFIID riid, void **ppv) { HINSTANCE ieframe_instance; @@ -152,18 +61,11 @@ static HRESULT get_ieframe_object(REFCLSID rclsid, REFIID riid, void **ppv) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) { - static IClassFactoryImpl WB1ClassFactory = {{&WBCF_Vtbl}, WebBrowserV1_Create}; - static IClassFactoryImpl WB2ClassFactory = {{&WBCF_Vtbl}, WebBrowserV2_Create}; - TRACE("\n"); - if(IsEqualGUID(&CLSID_WebBrowser, rclsid)) - return IClassFactory_QueryInterface(&WB2ClassFactory.IClassFactory_iface, riid, ppv); - - if(IsEqualGUID(&CLSID_WebBrowser_V1, rclsid)) - return IClassFactory_QueryInterface(&WB1ClassFactory.IClassFactory_iface, riid, ppv); - - if(IsEqualGUID(&CLSID_InternetShortcut, rclsid) + if(IsEqualGUID(&CLSID_WebBrowser, rclsid) + || IsEqualGUID(&CLSID_WebBrowser_V1, rclsid) + || IsEqualGUID(&CLSID_InternetShortcut, rclsid) || IsEqualGUID(&CLSID_CUrlHistory, rclsid) || IsEqualGUID(&CLSID_TaskbarList, rclsid)) return get_ieframe_object(rclsid, riid, ppv); @@ -172,32 +74,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv) return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv); } -HRESULT register_class_object(BOOL do_reg) -{ - HRESULT hres; - - static DWORD cookie; - static IClassFactoryImpl IEClassFactory = {{&WBCF_Vtbl}, InternetExplorer_Create}; - - if(do_reg) { - hres = CoRegisterClassObject(&CLSID_InternetExplorer, - (IUnknown*)&IEClassFactory.IClassFactory_iface, CLSCTX_SERVER, - REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie); - if (FAILED(hres)) { - ERR("failed to register object %08x\n", hres); - return hres; - } - - hres = CoResumeClassObjects(); - if(SUCCEEDED(hres)) - return hres; - - ERR("failed to resume object %08x\n", hres); - } - - return CoRevokeClassObject(cookie); -} - static HRESULT reg_install(LPCSTR section, STRTABLEA *strtable) { HRESULT (WINAPI *pRegInstall)(HMODULE hm, LPCSTR pszSection, const STRTABLEA* pstTable); @@ -313,7 +189,7 @@ static BOOL check_native_ie(void) return ret; } -DWORD register_iexplore(BOOL doregister) +static DWORD register_iexplore(BOOL doregister) { HRESULT hres; if (check_native_ie()) @@ -324,3 +200,28 @@ DWORD register_iexplore(BOOL doregister) hres = reg_install(doregister ? "RegisterIE" : "UnregisterIE", NULL); return FAILED(hres); } + +/****************************************************************** + * IEWinMain (SHDOCVW.101) + * + * Only returns on error. + */ +DWORD WINAPI IEWinMain(LPSTR szCommandLine, int nShowWindow) +{ + DWORD (WINAPI *pIEWinMain)(LPSTR,int); + + TRACE("%s %d\n", debugstr_a(szCommandLine), nShowWindow); + + if(*szCommandLine == '-' || *szCommandLine == '/') { + if(!strcasecmp(szCommandLine+1, "regserver")) + return register_iexplore(TRUE); + if(!strcasecmp(szCommandLine+1, "unregserver")) + return register_iexplore(FALSE); + } + + pIEWinMain = (void*)GetProcAddress(get_ieframe_instance(), MAKEINTRESOURCEA(101)); + if(!pIEWinMain) + ExitProcess(1); + + return pIEWinMain(szCommandLine, nShowWindow); +} diff --git a/dlls/shdocvw/resource.h b/dlls/shdocvw/resource.h deleted file mode 100644 index 5a24925245b..00000000000 --- a/dlls/shdocvw/resource.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Resource identifiers for shdocvw.dll - * - * Copyright 2010 Alexander N. Sørnes - * - * 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 -#include - -#define IDR_BROWSE_MAIN_MENU 1000 -#define IDD_BROWSE_OPEN 1001 -#define IDC_BROWSE_OPEN_URL 1002 -#define IDC_BROWSE_REBAR 1003 -#define IDC_BROWSE_ADDRESSBAR 1004 -#define IDC_BROWSE_STATUSBAR 1005 -#define IDC_BROWSE_TOOLBAR 1006 - -#define ID_BROWSE_NEW_WINDOW 275 -#define ID_BROWSE_OPEN 256 -#define ID_BROWSE_SAVE 257 -#define ID_BROWSE_SAVE_AS 258 -#define ID_BROWSE_PRINT_FORMAT 259 -#define ID_BROWSE_PRINT 260 -#define ID_BROWSE_PRINT_PREVIEW 277 -#define ID_BROWSE_PROPERTIES 262 -#define ID_BROWSE_QUIT 278 -#define ID_BROWSE_ABOUT 336 - -#define ID_BROWSE_ADDFAV 1200 -#define ID_BROWSE_HOME 1201 - -#define ID_BROWSE_BAR_STD 1300 -#define ID_BROWSE_BAR_ADDR 1301 - -#define ID_BROWSE_GOTOFAV_FIRST 2000 -#define ID_BROWSE_GOTOFAV_MAX 65000 - -#define IDS_TB_BACK 1100 -#define IDS_TB_FORWARD 1101 -#define IDS_TB_STOP 1102 -#define IDS_TB_REFRESH 1103 -#define IDS_TB_HOME 1104 -#define IDS_TB_PRINT 1105 - -#define IDS_ADDRESS 1106 diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h index f960a1aef75..792c9bdc0cc 100644 --- a/dlls/shdocvw/shdocvw.h +++ b/dlls/shdocvw/shdocvw.h @@ -28,23 +28,14 @@ #include "windef.h" #include "winbase.h" -#include "wingdi.h" #include "winuser.h" #include "ole2.h" -#include "olectl.h" #include "shlobj.h" #include "exdisp.h" -#include "mshtmhst.h" -#include "hlink.h" -#include "htiframe.h" #include "wine/unicode.h" #include "wine/list.h" -#include "resource.h" - - -#define WM_UPDATEADDRBAR (WM_APP+1) /********************************************************************** * Shell Instance Objects @@ -52,212 +43,6 @@ extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppvClassObj) DECLSPEC_HIDDEN; -/********************************************************************** - * WebBrowser declaration for SHDOCVW.DLL - */ - -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; - ITargetFrame2 ITargetFrame2_iface; - - 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; - -typedef struct _IDocHostContainerVtbl -{ - ULONG (*addref)(DocHost*); - ULONG (*release)(DocHost*); - void (WINAPI* GetDocObjRect)(DocHost*,RECT*); - HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR); - void (WINAPI* SetURL)(DocHost*,LPCWSTR); - HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*); -} 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; - - IDispatch *disp; - - IDispatch *client_disp; - IDocHostUIHandler *hostui; - IOleInPlaceFrame *frame; - - 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; - - ConnectionPointContainer cps; -}; - -struct WebBrowser { - 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; - IOleContainer *container; - IOleInPlaceSiteEx *inplace; - - /* 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; -}; - -typedef struct { - DocHost doc_host; - - LONG ref; - - InternetExplorer *ie; -} IEDocHost; - -struct InternetExplorer { - IWebBrowser2 IWebBrowser2_iface; - HlinkFrame hlink_frame; - - LONG ref; - - HWND frame_hwnd; - HWND status_hwnd; - HMENU menu; - BOOL nohome; - - struct list entry; - IEDocHost *doc_host; -}; - -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; - -void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*) DECLSPEC_HIDDEN; -void DocHost_ClientSite_Init(DocHost*) DECLSPEC_HIDDEN; -void DocHost_Frame_Init(DocHost*) DECLSPEC_HIDDEN; -void release_dochost_client(DocHost*) DECLSPEC_HIDDEN; - -void DocHost_Release(DocHost*) DECLSPEC_HIDDEN; -void DocHost_ClientSite_Release(DocHost*) DECLSPEC_HIDDEN; - -void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*) DECLSPEC_HIDDEN; -void ConnectionPointContainer_Destroy(ConnectionPointContainer*) DECLSPEC_HIDDEN; - -void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*) DECLSPEC_HIDDEN; -BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**) DECLSPEC_HIDDEN; - -HRESULT ShellBrowser_Create(IShellBrowser**) DECLSPEC_HIDDEN; -HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; -HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; - -void create_doc_view_hwnd(DocHost*) DECLSPEC_HIDDEN; -void deactivate_document(DocHost*) DECLSPEC_HIDDEN; -HRESULT dochost_object_available(DocHost*,IUnknown*) 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; -void set_doc_state(DocHost*,READYSTATE) DECLSPEC_HIDDEN; -HRESULT get_location_url(DocHost*,BSTR*) DECLSPEC_HIDDEN; -void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*) DECLSPEC_HIDDEN; - -#define WM_DOCHOSTTASK (WM_USER+0x300) -void push_dochost_task(DocHost*,task_header_t*,task_proc_t,task_destr_t,BOOL) DECLSPEC_HIDDEN; -LRESULT process_dochost_tasks(DocHost*) DECLSPEC_HIDDEN; -void abort_dochost_tasks(DocHost*,task_proc_t) DECLSPEC_HIDDEN; - -HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; -void InternetExplorer_WebBrowser_Init(InternetExplorer*) DECLSPEC_HIDDEN; - -void released_obj(void) DECLSPEC_HIDDEN; - /********************************************************************** * Dll lifetime tracking declaration for shdocvw.dll */ @@ -266,18 +51,9 @@ static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_ref static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); } extern HINSTANCE shdocvw_hinstance DECLSPEC_HIDDEN; -extern void register_iewindow_class(void) DECLSPEC_HIDDEN; -extern void unregister_iewindow_class(void) DECLSPEC_HIDDEN; -extern HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR) DECLSPEC_HIDDEN; HINSTANCE get_ieframe_instance(void) DECLSPEC_HIDDEN; -HRESULT register_class_object(BOOL) DECLSPEC_HIDDEN; -HRESULT get_typeinfo(ITypeInfo**) DECLSPEC_HIDDEN; -DWORD register_iexplore(BOOL) DECLSPEC_HIDDEN; - -const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN; - /* memory allocation functions */ static inline void *heap_alloc(size_t len) @@ -285,64 +61,9 @@ static inline void *heap_alloc(size_t len) return HeapAlloc(GetProcessHeap(), 0, len); } -static inline void *heap_alloc_zero(size_t len) -{ - return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); -} - -static inline void *heap_realloc(void *mem, size_t len) -{ - return HeapReAlloc(GetProcessHeap(), 0, mem, len); -} - static inline BOOL heap_free(void *mem) { return HeapFree(GetProcessHeap(), 0, mem); } -static inline LPWSTR heap_strdupW(LPCWSTR str) -{ - LPWSTR ret = NULL; - - if(str) { - DWORD size; - - size = (strlenW(str)+1)*sizeof(WCHAR); - ret = heap_alloc(size); - memcpy(ret, str, size); - } - - return ret; -} - -static inline LPWSTR co_strdupW(LPCWSTR str) -{ - WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR)); - 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; -} - #endif /* __WINE_SHDOCVW_H */ diff --git a/dlls/shdocvw/shdocvw.rc b/dlls/shdocvw/shdocvw.rc index cabcad131a7..bd47bbd09c4 100644 --- a/dlls/shdocvw/shdocvw.rc +++ b/dlls/shdocvw/shdocvw.rc @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "resource.h" +#include "windef.h" LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL diff --git a/dlls/shdocvw/shdocvw_main.c b/dlls/shdocvw/shdocvw_main.c index b9c8bae00b3..36233b523dd 100644 --- a/dlls/shdocvw/shdocvw_main.c +++ b/dlls/shdocvw/shdocvw_main.c @@ -42,56 +42,6 @@ LONG SHDOCVW_refCount = 0; HINSTANCE shdocvw_hinstance = 0; static HMODULE SHDOCVW_hshell32 = 0; -static ITypeInfo *wb_typeinfo = NULL; - -HRESULT get_typeinfo(ITypeInfo **typeinfo) -{ - ITypeLib *typelib; - HRESULT hres; - - if(wb_typeinfo) { - *typeinfo = wb_typeinfo; - return S_OK; - } - - hres = LoadRegTypeLib(&LIBID_SHDocVw, 1, 1, LOCALE_SYSTEM_DEFAULT, &typelib); - if(FAILED(hres)) { - ERR("LoadRegTypeLib failed: %08x\n", hres); - return hres; - } - - hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IWebBrowser2, &wb_typeinfo); - ITypeLib_Release(typelib); - - *typeinfo = wb_typeinfo; - return hres; -} - -const char *debugstr_variant(const VARIANT *v) -{ - if(!v) - return "(null)"; - - switch(V_VT(v)) { - case VT_EMPTY: - return "{VT_EMPTY}"; - case VT_NULL: - return "{VT_NULL}"; - case VT_I4: - return wine_dbg_sprintf("{VT_I4: %d}", V_I4(v)); - case VT_R8: - return wine_dbg_sprintf("{VT_R8: %lf}", V_R8(v)); - case VT_BSTR: - return wine_dbg_sprintf("{VT_BSTR: %s}", debugstr_w(V_BSTR(v))); - case VT_DISPATCH: - return wine_dbg_sprintf("{VT_DISPATCH: %p}", V_DISPATCH(v)); - case VT_BOOL: - return wine_dbg_sprintf("{VT_BOOL: %x}", V_BOOL(v)); - default: - return wine_dbg_sprintf("{vt %d}", V_VT(v)); - } -} - static HINSTANCE ieframe_instance; HINSTANCE get_ieframe_instance(void) @@ -114,13 +64,9 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad) { case DLL_PROCESS_ATTACH: shdocvw_hinstance = hinst; - register_iewindow_class(); break; case DLL_PROCESS_DETACH: if (SHDOCVW_hshell32) FreeLibrary(SHDOCVW_hshell32); - unregister_iewindow_class(); - if(wb_typeinfo) - ITypeInfo_Release(wb_typeinfo); if(ieframe_instance) FreeLibrary(ieframe_instance); break;