diff --git a/src/launcher/html/html_frame.cpp b/src/launcher/html/html_frame.cpp index 175f3e3..0c591a4 100644 --- a/src/launcher/html/html_frame.cpp +++ b/src/launcher/html/html_frame.cpp @@ -1,9 +1,44 @@ #include #include "html_frame.hpp" #include "utils/nt.hpp" +#include "utils/hook.hpp" std::atomic html_frame::frame_count_ = 0; +namespace +{ + void* original_func{}; + GUID browser_emulation_guid{0xac969931, 0x3566, 0x4b50, {0xae, 0x48, 0x71, 0xb9, 0x6a, 0x75, 0xc8, 0x79}}; + + int WINAPI co_internet_feature_value_internal_stub(const GUID* guid, uint32_t* result) + { + const auto res = static_cast(original_func)(guid, result); + + if (IsEqualGUID(*guid, browser_emulation_guid)) + { + *result = 11000; + return 0; + } + + return res; + } + + void setup_ie_hook() + { + static const auto _ = [] + { + const auto urlmon = utils::nt::library::load("urlmon.dll"s); + const auto target = urlmon.get_iat_entry("iertutil.dll", MAKEINTRESOURCEA(700)); + + original_func = *target; + utils::hook::set(target, co_internet_feature_value_internal_stub); + + return 0; + }(); + (void)_; + } +} + html_frame::callback_params::callback_params(DISPPARAMS* params, VARIANT* res) : result(res) { for (auto i = params->cArgs; i > 0; --i) @@ -16,12 +51,13 @@ html_frame::callback_params::callback_params(DISPPARAMS* params, VARIANT* res) : html_frame::html_frame() : in_place_frame_(this), in_place_site_(this), ui_handler_(this), client_site_(this), html_dispatch_(this) { + setup_ie_hook(); if (frame_count_++ == 0 && OleInitialize(nullptr) != S_OK) { throw std::runtime_error("Unable to initialize the OLE library"); } - set_browser_feature("FEATURE_BROWSER_EMULATION", 12000); + set_browser_feature("FEATURE_BROWSER_EMULATION", 11000); set_browser_feature("FEATURE_GPU_RENDERING", 1); }