2006-04-07 10:52:00 +02:00
|
|
|
/*
|
2011-07-27 14:46:48 +02:00
|
|
|
* ieframe - Internet Explorer main frame window
|
2006-04-07 10:52:00 +02:00
|
|
|
*
|
|
|
|
* Copyright 2006 Mike McCormack (for CodeWeavers)
|
2006-04-21 12:13:53 +02:00
|
|
|
* Copyright 2006 Jacek Caban (for CodeWeavers)
|
2006-04-07 10:52:00 +02:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-04-07 10:52:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2011-07-27 14:46:48 +02:00
|
|
|
|
|
|
|
#include "ieframe.h"
|
|
|
|
#include "resource.h"
|
|
|
|
|
2006-04-07 10:52:00 +02:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winnls.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "exdisp.h"
|
|
|
|
#include "oleidl.h"
|
|
|
|
|
2010-06-21 00:49:59 +02:00
|
|
|
#include "mshtmcid.h"
|
2010-07-21 16:34:41 +02:00
|
|
|
#include "shellapi.h"
|
2010-07-29 12:04:46 +02:00
|
|
|
#include "winreg.h"
|
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "intshcut.h"
|
2011-01-07 19:06:17 +01:00
|
|
|
#include "ddeml.h"
|
2017-09-15 18:33:19 +02:00
|
|
|
#include "ieautomation.h"
|
2006-04-07 10:52:00 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2011-07-29 12:18:33 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
|
2006-04-07 10:52:00 +02:00
|
|
|
|
2010-06-10 12:50:38 +02:00
|
|
|
#define IDI_APPICON 1
|
2010-05-05 11:00:19 +02:00
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
#define WM_UPDATEADDRBAR (WM_APP+1)
|
|
|
|
|
2006-04-07 10:52:00 +02:00
|
|
|
static const WCHAR szIEWinFrame[] = { 'I','E','F','r','a','m','e',0 };
|
|
|
|
|
2010-07-21 16:34:41 +02:00
|
|
|
/* Windows uses "Microsoft Internet Explorer" */
|
|
|
|
static const WCHAR wszWineInternetExplorer[] =
|
|
|
|
{'W','i','n','e',' ','I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0};
|
|
|
|
|
2011-01-07 19:03:23 +01:00
|
|
|
static LONG obj_cnt;
|
2011-01-07 19:06:17 +01:00
|
|
|
static DWORD dde_inst;
|
|
|
|
static HSZ ddestr_iexplore, ddestr_openurl;
|
2011-07-27 14:46:48 +02:00
|
|
|
static struct list ie_list = LIST_INIT(ie_list);
|
2011-01-07 19:03:23 +01:00
|
|
|
|
2010-07-29 13:45:17 +02:00
|
|
|
HRESULT update_ie_statustext(InternetExplorer* This, LPCWSTR text)
|
|
|
|
{
|
|
|
|
if(!SendMessageW(This->status_hwnd, SB_SETTEXTW, MAKEWORD(SB_SIMPLEID, 0), (LPARAM)text))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-08-26 13:03:00 +02:00
|
|
|
static void adjust_ie_docobj_rect(HWND frame, RECT* rc)
|
2010-07-27 13:09:47 +02:00
|
|
|
{
|
|
|
|
HWND hwndRebar = GetDlgItem(frame, IDC_BROWSE_REBAR);
|
2010-07-29 11:35:42 +02:00
|
|
|
HWND hwndStatus = GetDlgItem(frame, IDC_BROWSE_STATUSBAR);
|
2010-07-27 13:09:47 +02:00
|
|
|
INT barHeight = SendMessageW(hwndRebar, RB_GETBARHEIGHT, 0, 0);
|
|
|
|
|
2016-07-09 13:52:20 +02:00
|
|
|
InflateRect(rc, 0, -barHeight);
|
2010-07-29 11:35:42 +02:00
|
|
|
|
|
|
|
if(IsWindowVisible(hwndStatus))
|
|
|
|
{
|
|
|
|
RECT statusrc;
|
|
|
|
|
|
|
|
GetClientRect(hwndStatus, &statusrc);
|
|
|
|
rc->bottom -= statusrc.bottom - statusrc.top;
|
|
|
|
}
|
2010-07-27 13:09:47 +02:00
|
|
|
}
|
|
|
|
|
2010-08-03 13:56:56 +02:00
|
|
|
static HMENU get_tb_menu(HMENU menu)
|
|
|
|
{
|
|
|
|
HMENU menu_view = GetSubMenu(menu, 1);
|
|
|
|
|
|
|
|
return GetSubMenu(menu_view, 0);
|
|
|
|
}
|
|
|
|
|
2010-07-29 12:04:46 +02:00
|
|
|
static HMENU get_fav_menu(HMENU menu)
|
|
|
|
{
|
2010-08-03 13:56:56 +02:00
|
|
|
return GetSubMenu(menu, 2);
|
2010-07-29 12:04:46 +02:00
|
|
|
}
|
|
|
|
|
2010-08-03 19:23:55 +02:00
|
|
|
static LPWSTR get_fav_url_from_id(HMENU menu, UINT id)
|
2010-07-29 12:04:46 +02:00
|
|
|
{
|
|
|
|
MENUITEMINFOW item;
|
|
|
|
|
|
|
|
item.cbSize = sizeof(item);
|
2010-07-29 12:12:54 +02:00
|
|
|
item.fMask = MIIM_DATA;
|
|
|
|
|
|
|
|
if(!GetMenuItemInfoW(menu, id, FALSE, &item))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return (LPWSTR)item.dwItemData;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_fav_menu_data(HMENU menu)
|
|
|
|
{
|
2010-08-03 19:23:55 +02:00
|
|
|
LPWSTR url;
|
2010-07-29 12:12:54 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0; (url = get_fav_url_from_id(menu, ID_BROWSE_GOTOFAV_FIRST + i)); i++)
|
2010-08-03 19:23:55 +02:00
|
|
|
heap_free( url );
|
2010-07-29 12:12:54 +02:00
|
|
|
}
|
|
|
|
|
2010-07-22 18:12:02 +02:00
|
|
|
static int get_menu_item_count(HMENU menu)
|
|
|
|
{
|
|
|
|
MENUITEMINFOW item;
|
|
|
|
int count = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
item.cbSize = sizeof(item);
|
|
|
|
item.fMask = MIIM_DATA | MIIM_SUBMENU;
|
|
|
|
|
|
|
|
for(i = 0; GetMenuItemInfoW(menu, i, TRUE, &item); i++)
|
|
|
|
{
|
|
|
|
if(item.hSubMenu)
|
|
|
|
count += get_menu_item_count(item.hSubMenu);
|
|
|
|
else
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_fav_to_menu(HMENU favmenu, HMENU menu, LPWSTR title, LPCWSTR url)
|
2010-07-29 12:12:54 +02:00
|
|
|
{
|
|
|
|
MENUITEMINFOW item;
|
|
|
|
/* Subtract the number of standard elements in the Favorites menu */
|
2010-07-22 18:12:02 +02:00
|
|
|
int favcount = get_menu_item_count(favmenu) - 2;
|
2010-07-29 12:12:54 +02:00
|
|
|
LPWSTR urlbuf;
|
|
|
|
|
|
|
|
if(favcount > (ID_BROWSE_GOTOFAV_MAX - ID_BROWSE_GOTOFAV_FIRST))
|
|
|
|
{
|
|
|
|
FIXME("Add support for more than %d Favorites\n", favcount);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
urlbuf = heap_alloc((lstrlenW(url) + 1) * sizeof(WCHAR));
|
|
|
|
|
|
|
|
if(!urlbuf)
|
|
|
|
return;
|
|
|
|
|
|
|
|
lstrcpyW(urlbuf, url);
|
|
|
|
|
|
|
|
item.cbSize = sizeof(item);
|
|
|
|
item.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_DATA | MIIM_ID;
|
2010-07-29 12:04:46 +02:00
|
|
|
item.fType = MFT_STRING;
|
|
|
|
item.dwTypeData = title;
|
2010-07-29 12:12:54 +02:00
|
|
|
item.wID = ID_BROWSE_GOTOFAV_FIRST + favcount;
|
|
|
|
item.dwItemData = (ULONG_PTR)urlbuf;
|
2010-07-22 18:12:02 +02:00
|
|
|
InsertMenuItemW(menu, -1, TRUE, &item);
|
2010-07-29 12:04:46 +02:00
|
|
|
}
|
|
|
|
|
2010-07-22 18:12:02 +02:00
|
|
|
static void add_favs_to_menu(HMENU favmenu, HMENU menu, LPCWSTR dir)
|
2010-07-29 12:04:46 +02:00
|
|
|
{
|
2018-11-30 08:14:06 +01:00
|
|
|
static const WCHAR search[] = {'*',0};
|
2010-07-29 12:04:46 +02:00
|
|
|
WCHAR path[MAX_PATH*2];
|
|
|
|
WCHAR* filename;
|
|
|
|
HANDLE findhandle;
|
|
|
|
WIN32_FIND_DATAW finddata;
|
|
|
|
IUniformResourceLocatorW* urlobj;
|
2011-02-01 15:12:17 +01:00
|
|
|
IPersistFile* urlfile = NULL;
|
2010-07-29 12:04:46 +02:00
|
|
|
HRESULT res;
|
|
|
|
|
|
|
|
lstrcpyW(path, dir);
|
2010-07-22 18:12:02 +02:00
|
|
|
PathAppendW(path, search);
|
2010-07-29 12:04:46 +02:00
|
|
|
|
|
|
|
findhandle = FindFirstFileW(path, &finddata);
|
|
|
|
|
|
|
|
if(findhandle == INVALID_HANDLE_VALUE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
res = CoCreateInstance(&CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, &IID_IUniformResourceLocatorW, (PVOID*)&urlobj);
|
|
|
|
|
|
|
|
if(SUCCEEDED(res))
|
2012-07-27 11:00:34 +02:00
|
|
|
res = IUnknown_QueryInterface((IUnknown*)urlobj, &IID_IPersistFile, (PVOID*)&urlfile);
|
2010-07-29 12:04:46 +02:00
|
|
|
|
|
|
|
if(SUCCEEDED(res))
|
|
|
|
{
|
2010-07-22 18:12:02 +02:00
|
|
|
filename = path + lstrlenW(path) - lstrlenW(search);
|
2010-07-29 12:04:46 +02:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
lstrcpyW(filename, finddata.cFileName);
|
|
|
|
|
2010-07-22 18:12:02 +02:00
|
|
|
if(finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
|
|
|
{
|
2018-11-30 08:14:06 +01:00
|
|
|
static const WCHAR ignore1[] = {'.','.',0};
|
|
|
|
static const WCHAR ignore2[] = {'.',0};
|
2010-07-22 18:12:02 +02:00
|
|
|
MENUITEMINFOW item;
|
|
|
|
|
|
|
|
if(!lstrcmpW(filename, ignore1) || !lstrcmpW(filename, ignore2))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
item.cbSize = sizeof(item);
|
|
|
|
item.fMask = MIIM_STRING | MIIM_SUBMENU;
|
|
|
|
item.dwTypeData = filename;
|
|
|
|
item.hSubMenu = CreatePopupMenu();
|
|
|
|
InsertMenuItemW(menu, -1, TRUE, &item);
|
|
|
|
add_favs_to_menu(favmenu, item.hSubMenu, path);
|
|
|
|
} else
|
|
|
|
{
|
2018-11-30 08:14:06 +01:00
|
|
|
static const WCHAR urlext[] = {'.','u','r','l',0};
|
2010-07-22 18:12:02 +02:00
|
|
|
WCHAR* fileext;
|
|
|
|
WCHAR* url = NULL;
|
|
|
|
|
|
|
|
if(lstrcmpiW(PathFindExtensionW(filename), urlext))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(FAILED(IPersistFile_Load(urlfile, path, 0)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
urlobj->lpVtbl->GetURL(urlobj, &url);
|
|
|
|
|
|
|
|
if(!url)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
fileext = filename + lstrlenW(filename) - lstrlenW(urlext);
|
|
|
|
*fileext = 0;
|
|
|
|
add_fav_to_menu(favmenu, menu, filename, url);
|
|
|
|
}
|
2010-07-29 12:04:46 +02:00
|
|
|
} while(FindNextFileW(findhandle, &finddata));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(urlfile)
|
|
|
|
IPersistFile_Release(urlfile);
|
|
|
|
|
|
|
|
if(urlobj)
|
2012-07-27 11:00:34 +02:00
|
|
|
IUnknown_Release((IUnknown*)urlobj);
|
2010-07-29 12:04:46 +02:00
|
|
|
|
|
|
|
FindClose(findhandle);
|
|
|
|
}
|
|
|
|
|
2010-08-03 13:56:56 +02:00
|
|
|
static void add_tbs_to_menu(HMENU menu)
|
|
|
|
{
|
2018-11-30 08:14:06 +01:00
|
|
|
static const WCHAR toolbar_key[] = {'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'I','n','t','e','r','n','e','t',' ',
|
|
|
|
'E','x','p','l','o','r','e','r','\\',
|
|
|
|
'T','o','o','l','b','a','r',0};
|
2010-08-03 13:56:56 +02:00
|
|
|
HUSKEY toolbar_handle;
|
|
|
|
|
|
|
|
if(SHRegOpenUSKeyW(toolbar_key, KEY_READ, NULL, &toolbar_handle, TRUE) == ERROR_SUCCESS)
|
|
|
|
{
|
2018-11-30 08:14:06 +01:00
|
|
|
static const WCHAR classes_key[] = {'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'C','l','a','s','s','e','s','\\','C','L','S','I','D',0};
|
2010-08-03 13:56:56 +02:00
|
|
|
HUSKEY classes_handle;
|
|
|
|
WCHAR guid[39];
|
2018-08-16 20:19:29 +02:00
|
|
|
DWORD value_len = ARRAY_SIZE(guid);
|
2010-08-03 13:56:56 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if(SHRegOpenUSKeyW(classes_key, KEY_READ, NULL, &classes_handle, TRUE) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
SHRegCloseUSKey(toolbar_handle);
|
|
|
|
ERR("Failed to open key %s\n", debugstr_w(classes_key));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; SHRegEnumUSValueW(toolbar_handle, i, guid, &value_len, NULL, NULL, NULL, SHREGENUM_HKLM) == ERROR_SUCCESS; i++)
|
|
|
|
{
|
|
|
|
WCHAR tb_name[100];
|
2018-08-16 20:19:29 +02:00
|
|
|
DWORD tb_name_len = ARRAY_SIZE(tb_name);
|
2010-08-03 13:56:56 +02:00
|
|
|
HUSKEY tb_class_handle;
|
|
|
|
MENUITEMINFOW item;
|
|
|
|
LSTATUS ret;
|
2018-08-16 20:19:29 +02:00
|
|
|
value_len = ARRAY_SIZE(guid);
|
2010-08-03 13:56:56 +02:00
|
|
|
|
|
|
|
if(lstrlenW(guid) != 38)
|
|
|
|
{
|
|
|
|
TRACE("Found invalid IE toolbar entry: %s\n", debugstr_w(guid));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(SHRegOpenUSKeyW(guid, KEY_READ, classes_handle, &tb_class_handle, TRUE) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("Failed to get class info for %s\n", debugstr_w(guid));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = SHRegQueryUSValueW(tb_class_handle, NULL, NULL, tb_name, &tb_name_len, TRUE, NULL, 0);
|
|
|
|
|
|
|
|
SHRegCloseUSKey(tb_class_handle);
|
|
|
|
|
|
|
|
if(ret != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("Failed to get toolbar name for %s\n", debugstr_w(guid));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
item.cbSize = sizeof(item);
|
|
|
|
item.fMask = MIIM_STRING;
|
|
|
|
item.dwTypeData = tb_name;
|
|
|
|
InsertMenuItemW(menu, GetMenuItemCount(menu), TRUE, &item);
|
|
|
|
}
|
|
|
|
|
|
|
|
SHRegCloseUSKey(classes_handle);
|
|
|
|
SHRegCloseUSKey(toolbar_handle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-29 12:04:46 +02:00
|
|
|
static HMENU create_ie_menu(void)
|
|
|
|
{
|
2011-07-27 14:46:48 +02:00
|
|
|
HMENU menu = LoadMenuW(ieframe_instance, MAKEINTRESOURCEW(IDR_BROWSE_MAIN_MENU));
|
2010-07-22 18:12:02 +02:00
|
|
|
HMENU favmenu = get_fav_menu(menu);
|
2010-07-29 12:04:46 +02:00
|
|
|
WCHAR path[MAX_PATH];
|
|
|
|
|
2010-08-03 13:56:56 +02:00
|
|
|
add_tbs_to_menu(get_tb_menu(menu));
|
|
|
|
|
2010-07-29 12:04:46 +02:00
|
|
|
if(SHGetFolderPathW(NULL, CSIDL_COMMON_FAVORITES, NULL, SHGFP_TYPE_CURRENT, path) == S_OK)
|
2010-07-22 18:12:02 +02:00
|
|
|
add_favs_to_menu(favmenu, favmenu, path);
|
2010-07-29 12:04:46 +02:00
|
|
|
|
|
|
|
if(SHGetFolderPathW(NULL, CSIDL_FAVORITES, NULL, SHGFP_TYPE_CURRENT, path) == S_OK)
|
2010-07-22 18:12:02 +02:00
|
|
|
add_favs_to_menu(favmenu, favmenu, path);
|
2010-07-29 12:04:46 +02:00
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
2010-07-29 12:12:54 +02:00
|
|
|
static void ie_navigate(InternetExplorer* This, LPCWSTR url)
|
|
|
|
{
|
|
|
|
VARIANT variant;
|
|
|
|
|
|
|
|
V_VT(&variant) = VT_BSTR;
|
|
|
|
V_BSTR(&variant) = SysAllocString(url);
|
|
|
|
|
2010-11-13 17:47:19 +01:00
|
|
|
IWebBrowser2_Navigate2(&This->IWebBrowser2_iface, &variant, NULL, NULL, NULL, NULL);
|
2010-07-29 12:12:54 +02:00
|
|
|
|
|
|
|
SysFreeString(V_BSTR(&variant));
|
|
|
|
}
|
|
|
|
|
2010-07-21 16:38:45 +02:00
|
|
|
static INT_PTR CALLBACK ie_dialog_open_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
|
|
|
{
|
2010-06-21 17:47:55 +02:00
|
|
|
static InternetExplorer* This;
|
|
|
|
|
2010-07-21 16:38:45 +02:00
|
|
|
switch(msg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2010-06-21 17:47:55 +02:00
|
|
|
This = (InternetExplorer*)lparam;
|
|
|
|
EnableWindow(GetDlgItem(hwnd, IDOK), FALSE);
|
2010-07-21 16:38:45 +02:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch(LOWORD(wparam))
|
|
|
|
{
|
2010-06-21 17:47:55 +02:00
|
|
|
case IDC_BROWSE_OPEN_URL:
|
|
|
|
{
|
|
|
|
HWND hwndurl = GetDlgItem(hwnd, IDC_BROWSE_OPEN_URL);
|
|
|
|
int len = GetWindowTextLengthW(hwndurl);
|
|
|
|
|
2012-08-13 11:44:06 +02:00
|
|
|
EnableWindow(GetDlgItem(hwnd, IDOK), len != 0);
|
2010-06-21 17:47:55 +02:00
|
|
|
break;
|
|
|
|
}
|
2010-07-21 16:38:45 +02:00
|
|
|
case IDOK:
|
2010-06-21 17:47:55 +02:00
|
|
|
{
|
|
|
|
HWND hwndurl = GetDlgItem(hwnd, IDC_BROWSE_OPEN_URL);
|
|
|
|
int len = GetWindowTextLengthW(hwndurl);
|
|
|
|
|
|
|
|
if(len)
|
|
|
|
{
|
|
|
|
VARIANT url;
|
|
|
|
|
|
|
|
V_VT(&url) = VT_BSTR;
|
|
|
|
V_BSTR(&url) = SysAllocStringLen(NULL, len);
|
|
|
|
|
2010-08-03 05:32:29 +02:00
|
|
|
GetWindowTextW(hwndurl, V_BSTR(&url), len + 1);
|
2010-11-13 17:47:19 +01:00
|
|
|
IWebBrowser2_Navigate2(&This->IWebBrowser2_iface, &url, NULL, NULL, NULL, NULL);
|
2010-06-21 17:47:55 +02:00
|
|
|
|
|
|
|
SysFreeString(V_BSTR(&url));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* fall through */
|
2010-07-21 16:38:45 +02:00
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hwnd, wparam);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-07-21 16:34:41 +02:00
|
|
|
static void ie_dialog_about(HWND hwnd)
|
|
|
|
{
|
|
|
|
HICON icon = LoadImageW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDI_APPICON), IMAGE_ICON, 48, 48, LR_SHARED);
|
|
|
|
|
|
|
|
ShellAboutW(hwnd, wszWineInternetExplorer, NULL, icon);
|
|
|
|
|
|
|
|
DestroyIcon(icon);
|
|
|
|
}
|
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
static void add_tb_separator(InternetExplorer *ie)
|
2010-08-03 12:36:30 +02:00
|
|
|
{
|
|
|
|
TBBUTTON btn;
|
|
|
|
|
|
|
|
ZeroMemory(&btn, sizeof(btn));
|
|
|
|
|
|
|
|
btn.iBitmap = 3;
|
|
|
|
btn.fsStyle = BTNS_SEP;
|
2015-11-09 17:52:46 +01:00
|
|
|
SendMessageW(ie->toolbar_hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
|
2010-08-03 12:36:30 +02:00
|
|
|
}
|
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
static void add_tb_button(InternetExplorer *ie, int bmp, int cmd, int strId)
|
2010-08-03 12:36:30 +02:00
|
|
|
{
|
|
|
|
TBBUTTON btn;
|
|
|
|
WCHAR buf[30];
|
|
|
|
|
2018-08-16 20:19:29 +02:00
|
|
|
LoadStringW(ieframe_instance, strId, buf, ARRAY_SIZE(buf));
|
2010-08-03 12:36:30 +02:00
|
|
|
|
|
|
|
btn.iBitmap = bmp;
|
|
|
|
btn.idCommand = cmd;
|
|
|
|
btn.fsState = TBSTATE_ENABLED;
|
|
|
|
btn.fsStyle = BTNS_SHOWTEXT;
|
|
|
|
btn.dwData = 0;
|
|
|
|
btn.iString = (INT_PTR)buf;
|
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
SendMessageW(ie->toolbar_hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
|
2010-08-03 12:36:30 +02:00
|
|
|
}
|
|
|
|
|
2015-11-09 17:53:00 +01:00
|
|
|
static void enable_toolbar_button(InternetExplorer *ie, int command, BOOL enable)
|
|
|
|
{
|
|
|
|
SendMessageW(ie->toolbar_hwnd, TB_ENABLEBUTTON, command, enable);
|
|
|
|
}
|
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
static void create_rebar(InternetExplorer *ie)
|
2010-07-27 13:09:47 +02:00
|
|
|
{
|
|
|
|
HWND hwndRebar;
|
|
|
|
HWND hwndAddress;
|
|
|
|
REBARINFO rebarinf;
|
|
|
|
REBARBANDINFOW bandinf;
|
2010-08-03 13:00:10 +02:00
|
|
|
WCHAR addr[40];
|
2010-07-09 19:15:51 +02:00
|
|
|
HIMAGELIST imagelist;
|
2012-10-24 15:45:18 +02:00
|
|
|
SIZE toolbar_size;
|
2010-07-27 13:09:47 +02:00
|
|
|
|
2018-08-16 20:19:29 +02:00
|
|
|
LoadStringW(ieframe_instance, IDS_ADDRESS, addr, ARRAY_SIZE(addr));
|
2010-08-03 13:00:10 +02:00
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
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,
|
2015-11-09 17:52:46 +01:00
|
|
|
ie->frame_hwnd, (HMENU)IDC_BROWSE_REBAR, ieframe_instance, NULL);
|
2010-07-27 13:09:47 +02:00
|
|
|
|
|
|
|
rebarinf.cbSize = sizeof(rebarinf);
|
|
|
|
rebarinf.fMask = 0;
|
|
|
|
rebarinf.himl = NULL;
|
|
|
|
|
|
|
|
SendMessageW(hwndRebar, RB_SETBARINFO, 0, (LPARAM)&rebarinf);
|
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
ie->toolbar_hwnd = CreateWindowExW(TBSTYLE_EX_MIXEDBUTTONS, TOOLBARCLASSNAMEW, NULL, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE | CCS_NORESIZE,
|
2011-07-27 14:46:48 +02:00
|
|
|
0, 0, 0, 0, hwndRebar, (HMENU)IDC_BROWSE_TOOLBAR, ieframe_instance, NULL);
|
2010-08-03 12:36:30 +02:00
|
|
|
|
2013-01-31 12:46:22 +01:00
|
|
|
imagelist = ImageList_LoadImageW(ieframe_instance, MAKEINTRESOURCEW(IDB_IETOOLBAR), 32, 0, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
2010-07-09 19:15:51 +02:00
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
SendMessageW(ie->toolbar_hwnd, TB_SETIMAGELIST, 0, (LPARAM)imagelist);
|
|
|
|
SendMessageW(ie->toolbar_hwnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
|
|
|
add_tb_button(ie, 0, ID_BROWSE_BACK, IDS_TB_BACK);
|
|
|
|
add_tb_button(ie, 1, ID_BROWSE_FORWARD, IDS_TB_FORWARD);
|
|
|
|
add_tb_button(ie, 2, ID_BROWSE_STOP, IDS_TB_STOP);
|
|
|
|
add_tb_button(ie, 3, ID_BROWSE_REFRESH, IDS_TB_REFRESH);
|
|
|
|
add_tb_button(ie, 4, ID_BROWSE_HOME, IDS_TB_HOME);
|
|
|
|
add_tb_separator(ie);
|
|
|
|
add_tb_button(ie, 5, ID_BROWSE_PRINT, IDS_TB_PRINT);
|
2015-12-08 08:08:22 +01:00
|
|
|
SendMessageW(ie->toolbar_hwnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(65,50));
|
2015-11-09 17:52:46 +01:00
|
|
|
SendMessageW(ie->toolbar_hwnd, TB_GETMAXSIZE, 0, (LPARAM)&toolbar_size);
|
2010-08-03 12:36:30 +02:00
|
|
|
|
|
|
|
bandinf.cbSize = sizeof(bandinf);
|
2012-10-24 15:45:18 +02:00
|
|
|
bandinf.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE;
|
2010-08-03 12:36:30 +02:00
|
|
|
bandinf.fStyle = RBBS_CHILDEDGE;
|
2012-10-24 15:45:18 +02:00
|
|
|
bandinf.cxMinChild = toolbar_size.cx;
|
|
|
|
bandinf.cyMinChild = toolbar_size.cy+2;
|
2015-11-09 17:52:46 +01:00
|
|
|
bandinf.hwndChild = ie->toolbar_hwnd;
|
2010-08-03 12:36:30 +02:00
|
|
|
|
|
|
|
SendMessageW(hwndRebar, RB_INSERTBANDW, -1, (LPARAM)&bandinf);
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
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);
|
2010-07-27 13:09:47 +02:00
|
|
|
|
2010-08-03 12:36:30 +02:00
|
|
|
bandinf.fMask |= RBBIM_TEXT;
|
|
|
|
bandinf.fStyle = RBBS_CHILDEDGE | RBBS_BREAK;
|
2010-07-27 13:09:47 +02:00
|
|
|
bandinf.lpText = addr;
|
2012-10-24 15:45:18 +02:00
|
|
|
bandinf.cxMinChild = 100;
|
2010-07-27 13:09:47 +02:00
|
|
|
bandinf.cyMinChild = 20;
|
|
|
|
bandinf.hwndChild = hwndAddress;
|
|
|
|
|
2010-08-03 12:36:30 +02:00
|
|
|
SendMessageW(hwndRebar, RB_INSERTBANDW, -1, (LPARAM)&bandinf);
|
2010-07-27 13:09:47 +02:00
|
|
|
}
|
|
|
|
|
2006-04-07 10:52:00 +02:00
|
|
|
static LRESULT iewnd_OnCreate(HWND hwnd, LPCREATESTRUCTW lpcs)
|
|
|
|
{
|
2010-07-29 11:35:42 +02:00
|
|
|
InternetExplorer* This = (InternetExplorer*)lpcs->lpCreateParams;
|
2006-04-10 08:30:46 +02:00
|
|
|
SetWindowLongPtrW(hwnd, 0, (LONG_PTR) lpcs->lpCreateParams);
|
2010-07-29 11:35:42 +02:00
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
This->doc_host.frame_hwnd = This->frame_hwnd = hwnd;
|
|
|
|
|
2010-07-29 12:04:46 +02:00
|
|
|
This->menu = create_ie_menu();
|
|
|
|
|
2010-12-14 15:30:44 +01:00
|
|
|
This->status_hwnd = CreateStatusWindowW(WS_VISIBLE|WS_CHILD|SBT_NOBORDERS|CCS_NODIVIDER,
|
|
|
|
NULL, hwnd, IDC_BROWSE_STATUSBAR);
|
2010-07-29 11:35:42 +02:00
|
|
|
SendMessageW(This->status_hwnd, SB_SIMPLE, TRUE, 0);
|
|
|
|
|
2015-11-09 17:52:46 +01:00
|
|
|
create_rebar(This);
|
2010-07-27 13:09:47 +02:00
|
|
|
|
2006-04-07 10:52:00 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-21 12:13:53 +02:00
|
|
|
static LRESULT iewnd_OnSize(InternetExplorer *This, INT width, INT height)
|
2006-04-07 10:52:00 +02:00
|
|
|
{
|
2010-07-27 13:09:47 +02:00
|
|
|
HWND hwndRebar = GetDlgItem(This->frame_hwnd, IDC_BROWSE_REBAR);
|
|
|
|
INT barHeight = SendMessageW(hwndRebar, RB_GETBARHEIGHT, 0, 0);
|
|
|
|
RECT docarea = {0, 0, width, height};
|
|
|
|
|
2010-07-29 11:35:42 +02:00
|
|
|
SendMessageW(This->status_hwnd, WM_SIZE, 0, 0);
|
|
|
|
|
2010-07-27 13:09:47 +02:00
|
|
|
adjust_ie_docobj_rect(This->frame_hwnd, &docarea);
|
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
if(This->doc_host.hwnd)
|
|
|
|
SetWindowPos(This->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom,
|
2006-04-21 12:13:53 +02:00
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
2010-07-27 13:09:47 +02:00
|
|
|
|
|
|
|
SetWindowPos(hwndRebar, NULL, 0, 0, width, barHeight, SWP_NOZORDER | SWP_NOACTIVATE);
|
2006-04-07 10:52:00 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-02 16:35:42 +02:00
|
|
|
static LRESULT iewnd_OnNotify(InternetExplorer *This, WPARAM wparam, LPARAM lparam)
|
|
|
|
{
|
|
|
|
NMHDR* hdr = (NMHDR*)lparam;
|
|
|
|
|
|
|
|
if(hdr->idFrom == IDC_BROWSE_ADDRESSBAR && hdr->code == CBEN_ENDEDITW)
|
|
|
|
{
|
|
|
|
NMCBEENDEDITW* info = (NMCBEENDEDITW*)lparam;
|
|
|
|
|
2011-03-15 02:17:15 +01:00
|
|
|
if(info->fChanged && info->iWhy == CBENF_RETURN)
|
2010-07-02 16:35:42 +02:00
|
|
|
{
|
|
|
|
VARIANT vt;
|
|
|
|
|
|
|
|
V_VT(&vt) = VT_BSTR;
|
|
|
|
V_BSTR(&vt) = SysAllocString(info->szText);
|
|
|
|
|
2010-11-13 17:47:19 +01:00
|
|
|
IWebBrowser2_Navigate2(&This->IWebBrowser2_iface, &vt, NULL, NULL, NULL, NULL);
|
2010-07-02 16:35:42 +02:00
|
|
|
|
|
|
|
SysFreeString(V_BSTR(&vt));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-24 15:38:04 +02:00
|
|
|
if(hdr->idFrom == IDC_BROWSE_REBAR && hdr->code == RBN_HEIGHTCHANGE)
|
|
|
|
{
|
|
|
|
RECT docarea;
|
|
|
|
|
|
|
|
GetClientRect(This->frame_hwnd, &docarea);
|
|
|
|
adjust_ie_docobj_rect(This->frame_hwnd, &docarea);
|
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
if(This->doc_host.hwnd)
|
|
|
|
SetWindowPos(This->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom,
|
2012-10-24 15:38:04 +02:00
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
}
|
|
|
|
|
2010-07-02 16:35:42 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-21 12:13:53 +02:00
|
|
|
static LRESULT iewnd_OnDestroy(InternetExplorer *This)
|
2006-04-07 10:52:00 +02:00
|
|
|
{
|
2015-11-09 17:52:46 +01:00
|
|
|
HIMAGELIST list = (HIMAGELIST)SendMessageW(This->toolbar_hwnd, TB_GETIMAGELIST, 0, 0);
|
2010-07-09 19:15:51 +02:00
|
|
|
|
2006-04-07 10:52:00 +02:00
|
|
|
TRACE("%p\n", This);
|
|
|
|
|
2010-07-29 12:12:54 +02:00
|
|
|
free_fav_menu_data(get_fav_menu(This->menu));
|
2010-07-09 19:15:51 +02:00
|
|
|
ImageList_Destroy(list);
|
2006-04-21 12:13:53 +02:00
|
|
|
This->frame_hwnd = NULL;
|
2006-04-07 10:52:00 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-24 10:00:24 +02:00
|
|
|
static LRESULT iewnd_OnCommand(InternetExplorer *This, HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
2010-06-21 00:49:59 +02:00
|
|
|
{
|
|
|
|
switch(LOWORD(wparam))
|
|
|
|
{
|
2010-07-21 16:38:45 +02:00
|
|
|
case ID_BROWSE_OPEN:
|
2011-07-27 14:46:48 +02:00
|
|
|
DialogBoxParamW(ieframe_instance, MAKEINTRESOURCEW(IDD_BROWSE_OPEN), hwnd, ie_dialog_open_proc, (LPARAM)This);
|
2010-07-21 16:38:45 +02:00
|
|
|
break;
|
|
|
|
|
2010-06-21 00:49:59 +02:00
|
|
|
case ID_BROWSE_PRINT:
|
2013-05-24 10:39:31 +02:00
|
|
|
if(This->doc_host.document)
|
2010-06-21 00:49:59 +02:00
|
|
|
{
|
|
|
|
IOleCommandTarget* target;
|
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
if(FAILED(IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target)))
|
2010-06-21 00:49:59 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
IOleCommandTarget_Exec(target, &CGID_MSHTML, IDM_PRINT, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
|
|
|
|
|
|
|
|
IOleCommandTarget_Release(target);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-07-07 16:26:15 +02:00
|
|
|
case ID_BROWSE_HOME:
|
2010-11-13 17:47:19 +01:00
|
|
|
IWebBrowser2_GoHome(&This->IWebBrowser2_iface);
|
2010-07-07 16:26:15 +02:00
|
|
|
break;
|
|
|
|
|
2012-01-18 18:48:08 +01:00
|
|
|
case ID_BROWSE_BACK:
|
|
|
|
IWebBrowser2_GoBack(&This->IWebBrowser2_iface);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BROWSE_FORWARD:
|
|
|
|
IWebBrowser2_GoForward(&This->IWebBrowser2_iface);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BROWSE_STOP:
|
|
|
|
IWebBrowser2_Stop(&This->IWebBrowser2_iface);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_BROWSE_REFRESH:
|
|
|
|
IWebBrowser2_Refresh(&This->IWebBrowser2_iface);
|
|
|
|
break;
|
|
|
|
|
2010-07-21 16:34:41 +02:00
|
|
|
case ID_BROWSE_ABOUT:
|
|
|
|
ie_dialog_about(hwnd);
|
|
|
|
break;
|
|
|
|
|
2010-08-20 21:38:29 +02:00
|
|
|
case ID_BROWSE_QUIT:
|
2011-01-07 19:03:23 +01:00
|
|
|
ShowWindow(hwnd, SW_HIDE);
|
2010-08-20 21:38:29 +02:00
|
|
|
break;
|
|
|
|
|
2010-06-21 00:49:59 +02:00
|
|
|
default:
|
2010-07-29 12:12:54 +02:00
|
|
|
if(LOWORD(wparam) >= ID_BROWSE_GOTOFAV_FIRST && LOWORD(wparam) <= ID_BROWSE_GOTOFAV_MAX)
|
|
|
|
{
|
|
|
|
LPCWSTR url = get_fav_url_from_id(get_fav_menu(This->menu), LOWORD(wparam));
|
|
|
|
|
|
|
|
if(url)
|
|
|
|
ie_navigate(This, url);
|
|
|
|
}
|
2010-06-21 00:49:59 +02:00
|
|
|
return DefWindowProcW(hwnd, msg, wparam, lparam);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-24 10:00:24 +02:00
|
|
|
static LRESULT update_addrbar(InternetExplorer *This, LPARAM lparam)
|
2010-07-27 14:23:14 +02:00
|
|
|
{
|
|
|
|
HWND hwndRebar = GetDlgItem(This->frame_hwnd, IDC_BROWSE_REBAR);
|
|
|
|
HWND hwndAddress = GetDlgItem(hwndRebar, IDC_BROWSE_ADDRESSBAR);
|
|
|
|
HWND hwndEdit = (HWND)SendMessageW(hwndAddress, CBEM_GETEDITCONTROL, 0, 0);
|
|
|
|
LPCWSTR url = (LPCWSTR)lparam;
|
|
|
|
|
|
|
|
SendMessageW(hwndEdit, WM_SETTEXT, 0, (LPARAM)url);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
static LRESULT WINAPI ie_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
2006-04-07 10:52:00 +02:00
|
|
|
{
|
2006-04-21 12:13:53 +02:00
|
|
|
InternetExplorer *This = (InternetExplorer*) GetWindowLongPtrW(hwnd, 0);
|
2006-04-07 10:52:00 +02:00
|
|
|
|
|
|
|
switch (msg)
|
|
|
|
{
|
|
|
|
case WM_CREATE:
|
|
|
|
return iewnd_OnCreate(hwnd, (LPCREATESTRUCTW)lparam);
|
2011-01-07 19:03:23 +01:00
|
|
|
case WM_CLOSE:
|
|
|
|
TRACE("WM_CLOSE\n");
|
|
|
|
ShowWindow(hwnd, SW_HIDE);
|
|
|
|
return 0;
|
|
|
|
case WM_SHOWWINDOW:
|
2022-02-11 08:39:53 +01:00
|
|
|
TRACE("WM_SHOWWINDOW %Ix\n", wparam);
|
2013-05-24 10:39:20 +02:00
|
|
|
if(wparam) {
|
2011-01-07 19:03:23 +01:00
|
|
|
IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
|
2013-05-24 10:39:20 +02:00
|
|
|
InterlockedIncrement(&This->extern_ref);
|
|
|
|
}else {
|
|
|
|
release_extern_ref(This, TRUE);
|
2011-01-07 19:03:23 +01:00
|
|
|
IWebBrowser2_Release(&This->IWebBrowser2_iface);
|
2013-05-24 10:39:20 +02:00
|
|
|
}
|
2011-01-07 19:03:23 +01:00
|
|
|
break;
|
2006-04-07 10:52:00 +02:00
|
|
|
case WM_DESTROY:
|
|
|
|
return iewnd_OnDestroy(This);
|
|
|
|
case WM_SIZE:
|
|
|
|
return iewnd_OnSize(This, LOWORD(lparam), HIWORD(lparam));
|
2010-06-21 00:49:59 +02:00
|
|
|
case WM_COMMAND:
|
|
|
|
return iewnd_OnCommand(This, hwnd, msg, wparam, lparam);
|
2010-07-02 16:35:42 +02:00
|
|
|
case WM_NOTIFY:
|
|
|
|
return iewnd_OnNotify(This, wparam, lparam);
|
2008-01-18 21:53:25 +01:00
|
|
|
case WM_DOCHOSTTASK:
|
2013-05-24 10:39:31 +02:00
|
|
|
return process_dochost_tasks(&This->doc_host);
|
2010-07-27 14:23:14 +02:00
|
|
|
case WM_UPDATEADDRBAR:
|
|
|
|
return update_addrbar(This, lparam);
|
2006-04-07 10:52:00 +02:00
|
|
|
}
|
|
|
|
return DefWindowProcW(hwnd, msg, wparam, lparam);
|
|
|
|
}
|
|
|
|
|
|
|
|
void register_iewindow_class(void)
|
|
|
|
{
|
2010-05-05 11:00:19 +02:00
|
|
|
WNDCLASSEXW wc;
|
2006-04-07 10:52:00 +02:00
|
|
|
|
|
|
|
memset(&wc, 0, sizeof wc);
|
2010-06-18 23:42:55 +02:00
|
|
|
wc.cbSize = sizeof(wc);
|
2006-04-07 10:52:00 +02:00
|
|
|
wc.style = 0;
|
|
|
|
wc.lpfnWndProc = ie_window_proc;
|
|
|
|
wc.cbClsExtra = 0;
|
2006-04-21 12:13:53 +02:00
|
|
|
wc.cbWndExtra = sizeof(InternetExplorer*);
|
2011-07-27 14:46:48 +02:00
|
|
|
wc.hInstance = ieframe_instance;
|
2010-05-05 11:00:19 +02:00
|
|
|
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);
|
2014-11-27 11:29:40 +01:00
|
|
|
wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
|
2006-04-07 10:52:00 +02:00
|
|
|
wc.hbrBackground = 0;
|
|
|
|
wc.lpszClassName = szIEWinFrame;
|
|
|
|
wc.lpszMenuName = NULL;
|
|
|
|
|
2010-05-05 11:00:19 +02:00
|
|
|
RegisterClassExW(&wc);
|
2006-04-07 10:52:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void unregister_iewindow_class(void)
|
|
|
|
{
|
2011-07-27 14:46:48 +02:00
|
|
|
UnregisterClassW(szIEWinFrame, ieframe_instance);
|
2006-04-07 10:52:00 +02:00
|
|
|
}
|
|
|
|
|
2006-04-21 12:13:53 +02:00
|
|
|
static void create_frame_hwnd(InternetExplorer *This)
|
|
|
|
{
|
2015-11-09 17:52:46 +01:00
|
|
|
CreateWindowExW(
|
2006-04-21 12:13:53 +02:00
|
|
|
WS_EX_WINDOWEDGE,
|
|
|
|
szIEWinFrame, wszWineInternetExplorer,
|
|
|
|
WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
|
|
|
|
| WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
2011-07-27 14:46:48 +02:00
|
|
|
NULL, NULL /* FIXME */, ieframe_instance, This);
|
2012-01-06 12:59:32 +01:00
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
create_doc_view_hwnd(&This->doc_host);
|
2006-04-21 12:13:53 +02:00
|
|
|
}
|
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
static inline InternetExplorer *impl_from_DocHost(DocHost *iface)
|
2011-01-07 19:03:23 +01:00
|
|
|
{
|
2013-05-24 10:39:31 +02:00
|
|
|
return CONTAINING_RECORD(iface, InternetExplorer, doc_host);
|
2006-04-07 10:52:00 +02:00
|
|
|
}
|
2006-04-19 20:33:32 +02:00
|
|
|
|
2011-01-07 19:03:23 +01:00
|
|
|
static ULONG IEDocHost_addref(DocHost *iface)
|
2010-11-13 17:48:34 +01:00
|
|
|
{
|
2013-05-24 10:39:31 +02:00
|
|
|
InternetExplorer *This = impl_from_DocHost(iface);
|
|
|
|
return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
|
2011-01-07 19:03:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG IEDocHost_release(DocHost *iface)
|
|
|
|
{
|
2013-05-24 10:39:31 +02:00
|
|
|
InternetExplorer *This = impl_from_DocHost(iface);
|
|
|
|
return IWebBrowser2_Release(&This->IWebBrowser2_iface);
|
2010-11-13 17:48:34 +01:00
|
|
|
}
|
|
|
|
|
2015-11-09 17:53:11 +01:00
|
|
|
static void DocHostContainer_get_docobj_rect(DocHost *This, RECT *rc)
|
2010-07-29 10:28:02 +02:00
|
|
|
{
|
|
|
|
GetClientRect(This->frame_hwnd, rc);
|
|
|
|
adjust_ie_docobj_rect(This->frame_hwnd, rc);
|
|
|
|
}
|
|
|
|
|
2015-11-09 17:53:11 +01:00
|
|
|
static HRESULT DocHostContainer_set_status_text(DocHost *iface, const WCHAR *text)
|
2010-07-29 10:28:02 +02:00
|
|
|
{
|
2013-05-24 10:39:31 +02:00
|
|
|
InternetExplorer *This = impl_from_DocHost(iface);
|
|
|
|
return update_ie_statustext(This, text);
|
2010-07-29 10:28:02 +02:00
|
|
|
}
|
|
|
|
|
2015-11-09 17:53:00 +01:00
|
|
|
static void DocHostContainer_on_command_state_change(DocHost *iface, LONG command, BOOL enable)
|
|
|
|
{
|
|
|
|
InternetExplorer *This = impl_from_DocHost(iface);
|
|
|
|
|
|
|
|
switch(command) {
|
|
|
|
case CSC_NAVIGATEBACK:
|
|
|
|
enable_toolbar_button(This, ID_BROWSE_BACK, enable);
|
|
|
|
break;
|
|
|
|
case CSC_NAVIGATEFORWARD:
|
|
|
|
enable_toolbar_button(This, ID_BROWSE_FORWARD, enable);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-09 17:53:11 +01:00
|
|
|
static void DocHostContainer_set_url(DocHost* iface, const WCHAR *url)
|
2010-07-29 10:28:02 +02:00
|
|
|
{
|
2013-05-24 10:39:31 +02:00
|
|
|
InternetExplorer *This = impl_from_DocHost(iface);
|
2011-01-07 19:07:05 +01:00
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
This->nohome = FALSE;
|
|
|
|
SendMessageW(This->frame_hwnd, WM_UPDATEADDRBAR, 0, (LPARAM)url);
|
2010-07-29 10:28:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IDocHostContainerVtbl DocHostContainerVtbl = {
|
2011-01-07 19:03:23 +01:00
|
|
|
IEDocHost_addref,
|
|
|
|
IEDocHost_release,
|
2015-11-09 17:53:11 +01:00
|
|
|
DocHostContainer_get_docobj_rect,
|
|
|
|
DocHostContainer_set_status_text,
|
2015-11-09 17:53:00 +01:00
|
|
|
DocHostContainer_on_command_state_change,
|
2015-11-09 17:53:11 +01:00
|
|
|
DocHostContainer_set_url
|
2010-07-29 10:28:02 +02:00
|
|
|
};
|
|
|
|
|
2011-01-07 19:06:39 +01:00
|
|
|
static HRESULT create_ie(InternetExplorer **ret_obj)
|
2006-04-19 20:33:32 +02:00
|
|
|
{
|
|
|
|
InternetExplorer *ret;
|
|
|
|
|
2010-03-13 16:43:06 +01:00
|
|
|
ret = heap_alloc_zero(sizeof(InternetExplorer));
|
2011-01-07 19:03:23 +01:00
|
|
|
if(!ret)
|
|
|
|
return E_OUTOFMEMORY;
|
2006-04-19 20:33:32 +02:00
|
|
|
|
2011-01-07 19:03:23 +01:00
|
|
|
ret->ref = 1;
|
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
DocHost_Init(&ret->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl);
|
2006-04-19 20:33:32 +02:00
|
|
|
|
|
|
|
InternetExplorer_WebBrowser_Init(ret);
|
|
|
|
|
2013-05-24 10:39:31 +02:00
|
|
|
HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)&ret->IWebBrowser2_iface, &ret->doc_host);
|
2010-07-27 18:15:38 +02:00
|
|
|
|
2006-04-21 12:13:53 +02:00
|
|
|
create_frame_hwnd(ret);
|
2006-04-19 20:33:32 +02:00
|
|
|
|
2011-01-07 19:06:39 +01:00
|
|
|
InterlockedIncrement(&obj_cnt);
|
2011-01-07 19:07:05 +01:00
|
|
|
list_add_tail(&ie_list, &ret->entry);
|
2011-01-07 19:06:39 +01:00
|
|
|
*ret_obj = ret;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-07-27 14:46:48 +02:00
|
|
|
HRESULT WINAPI InternetExplorer_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
|
2011-01-07 19:06:39 +01:00
|
|
|
{
|
|
|
|
InternetExplorer *ret;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
hres = create_ie(&ret);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
2010-11-13 17:47:19 +01:00
|
|
|
hres = IWebBrowser2_QueryInterface(&ret->IWebBrowser2_iface, riid, ppv);
|
2011-01-07 19:03:23 +01:00
|
|
|
IWebBrowser2_Release(&ret->IWebBrowser2_iface);
|
|
|
|
if(FAILED(hres))
|
2006-04-19 20:33:32 +02:00
|
|
|
return hres;
|
|
|
|
|
2011-01-07 19:03:23 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2017-09-15 18:33:19 +02:00
|
|
|
/******************************************************************
|
|
|
|
* IInternetExplorerManager implementation
|
|
|
|
*/
|
|
|
|
struct InternetExplorerManager {
|
|
|
|
IInternetExplorerManager IInternetExplorerManager_iface;
|
|
|
|
LONG ref;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline InternetExplorerManager *impl_from_IInternetExplorerManager(IInternetExplorerManager *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, InternetExplorerManager, IInternetExplorerManager_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetExplorerManager_QueryInterface(IInternetExplorerManager *iface, REFIID riid, void **out)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), out);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IInternetExplorerManager) || IsEqualGUID(riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
IInternetExplorerManager_AddRef(iface);
|
|
|
|
*out = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("interface %s not implemented\n", debugstr_guid(riid));
|
|
|
|
*out = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InternetExplorerManager_AddRef(IInternetExplorerManager *iface)
|
|
|
|
{
|
|
|
|
InternetExplorerManager *This = impl_from_IInternetExplorerManager(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2022-02-11 08:39:53 +01:00
|
|
|
TRACE("(%p) increasing refcount to %lu\n", iface, ref);
|
2017-09-15 18:33:19 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InternetExplorerManager_Release(IInternetExplorerManager *iface)
|
|
|
|
{
|
|
|
|
InternetExplorerManager *This = impl_from_IInternetExplorerManager(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
2022-02-11 08:39:53 +01:00
|
|
|
TRACE("(%p) decreasing refcount to %lu\n", iface, ref);
|
2017-09-15 18:33:19 +02:00
|
|
|
|
|
|
|
if (ref == 0)
|
2018-03-14 18:10:07 +01:00
|
|
|
{
|
2017-09-15 18:33:19 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2018-03-14 18:10:07 +01:00
|
|
|
released_obj();
|
|
|
|
}
|
2017-09-15 18:33:19 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InternetExplorerManager_CreateObject(IInternetExplorerManager *iface, DWORD config, LPCWSTR url, REFIID riid, void **ppv)
|
|
|
|
{
|
2022-02-11 08:39:53 +01:00
|
|
|
FIXME("(%p)->(0x%lx, %s, %s, %p) stub!\n", iface, config, debugstr_w(url), debugstr_guid(riid), ppv);
|
2017-09-15 18:33:19 +02:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IInternetExplorerManagerVtbl InternetExplorerManager_vtbl =
|
|
|
|
{
|
|
|
|
InternetExplorerManager_QueryInterface,
|
|
|
|
InternetExplorerManager_AddRef,
|
|
|
|
InternetExplorerManager_Release,
|
|
|
|
InternetExplorerManager_CreateObject,
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT WINAPI InternetExplorerManager_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
InternetExplorerManager *ret;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p %s %p)\n", pOuter, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if (!(ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret))))
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
ret->IInternetExplorerManager_iface.lpVtbl = &InternetExplorerManager_vtbl;
|
|
|
|
ret->ref = 1;
|
|
|
|
|
|
|
|
hr = IInternetExplorerManager_QueryInterface(&ret->IInternetExplorerManager_iface, riid, ppv);
|
|
|
|
IInternetExplorerManager_Release(&ret->IInternetExplorerManager_iface);
|
|
|
|
|
2018-03-14 18:10:07 +01:00
|
|
|
InterlockedIncrement(&obj_cnt);
|
2017-09-15 18:33:19 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2011-01-07 19:03:23 +01:00
|
|
|
void released_obj(void)
|
|
|
|
{
|
|
|
|
if(!InterlockedDecrement(&obj_cnt))
|
|
|
|
PostQuitMessage(0);
|
2006-04-19 20:33:32 +02:00
|
|
|
}
|
2006-04-19 20:34:53 +02:00
|
|
|
|
2017-09-15 07:43:06 +02:00
|
|
|
static BOOL create_ie_window(BOOL nohome, const WCHAR *cmdline)
|
2011-01-07 19:06:39 +01:00
|
|
|
{
|
|
|
|
InternetExplorer *ie;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = create_ie(&ie);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
IWebBrowser2_put_Visible(&ie->IWebBrowser2_iface, VARIANT_TRUE);
|
|
|
|
IWebBrowser2_put_MenuBar(&ie->IWebBrowser2_iface, VARIANT_TRUE);
|
|
|
|
|
|
|
|
if(!*cmdline) {
|
2017-09-15 07:43:06 +02:00
|
|
|
if (nohome)
|
|
|
|
ie->nohome = TRUE;
|
|
|
|
else
|
|
|
|
IWebBrowser2_GoHome(&ie->IWebBrowser2_iface);
|
2011-01-07 19:06:39 +01:00
|
|
|
}else {
|
|
|
|
VARIANT var_url;
|
|
|
|
int cmdlen;
|
|
|
|
|
2019-06-05 08:39:04 +02:00
|
|
|
cmdlen = lstrlenW(cmdline);
|
2011-01-07 19:06:39 +01:00
|
|
|
if(cmdlen > 2 && cmdline[0] == '"' && cmdline[cmdlen-1] == '"') {
|
|
|
|
cmdline++;
|
|
|
|
cmdlen -= 2;
|
|
|
|
}
|
|
|
|
|
2017-09-15 07:43:06 +02:00
|
|
|
V_VT(&var_url) = VT_BSTR;
|
|
|
|
V_BSTR(&var_url) = SysAllocStringLen(cmdline, cmdlen);
|
2011-01-07 19:06:39 +01:00
|
|
|
|
2017-09-15 07:43:06 +02:00
|
|
|
/* navigate to the first page */
|
|
|
|
IWebBrowser2_Navigate2(&ie->IWebBrowser2_iface, &var_url, NULL, NULL, NULL, NULL);
|
2011-01-07 19:06:39 +01:00
|
|
|
|
2017-09-15 07:43:06 +02:00
|
|
|
SysFreeString(V_BSTR(&var_url));
|
2011-01-07 19:06:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
IWebBrowser2_Release(&ie->IWebBrowser2_iface);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-08-31 12:51:24 +02:00
|
|
|
static HDDEDATA open_dde_url(WCHAR *dde_url)
|
2011-01-07 19:06:17 +01:00
|
|
|
{
|
2011-02-05 14:37:40 +01:00
|
|
|
InternetExplorer *ie = NULL, *iter;
|
2011-01-07 19:06:17 +01:00
|
|
|
WCHAR *url, *url_end;
|
|
|
|
VARIANT urlv;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w(dde_url));
|
|
|
|
|
|
|
|
url = dde_url;
|
|
|
|
if(*url == '"') {
|
|
|
|
url++;
|
2019-06-05 08:39:04 +02:00
|
|
|
url_end = wcschr(url, '"');
|
2011-01-07 19:06:17 +01:00
|
|
|
if(!url_end) {
|
|
|
|
FIXME("missing string terminator\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
*url_end = 0;
|
|
|
|
}else {
|
2019-06-05 08:39:04 +02:00
|
|
|
url_end = wcschr(url, ',');
|
2011-01-07 19:06:17 +01:00
|
|
|
if(url_end)
|
|
|
|
*url_end = 0;
|
|
|
|
else
|
2019-06-05 08:39:04 +02:00
|
|
|
url_end = url + lstrlenW(url);
|
2011-01-07 19:06:17 +01:00
|
|
|
}
|
|
|
|
|
2011-01-07 19:07:05 +01:00
|
|
|
LIST_FOR_EACH_ENTRY(iter, &ie_list, InternetExplorer, entry) {
|
|
|
|
if(iter->nohome) {
|
|
|
|
IWebBrowser2_AddRef(&iter->IWebBrowser2_iface);
|
|
|
|
ie = iter;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ie) {
|
|
|
|
hres = create_ie(&ie);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return 0;
|
|
|
|
}
|
2011-01-07 19:06:17 +01:00
|
|
|
|
2011-01-07 19:06:39 +01:00
|
|
|
IWebBrowser2_put_Visible(&ie->IWebBrowser2_iface, VARIANT_TRUE);
|
|
|
|
IWebBrowser2_put_MenuBar(&ie->IWebBrowser2_iface, VARIANT_TRUE);
|
2011-01-07 19:06:17 +01:00
|
|
|
|
|
|
|
V_VT(&urlv) = VT_BSTR;
|
|
|
|
V_BSTR(&urlv) = SysAllocStringLen(url, url_end-url);
|
|
|
|
if(!V_BSTR(&urlv)) {
|
2011-01-07 19:06:39 +01:00
|
|
|
IWebBrowser2_Release(&ie->IWebBrowser2_iface);
|
2011-01-07 19:06:17 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-01-07 19:06:39 +01:00
|
|
|
hres = IWebBrowser2_Navigate2(&ie->IWebBrowser2_iface, &urlv, NULL, NULL, NULL, NULL);
|
2011-01-07 19:06:17 +01:00
|
|
|
if(FAILED(hres))
|
|
|
|
return 0;
|
|
|
|
|
2011-01-07 19:06:39 +01:00
|
|
|
IWebBrowser2_Release(&ie->IWebBrowser2_iface);
|
2011-08-31 12:51:24 +02:00
|
|
|
return ULongToHandle(DDE_FACK);
|
2011-01-07 19:06:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HDDEDATA WINAPI dde_proc(UINT type, UINT uFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA data,
|
|
|
|
ULONG_PTR dwData1, ULONG_PTR dwData2)
|
|
|
|
{
|
|
|
|
switch(type) {
|
|
|
|
case XTYP_CONNECT:
|
|
|
|
TRACE("XTYP_CONNECT %p\n", hsz1);
|
2011-08-31 12:51:24 +02:00
|
|
|
return ULongToHandle(!DdeCmpStringHandles(hsz1, ddestr_openurl));
|
2011-01-07 19:06:17 +01:00
|
|
|
|
|
|
|
case XTYP_EXECUTE: {
|
|
|
|
WCHAR *url;
|
|
|
|
DWORD size;
|
|
|
|
HDDEDATA ret;
|
|
|
|
|
|
|
|
TRACE("XTYP_EXECUTE %p\n", data);
|
|
|
|
|
|
|
|
size = DdeGetData(data, NULL, 0, 0);
|
|
|
|
if(!size) {
|
|
|
|
WARN("size = 0\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
url = heap_alloc(size);
|
|
|
|
if(!url)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if(DdeGetData(data, (BYTE*)url, size, 0) != size) {
|
|
|
|
ERR("error during read\n");
|
2012-10-28 16:16:39 +01:00
|
|
|
heap_free(url);
|
2011-01-07 19:06:17 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-08-31 12:51:24 +02:00
|
|
|
ret = open_dde_url(url);
|
2011-01-07 19:06:17 +01:00
|
|
|
|
|
|
|
heap_free(url);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
case XTYP_REQUEST:
|
|
|
|
FIXME("XTYP_REQUEST\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
TRACE("type %d\n", type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void init_dde(void)
|
|
|
|
{
|
|
|
|
UINT res;
|
|
|
|
|
|
|
|
static const WCHAR iexploreW[] = {'I','E','x','p','l','o','r','e',0};
|
|
|
|
static const WCHAR openurlW[] = {'W','W','W','_','O','p','e','n','U','R','L',0};
|
|
|
|
|
|
|
|
res = DdeInitializeW(&dde_inst, dde_proc, CBF_SKIP_ALLNOTIFICATIONS | CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0);
|
|
|
|
if(res != DMLERR_NO_ERROR) {
|
|
|
|
WARN("DdeInitialize failed: %u\n", res);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ddestr_iexplore = DdeCreateStringHandleW(dde_inst, iexploreW, CP_WINUNICODE);
|
|
|
|
if(!ddestr_iexplore)
|
|
|
|
WARN("Failed to create string handle: %u\n", DdeGetLastError(dde_inst));
|
|
|
|
|
|
|
|
ddestr_openurl = DdeCreateStringHandleW(dde_inst, openurlW, CP_WINUNICODE);
|
|
|
|
if(!ddestr_openurl)
|
|
|
|
WARN("Failed to create string handle: %u\n", DdeGetLastError(dde_inst));
|
|
|
|
|
2013-08-12 11:32:45 +02:00
|
|
|
if(!DdeNameService(dde_inst, ddestr_iexplore, 0, DNS_REGISTER))
|
|
|
|
WARN("DdeNameService failed\n");
|
2011-01-07 19:06:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void release_dde(void)
|
|
|
|
{
|
|
|
|
if(ddestr_iexplore)
|
|
|
|
DdeNameService(dde_inst, ddestr_iexplore, 0, DNS_UNREGISTER);
|
|
|
|
if(ddestr_openurl)
|
|
|
|
DdeFreeStringHandle(dde_inst, ddestr_openurl);
|
|
|
|
if(ddestr_iexplore)
|
|
|
|
DdeFreeStringHandle(dde_inst, ddestr_iexplore);
|
|
|
|
DdeUninitialize(dde_inst);
|
|
|
|
}
|
|
|
|
|
2006-04-19 20:34:53 +02:00
|
|
|
/******************************************************************
|
2011-07-29 12:18:33 +02:00
|
|
|
* IEWinMain (ieframe.101)
|
2006-04-19 20:34:53 +02:00
|
|
|
*
|
|
|
|
* Only returns on error.
|
|
|
|
*/
|
2011-10-20 16:46:59 +02:00
|
|
|
DWORD WINAPI IEWinMain(const WCHAR *cmdline, int nShowWindow)
|
2006-04-19 20:34:53 +02:00
|
|
|
{
|
2006-04-21 12:14:57 +02:00
|
|
|
MSG msg;
|
2006-04-19 20:37:57 +02:00
|
|
|
HRESULT hres;
|
2017-09-15 18:33:19 +02:00
|
|
|
BOOL embedding = FALSE, nohome = FALSE, manager = FALSE;
|
|
|
|
DWORD reg_cookie;
|
2006-04-19 20:34:53 +02:00
|
|
|
|
2011-10-20 16:46:59 +02:00
|
|
|
static const WCHAR embeddingW[] = {'-','e','m','b','e','d','d','i','n','g',0};
|
2017-09-15 07:43:06 +02:00
|
|
|
static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e',0};
|
2017-09-15 18:33:19 +02:00
|
|
|
static const WCHAR startmanagerW[] = {'-','s','t','a','r','t','m','a','n','a','g','e','r',0};
|
2011-10-20 16:46:59 +02:00
|
|
|
|
|
|
|
TRACE("%s %d\n", debugstr_w(cmdline), nShowWindow);
|
2007-11-02 19:51:53 +01:00
|
|
|
|
2006-04-19 20:34:53 +02:00
|
|
|
CoInitialize(NULL);
|
|
|
|
|
2011-01-07 19:06:17 +01:00
|
|
|
init_dde();
|
|
|
|
|
2017-09-15 07:43:06 +02:00
|
|
|
while (*cmdline)
|
|
|
|
{
|
|
|
|
int length = 0;
|
|
|
|
|
|
|
|
while (*cmdline == ' ' || *cmdline == '\t') cmdline++;
|
|
|
|
if (!*cmdline) break;
|
|
|
|
|
|
|
|
while (cmdline[length] && cmdline[length] != ' ' && cmdline[length] != '\t') length++;
|
|
|
|
|
2019-06-05 08:39:04 +02:00
|
|
|
if (!wcsnicmp(cmdline, embeddingW, length))
|
2017-09-15 07:43:06 +02:00
|
|
|
embedding = TRUE;
|
2019-06-05 08:39:04 +02:00
|
|
|
else if (!wcsnicmp(cmdline, nohomeW, length))
|
2017-09-15 07:43:06 +02:00
|
|
|
nohome = TRUE;
|
2019-06-05 08:39:04 +02:00
|
|
|
else if (!wcsnicmp(cmdline, startmanagerW, length))
|
2017-09-15 18:33:19 +02:00
|
|
|
manager = TRUE;
|
2017-09-15 07:43:06 +02:00
|
|
|
else
|
|
|
|
break;
|
|
|
|
|
|
|
|
cmdline += length;
|
|
|
|
}
|
|
|
|
|
2017-09-15 18:33:19 +02:00
|
|
|
if (manager)
|
|
|
|
hres = CoRegisterClassObject(&CLSID_InternetExplorerManager,
|
|
|
|
(IUnknown*)&InternetExplorerManagerFactory, CLSCTX_SERVER,
|
|
|
|
REGCLS_SINGLEUSE, ®_cookie);
|
|
|
|
else
|
|
|
|
hres = CoRegisterClassObject(&CLSID_InternetExplorer,
|
|
|
|
(IUnknown*)&InternetExplorerFactory, CLSCTX_SERVER,
|
|
|
|
REGCLS_MULTIPLEUSE, ®_cookie);
|
|
|
|
|
|
|
|
if (FAILED(hres))
|
|
|
|
{
|
2022-02-11 08:39:53 +01:00
|
|
|
ERR("failed to register CLSID_InternetExplorer%s: %08lx\n", manager ? "Manager" : "", hres);
|
2017-09-15 18:33:19 +02:00
|
|
|
CoUninitialize();
|
|
|
|
ExitProcess(1);
|
|
|
|
}
|
|
|
|
|
2017-09-15 07:43:06 +02:00
|
|
|
if (!embedding)
|
|
|
|
{
|
|
|
|
if(!create_ie_window(nohome, cmdline))
|
|
|
|
{
|
2011-01-07 19:03:23 +01:00
|
|
|
CoUninitialize();
|
|
|
|
ExitProcess(1);
|
|
|
|
}
|
|
|
|
}
|
2006-04-21 12:14:57 +02:00
|
|
|
|
|
|
|
/* run the message loop for this thread */
|
|
|
|
while (GetMessageW(&msg, 0, 0, 0))
|
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessageW(&msg);
|
|
|
|
}
|
2006-04-19 20:34:53 +02:00
|
|
|
|
2017-09-15 18:33:19 +02:00
|
|
|
CoRevokeClassObject(reg_cookie);
|
2011-01-07 19:06:17 +01:00
|
|
|
release_dde();
|
2006-04-19 20:37:57 +02:00
|
|
|
|
|
|
|
CoUninitialize();
|
2006-04-19 20:34:53 +02:00
|
|
|
|
|
|
|
ExitProcess(0);
|
|
|
|
return 0;
|
|
|
|
}
|