From 997e92d38bbb234391f6aa583bd370d94bf4173b Mon Sep 17 00:00:00 2001 From: brave-builds Date: Mon, 22 Jan 2024 17:42:58 +0000 Subject: [PATCH 1/3] Uplift of #20754 (squashed) to beta --- .gitattributes | 2 + browser/brave_browser_process_impl.cc | 16 +- .../dns/brave_vpn_dns_observer_service_win.cc | 3 +- browser/brave_vpn/sources.gni | 5 +- browser/brave_vpn/win/DEPS | 3 + .../win/brave_vpn_wireguard_service/BUILD.gn | 26 +- .../{service => }/install_utils.cc | 127 +- .../{service => }/install_utils.h | 8 +- .../win/brave_vpn_wireguard_service/main.cc | 19 - .../service/BUILD.gn | 4 +- .../status_tray/BUILD.gn | 3 - .../status_tray/install_utils.cc | 27 - .../status_tray/install_utils.h | 17 - browser/brave_vpn/win/vpn_utils_win.cc | 48 + browser/brave_vpn/win/vpn_utils_win.h | 15 + .../brave_vpn_browser_proxy.ts | 11 +- .../brave_system_page/brave_vpn_page.ts | 19 - .../settings/brave_vpn/brave_vpn_handler.cc | 39 +- .../settings/brave_vpn/brave_vpn_handler.h | 7 +- build/commands/lib/util.js | 29 +- build/commands/scripts/updatePatches.js | 8 +- build/config/brave_build.gni | 1 + chromium_src/check_chromium_src_config.json5 | 1 + chromium_src/chrome/elevation_service/DEPS | 9 + .../elevation_service_idl.idl | 180 +++ .../chrome/elevation_service/elevator.cc | 45 + .../chrome/elevation_service/elevator.h | 21 + .../install_static/chromium_install_modes.cc | 40 +- chromium_src/chrome/installer/DEPS | 4 +- .../chrome/installer/setup/install_worker.cc | 154 ++- .../chrome/installer/setup/install_worker.h | 22 + .../chrome/installer/setup/sources.gni | 1 + .../chrome/installer/setup/test/BUILD.gn | 25 + .../setup/test/install_worker_vpn_unittest.cc | 173 +++ .../chrome/installer/setup/uninstall.cc | 29 +- .../brave_vpn/browser/brave_vpn_service.cc | 6 +- .../brave_vpn/browser/connection/BUILD.gn | 1 + .../connection/brave_vpn_os_connection_api.cc | 76 +- .../connection/brave_vpn_os_connection_api.h | 28 +- .../mac/brave_vpn_ras_connection_api_mac.mm | 4 +- .../ikev2/win/brave_vpn_helper/BUILD.gn | 20 +- .../ikev2/win/brave_vpn_helper/DEPS | 1 + .../brave_vpn_helper_constants.h | 15 +- .../brave_vpn_helper_crash_reporter_client.cc | 3 +- ...per_state.cc => brave_vpn_helper_utils.cc} | 73 +- ...elper_state.h => brave_vpn_helper_utils.h} | 15 +- .../ikev2/win/brave_vpn_helper/main.cc | 10 +- .../win/brave_vpn_helper/service_main.cc | 2 +- .../win/brave_vpn_helper/vpn_dns_handler.cc | 2 +- .../ikev2/win/brave_vpn_helper/vpn_utils.cc | 76 +- .../ikev2/win/brave_vpn_helper/vpn_utils.h | 3 - .../win/brave_vpn_ras_connection_api_win.cc | 14 +- .../win/brave_vpn_ras_connection_api_win.h | 3 +- ...brave_vpn_wireguard_connection_api_base.cc | 4 + .../brave_vpn_wireguard_connection_api_mac.mm | 4 +- .../win/brave_vpn_wireguard_connection_api.cc | 17 +- .../win/brave_vpn_wireguard_connection_api.h | 3 +- .../brave_vpn/common/brave_vpn_utils.cc | 2 +- components/brave_vpn/common/win/BUILD.gn | 1 + .../brave_vpn/common/win/scoped_sc_handle.h | 1 + .../common/wireguard/win/service_constants.h | 7 - .../common/wireguard/win/service_details.cc | 10 +- .../common/wireguard/win/storage_utils.cc | 2 +- .../wireguard/win/wireguard_utils_win.cc | 2 +- .../wireguard/win/wireguard_utils_win.h | 2 +- elevation_service/README.md | 29 + elevation_service/sources.gni | 17 + .../chrome-elevation_service-BUILD.gn.patch | 20 + ...taller-mini_installer-chrome.release.patch | 7 +- test/BUILD.gn | 6 + .../arm64/elevation_service_idl.dlldata.c | 38 + .../arm64/elevation_service_idl.h | 1036 ++++++++++++++++ .../arm64/elevation_service_idl.tlb | Bin 0 -> 3768 bytes .../arm64/elevation_service_idl_i.c | 100 ++ .../arm64/elevation_service_idl_p.c | 1100 +++++++++++++++++ .../x64/elevation_service_idl.dlldata.c | 38 + .../x64/elevation_service_idl.h | 1036 ++++++++++++++++ .../x64/elevation_service_idl.tlb | Bin 0 -> 3768 bytes .../x64/elevation_service_idl_i.c | 100 ++ .../x64/elevation_service_idl_p.c | 1078 ++++++++++++++++ .../x86/elevation_service_idl.dlldata.c | 38 + .../x86/elevation_service_idl.h | 1036 ++++++++++++++++ .../x86/elevation_service_idl.tlb | Bin 0 -> 3768 bytes .../x86/elevation_service_idl_i.c | 100 ++ .../x86/elevation_service_idl_p.c | 1081 ++++++++++++++++ 85 files changed, 7963 insertions(+), 445 deletions(-) create mode 100644 browser/brave_vpn/win/DEPS rename browser/brave_vpn/win/brave_vpn_wireguard_service/{service => }/install_utils.cc (52%) rename browser/brave_vpn/win/brave_vpn_wireguard_service/{service => }/install_utils.h (84%) delete mode 100644 browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.cc delete mode 100644 browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.h create mode 100644 browser/brave_vpn/win/vpn_utils_win.cc create mode 100644 browser/brave_vpn/win/vpn_utils_win.h create mode 100644 chromium_src/chrome/elevation_service/DEPS create mode 100644 chromium_src/chrome/elevation_service/elevation_service_idl.idl create mode 100644 chromium_src/chrome/elevation_service/elevator.cc create mode 100644 chromium_src/chrome/elevation_service/elevator.h create mode 100644 chromium_src/chrome/installer/setup/install_worker.h create mode 100644 chromium_src/chrome/installer/setup/test/BUILD.gn create mode 100644 chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc rename components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/{brave_vpn_helper_state.cc => brave_vpn_helper_utils.cc} (79%) rename components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/{brave_vpn_helper_state.h => brave_vpn_helper_utils.h} (81%) create mode 100644 elevation_service/README.md create mode 100644 elevation_service/sources.gni create mode 100644 patches/chrome-elevation_service-BUILD.gn.patch create mode 100644 win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.dlldata.c create mode 100644 win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.h create mode 100644 win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.tlb create mode 100644 win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_i.c create mode 100644 win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_p.c create mode 100644 win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.dlldata.c create mode 100644 win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h create mode 100644 win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.tlb create mode 100644 win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c create mode 100644 win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c create mode 100644 win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.dlldata.c create mode 100644 win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h create mode 100644 win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.tlb create mode 100644 win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_i.c create mode 100644 win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c diff --git a/.gitattributes b/.gitattributes index 8afa7c2e83ad..6f5e485612db 100644 --- a/.gitattributes +++ b/.gitattributes @@ -54,6 +54,8 @@ VERSION text eol=lf # These files should have CRLF win_build_output/midl/brave/**/*.c text eol=crlf win_build_output/midl/brave/**/*.h text eol=crlf +win_build_output/midl/chrome/**/*.c text eol=crlf +win_build_output/midl/chrome/**/*.h text eol=crlf win_build_output/midl/google_update/*/*.c text eol=crlf diff --git a/browser/brave_browser_process_impl.cc b/browser/brave_browser_process_impl.cc index 503d64e7f089..8f3b16303c85 100644 --- a/browser/brave_browser_process_impl.cc +++ b/browser/brave_browser_process_impl.cc @@ -97,6 +97,9 @@ #if BUILDFLAG(ENABLE_BRAVE_VPN) #include "brave/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h" +#if BUILDFLAG(IS_WIN) +#include "brave/browser/brave_vpn/win/vpn_utils_win.h" +#endif #endif using brave_component_updater::BraveComponent; @@ -505,8 +508,19 @@ BraveBrowserProcessImpl::brave_vpn_os_connection_api() { return brave_vpn_os_connection_api_.get(); } + // Currently, service installer only used on Windows. + // Installs registers IKEv2 service (for DNS) and our WireGuard impl. + // NOTE: Install only happens if person has purchased the product. + auto service_installer = +#if BUILDFLAG(IS_WIN) + base::BindRepeating(&brave_vpn::InstallVpnSystemServices); +#else + base::NullCallback(); +#endif + brave_vpn_os_connection_api_ = brave_vpn::CreateBraveVPNConnectionAPI( - shared_url_loader_factory(), local_state(), chrome::GetChannel()); + shared_url_loader_factory(), local_state(), chrome::GetChannel(), + service_installer); return brave_vpn_os_connection_api_.get(); } #endif diff --git a/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc b/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc index 061fab760de8..986dce09f704 100644 --- a/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc +++ b/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc @@ -9,8 +9,7 @@ #include "base/strings/string_util.h" #include "brave/browser/ui/views/brave_vpn/brave_vpn_dns_settings_notificiation_dialog_view.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #include "brave/components/brave_vpn/common/pref_names.h" #include "brave/components/brave_vpn/common/win/utils.h" diff --git a/browser/brave_vpn/sources.gni b/browser/brave_vpn/sources.gni index 7173e57d4e39..259918afe00b 100644 --- a/browser/brave_vpn/sources.gni +++ b/browser/brave_vpn/sources.gni @@ -25,8 +25,9 @@ if (enable_brave_vpn) { "//brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_factory_win.h", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.cc", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.h", + "//brave/browser/brave_vpn/win/vpn_utils_win.cc", + "//brave/browser/brave_vpn/win/vpn_utils_win.h", ] - brave_browser_brave_vpn_deps += [ "//brave/app:brave_generated_resources_grit", "//brave/browser:browser_process", @@ -34,6 +35,8 @@ if (enable_brave_vpn) { "//brave/components/brave_vpn/common/win", "//brave/components/brave_vpn/common/wireguard/win", "//chrome/common:constants", + "//chrome/elevation_service:public_headers", + "//chrome/install_static:install_static_util", "//components/prefs", "//net", "//third_party/abseil-cpp:absl", diff --git a/browser/brave_vpn/win/DEPS b/browser/brave_vpn/win/DEPS new file mode 100644 index 000000000000..114673e2db2f --- /dev/null +++ b/browser/brave_vpn/win/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + '+chrome/elevation_service/elevation_service_idl.h', +] diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn index d62a58789e72..61a2d94f4b37 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn @@ -6,12 +6,13 @@ import( "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/allowlist.gni") import("//brave/build/config.gni") +import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//build/toolchain/gcc_toolchain.gni") import("//build/util/process_version.gni") import("//chrome/process_version_rc_template.gni") import("//tools/resources/generate_resource_allowlist.gni") -assert(is_win) +assert(is_win && enable_brave_vpn) copy("brave_vpn_wireguard_binaries") { sources = [ @@ -64,11 +65,6 @@ executable("brave_vpn_wireguard_service") { ] public_configs = [ "//build/config/win:windowed" ] - - libs = [ - "userenv.lib", # For GetUserProfileDirectoryW() - "runtimeobject.lib", - ] } process_version_rc_template("version_resources") { @@ -77,6 +73,24 @@ process_version_rc_template("version_resources") { output = "$target_gen_dir/brave_vpn_wireguard_service.rc" } +source_set("install_utils") { + sources = [ + "install_utils.cc", + "install_utils.h", + ] + public_deps = [ "//brave/components/brave_vpn/common/wireguard/win:brave_wireguard_manager_idl" ] + deps = [ + "//base", + "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service", + "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray", + "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon:utils", + "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", + "//brave/components/brave_vpn/common/win", + "//brave/components/brave_vpn/common/wireguard/win", + "//chrome/installer/util:work_item", + ] +} + group("unit_tests") { testonly = true deps = [ diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc similarity index 52% rename from browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.cc rename to browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc index a1846b2b5a97..03b8161fda0e 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc @@ -3,7 +3,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h" + +#include +#include +#include +#include +#include + +#include #include "base/base_paths.h" #include "base/command_line.h" @@ -14,12 +22,16 @@ #include "base/win/registry.h" #include "base/win/windows_types.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.h" +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/brave_vpn_tray_command_ids.h" +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/icon_utils.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/components/brave_vpn/common/win/scoped_sc_handle.h" #include "brave/components/brave_vpn/common/win/utils.h" #include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" #include "brave/components/brave_vpn/common/wireguard/win/service_details.h" #include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" #include "chrome/installer/util/install_service_work_item.h" namespace brave_vpn { @@ -57,6 +69,79 @@ void RemoveFromStartup(const std::wstring& value) { } key.DeleteValue(value.c_str()); } + +// Microsoft-Windows-NetworkProfile +// fbcfac3f-8459-419f-8e48-1f0b49cdb85e +constexpr GUID kNetworkProfileGUID = { + 0xfbcfac3f, + 0x8459, + 0x419f, + {0x8e, 0x48, 0x1f, 0x0b, 0x49, 0xcd, 0xb8, 0x5e}}; + +bool SetServiceTriggerForVPNConnection(SC_HANDLE hService, + const std::wstring& brave_vpn_entry) { + std::wstring brave_vpn_entry_with_null(brave_vpn_entry); + brave_vpn_entry_with_null += L'\0'; + // Allocate and set the SERVICE_TRIGGER_SPECIFIC_DATA_ITEM structure + SERVICE_TRIGGER_SPECIFIC_DATA_ITEM deviceData = {0}; + deviceData.dwDataType = SERVICE_TRIGGER_DATA_TYPE_STRING; + // Exclude EOL + deviceData.cbData = brave_vpn_entry_with_null.size() * + sizeof(brave_vpn_entry_with_null.front()); + deviceData.pData = (PBYTE)brave_vpn_entry_with_null.c_str(); + // Allocate and set the SERVICE_TRIGGER structure + SERVICE_TRIGGER serviceTrigger = {0}; + serviceTrigger.dwTriggerType = SERVICE_TRIGGER_TYPE_CUSTOM; + serviceTrigger.dwAction = SERVICE_TRIGGER_ACTION_SERVICE_START; + serviceTrigger.pTriggerSubtype = const_cast(&kNetworkProfileGUID); + serviceTrigger.cDataItems = 1; + serviceTrigger.pDataItems = &deviceData; + + // Allocate and set the SERVICE_TRIGGER_INFO structure + SERVICE_TRIGGER_INFO serviceTriggerInfo = {0}; + serviceTriggerInfo.cTriggers = 1; + serviceTriggerInfo.pTriggers = &serviceTrigger; + + // Call ChangeServiceConfig2 with the SERVICE_CONFIG_TRIGGER_INFO level + // and pass to it the address of the SERVICE_TRIGGER_INFO structure + return ChangeServiceConfig2(hService, SERVICE_CONFIG_TRIGGER_INFO, + &serviceTriggerInfo); +} + +bool ConfigureServiceAutoRestart(const std::wstring& service_name, + const std::wstring& brave_vpn_entry) { + ScopedScHandle scm(::OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT)); + if (!scm.IsValid()) { + VLOG(1) << "::OpenSCManager failed. service_name: " << service_name + << ", error: " << std::hex << HRESULTFromLastError(); + return false; + } + ScopedScHandle service( + ::OpenService(scm.Get(), service_name.c_str(), SERVICE_ALL_ACCESS)); + if (!service.IsValid()) { + VLOG(1) << "::OpenService failed. service_name: " << service_name + << ", error: " << std::hex << HRESULTFromLastError(); + return false; + } + + if (!brave_vpn::SetServiceFailureActions(service.Get())) { + VLOG(1) << "SetServiceFailureActions failed:" << std::hex + << HRESULTFromLastError(); + return false; + } + if (!SetServiceTriggerForVPNConnection(service.Get(), brave_vpn_entry)) { + VLOG(1) << "SetServiceTriggerForVPNConnection failed:" << std::hex + << HRESULTFromLastError(); + return false; + } + return true; +} + +base::FilePath GetBraveVpnHelperServicePath() { + base::FilePath asset_dir = base::PathService::CheckedGet(base::DIR_ASSETS); + return asset_dir.Append(brave_vpn::kBraveVPNHelperExecutable); +} + } // namespace bool ConfigureBraveWireguardService(const std::wstring& service_name) { @@ -66,10 +151,6 @@ bool ConfigureBraveWireguardService(const std::wstring& service_name) { << ", error: " << std::hex << HRESULTFromLastError(); return false; } - base::FilePath exe_path; - if (!base::PathService::Get(base::FILE_EXE, &exe_path)) { - return S_OK; - } ScopedScHandle service( ::OpenService(scm.Get(), service_name.c_str(), SERVICE_ALL_ACCESS)); @@ -92,10 +173,7 @@ bool ConfigureBraveWireguardService(const std::wstring& service_name) { // Installs Brave VPN Wireguard Windows service and configures the service // config. bool InstallBraveWireguardService() { - base::FilePath exe_dir; - base::PathService::Get(base::DIR_EXE, &exe_dir); - base::CommandLine service_cmd( - exe_dir.Append(brave_vpn::kBraveVpnWireguardServiceExecutable)); + base::CommandLine service_cmd(GetBraveVPNWireguardServiceExecutablePath()); installer::InstallServiceWorkItem install_service_work_item( brave_vpn::GetBraveVpnWireguardServiceName(), brave_vpn::GetBraveVpnWireguardServiceDisplayName(), SERVICE_DEMAND_START, @@ -143,4 +221,33 @@ bool UninstallBraveWireguardService() { return true; } +bool UninstallStatusTrayIcon() { + auto* hWnd = GetBraveVpnStatusTrayIconHWND(); + if (!hWnd) { + return true; + } + + return SendMessage(hWnd, + RegisterWindowMessage(kBraveVpnStatusTrayMessageName), + IDC_BRAVE_VPN_TRAY_EXIT, 0) == TRUE; +} + +bool InstallBraveVPNHelperService() { + base::CommandLine service_cmd(GetBraveVpnHelperServicePath()); + installer::InstallServiceWorkItem install_service_work_item( + brave_vpn::GetBraveVpnHelperServiceName(), + brave_vpn::GetBraveVpnHelperServiceDisplayName(), SERVICE_DEMAND_START, + service_cmd, base::CommandLine(base::CommandLine::NO_PROGRAM), + brave_vpn::kBraveVpnHelperRegistryStoragePath, {}, {}); + install_service_work_item.set_best_effort(true); + install_service_work_item.set_rollback_enabled(false); + if (install_service_work_item.Do()) { + auto success = + ConfigureServiceAutoRestart(brave_vpn::GetBraveVpnHelperServiceName(), + brave_vpn::GetBraveVPNConnectionName()); + return success; + } + return false; +} + } // namespace brave_vpn diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.h b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h similarity index 84% rename from browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.h rename to browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h index b6022860afdb..7cfb6f04edde 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.h +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_SERVICE_INSTALL_UTILS_H_ -#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_SERVICE_INSTALL_UTILS_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_INSTALL_UTILS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_INSTALL_UTILS_H_ #include @@ -13,7 +13,9 @@ namespace brave_vpn { bool ConfigureBraveWireguardService(const std::wstring& service_name); bool InstallBraveWireguardService(); bool UninstallBraveWireguardService(); +bool UninstallStatusTrayIcon(); +bool InstallBraveVPNHelperService(); } // namespace brave_vpn -#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_SERVICE_INSTALL_UTILS_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_INSTALL_UTILS_H_ diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc index b51e74dd604c..b8ae16c7f7d0 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc @@ -17,10 +17,8 @@ #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/notifications/notification_utils.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/resources/resource_loader.h" -#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/install_utils.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_service_runner.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.h" -#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.h" #include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" #include "chrome/install_static/product_install_details.h" @@ -132,23 +130,6 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { brave_vpn::kBraveVpnWireguardServiceConnectSwitchName)); } - // System level command line. Makes registeration and configuration for - // BraveVPNWireguardService windows service. Used by the installer. - if (command_line->HasSwitch( - brave_vpn::kBraveVpnWireguardServiceInstallSwitchName)) { - auto success = brave_vpn::InstallBraveWireguardService(); - return success ? 0 : 1; - } - - // System level command line. Unregisters BraveVPNWireguardService - // windows service and removes stored data. Used by the uninstaller. - if (command_line->HasSwitch( - brave_vpn::kBraveVpnWireguardServiceUnnstallSwitchName)) { - auto success = brave_vpn::UninstallBraveWireguardService() && - brave_vpn::UninstallStatusTrayIcon(); - return success ? 0 : 1; - } - auto result = ProcessUserLevelCommands(*command_line); if (result.has_value()) { return result.value(); diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn index 987243945403..983dfc042f40 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn @@ -11,8 +11,6 @@ source_set("service") { sources = [ "brave_wireguard_manager.cc", "brave_wireguard_manager.h", - "install_utils.cc", - "install_utils.h", "wireguard_service_runner.cc", "wireguard_service_runner.h", "wireguard_tunnel_service.cc", @@ -26,5 +24,5 @@ source_set("service") { "//brave/components/brave_vpn/common/wireguard/win", "//chrome/installer/util:with_no_strings", ] - libs = [ "Shell32.lib" ] + libs = [ "runtimeobject.lib" ] } diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn index 05adce32c95a..0a97aa0ff324 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn @@ -8,8 +8,6 @@ import("//build/toolchain/gcc_toolchain.gni") source_set("status_tray") { sources = [ "brave_vpn_tray_command_ids.h", - "install_utils.cc", - "install_utils.h", "status_tray_runner.cc", "status_tray_runner.h", ] @@ -33,7 +31,6 @@ source_set("status_tray") { if (!enable_resource_allowlist_generation) { deps += [ "//chrome:packed_resources" ] } - libs = [ "shell32.lib" ] } source_set("unit_tests") { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.cc deleted file mode 100644 index bd28eb251053..000000000000 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.cc +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.h" - -#include // needed for WM_MENUCOMMAND - -#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/brave_vpn_tray_command_ids.h" -#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/constants.h" -#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/icon_utils.h" - -namespace brave_vpn { - -bool UninstallStatusTrayIcon() { - auto* hWnd = GetBraveVpnStatusTrayIconHWND(); - if (!hWnd) { - return true; - } - - return SendMessage(hWnd, - RegisterWindowMessage(kBraveVpnStatusTrayMessageName), - IDC_BRAVE_VPN_TRAY_EXIT, 0) == TRUE; -} - -} // namespace brave_vpn diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.h b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.h deleted file mode 100644 index 956da2fc61ce..000000000000 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/install_utils.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_STATUS_TRAY_INSTALL_UTILS_H_ -#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_STATUS_TRAY_INSTALL_UTILS_H_ - -namespace brave_vpn { - -// Uninstallation actions for status tray icons, called from browser -// uninstaller. -bool UninstallStatusTrayIcon(); - -} // namespace brave_vpn - -#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_SERVICE_STATUS_TRAY_INSTALL_UTILS_H_ diff --git a/browser/brave_vpn/win/vpn_utils_win.cc b/browser/brave_vpn/win/vpn_utils_win.cc new file mode 100644 index 000000000000..3b714b502555 --- /dev/null +++ b/browser/brave_vpn/win/vpn_utils_win.cc @@ -0,0 +1,48 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. + +#include "brave/browser/brave_vpn/win/vpn_utils_win.h" + +#include + +#include "base/logging.h" +#include "base/win/com_init_util.h" +#include "chrome/elevation_service/elevation_service_idl.h" +#include "chrome/install_static/install_util.h" + +namespace brave_vpn { + +bool InstallVpnSystemServices() { + base::win::AssertComInitialized(); + + Microsoft::WRL::ComPtr elevator; + HRESULT hr = CoCreateInstance( + install_static::GetElevatorClsid(), nullptr, CLSCTX_LOCAL_SERVER, + install_static::GetElevatorIid(), IID_PPV_ARGS_Helper(&elevator)); + if (FAILED(hr)) { + VLOG(1) << "CoCreateInstance returned: 0x" << std::hex << hr; + return false; + } + + hr = CoSetProxyBlanket( + elevator.Get(), RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_DEFAULT, + COLE_DEFAULT_PRINCIPAL, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, + RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_DYNAMIC_CLOAKING); + if (FAILED(hr)) { + VLOG(1) << "CoSetProxyBlanket returned: 0x" << std::hex << hr; + return false; + } + + hr = elevator->InstallVPNServices(); + if (FAILED(hr)) { + VLOG(1) << "InstallVPNServices returned: 0x" << std::hex << hr; + return false; + } + + VLOG(1) << "InstallVPNServices: SUCCESS"; + return true; +} + +} // namespace brave_vpn diff --git a/browser/brave_vpn/win/vpn_utils_win.h b/browser/brave_vpn/win/vpn_utils_win.h new file mode 100644 index 000000000000..8391084c0e79 --- /dev/null +++ b/browser/brave_vpn/win/vpn_utils_win.h @@ -0,0 +1,15 @@ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_VPN_UTILS_WIN_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_VPN_UTILS_WIN_H_ + +namespace brave_vpn { + +bool InstallVpnSystemServices(); + +} // namespace brave_vpn + +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_VPN_UTILS_WIN_H_ diff --git a/browser/resources/settings/brave_system_page/brave_vpn_browser_proxy.ts b/browser/resources/settings/brave_system_page/brave_vpn_browser_proxy.ts index 495c6eff32a6..2939059f50c1 100644 --- a/browser/resources/settings/brave_system_page/brave_vpn_browser_proxy.ts +++ b/browser/resources/settings/brave_system_page/brave_vpn_browser_proxy.ts @@ -6,18 +6,13 @@ import {sendWithPromise} from 'chrome://resources/js/cr.js'; export interface BraveVPNBrowserProxy { - registerWireguardService(): Promise; - isWireguardServiceRegistered(): Promise; + isWireguardServiceInstalled(): Promise; isBraveVpnConnected(): Promise; } export class BraveVPNBrowserProxyImpl implements BraveVPNBrowserProxy { - registerWireguardService () { - return sendWithPromise('registerWireguardService'); - } - - isWireguardServiceRegistered () { - return sendWithPromise('isWireguardServiceRegistered'); + isWireguardServiceInstalled () { + return sendWithPromise('isWireguardServiceInstalled'); } isBraveVpnConnected () { diff --git a/browser/resources/settings/brave_system_page/brave_vpn_page.ts b/browser/resources/settings/brave_system_page/brave_vpn_page.ts index 74bf8eefb422..5b2b3f2bf432 100644 --- a/browser/resources/settings/brave_system_page/brave_vpn_page.ts +++ b/browser/resources/settings/brave_system_page/brave_vpn_page.ts @@ -96,29 +96,10 @@ export class SettingsBraveVpnPageElement this.initialProtocolValue_) } - private isWireguardServiceRegistered(success: boolean) { - if (success) - return; - // Try to register it. - this.vpnBrowserProxy_.registerWireguardService().then( - (success: boolean) => { - if (!success) { - this.resetToInitialValue() - this.updateState() - return; - } - }) - } - private onChange_() { this.updateState(); if (!this.getCurrentPrefValue()) return - // - // If user enabled Wireguard service we have to check if it was registered. - this.vpnBrowserProxy_.isWireguardServiceRegistered().then( - this.isWireguardServiceRegistered.bind(this)) - // } private onRestartClick_(e: Event) { diff --git a/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc b/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc index e219e2482763..945959394cd7 100644 --- a/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc +++ b/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc @@ -24,20 +24,6 @@ #include "components/prefs/pref_service.h" #include "components/version_info/version_info.h" -namespace { - -bool ElevatedRegisterBraveVPNService() { - auto executable_path = brave_vpn::GetBraveVPNWireguardServiceExecutablePath(); - base::CommandLine cmd(executable_path); - cmd.AppendSwitch(brave_vpn::kBraveVpnWireguardServiceInstallSwitchName); - base::LaunchOptions options = base::LaunchOptions(); - options.wait = true; - options.elevated = true; - return base::LaunchProcess(cmd, options).IsValid(); -} - -} // namespace - BraveVpnHandler::BraveVpnHandler(Profile* profile) : profile_(profile) { auto* service = brave_vpn::BraveVpnServiceFactory::GetForProfile(profile); CHECK(service); @@ -54,12 +40,8 @@ BraveVpnHandler::~BraveVpnHandler() = default; void BraveVpnHandler::RegisterMessages() { web_ui()->RegisterMessageCallback( - "registerWireguardService", - base::BindRepeating(&BraveVpnHandler::HandleRegisterWireguardService, - base::Unretained(this))); - web_ui()->RegisterMessageCallback( - "isWireguardServiceRegistered", - base::BindRepeating(&BraveVpnHandler::HandleIsWireguardServiceRegistered, + "isWireguardServiceInstalled", + base::BindRepeating(&BraveVpnHandler::HandleIsWireguardServiceInstalled, base::Unretained(this))); web_ui()->RegisterMessageCallback( "isBraveVpnConnected", @@ -73,31 +55,20 @@ void BraveVpnHandler::OnProtocolChanged() { brave_vpn::SetWireguardActive(enabled); } -void BraveVpnHandler::HandleRegisterWireguardService( - const base::Value::List& args) { - base::ThreadPool::PostTaskAndReplyWithResult( - FROM_HERE, - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, - base::BindOnce(&ElevatedRegisterBraveVPNService), - base::BindOnce(&BraveVpnHandler::OnWireguardServiceRegistered, - weak_factory_.GetWeakPtr(), args[0].GetString())); -} - -void BraveVpnHandler::OnWireguardServiceRegistered( +void BraveVpnHandler::OnWireguardServiceInstalled( const std::string& callback_id, bool success) { AllowJavascript(); ResolveJavascriptCallback(callback_id, base::Value(success)); } -void BraveVpnHandler::HandleIsWireguardServiceRegistered( +void BraveVpnHandler::HandleIsWireguardServiceInstalled( const base::Value::List& args) { AllowJavascript(); ResolveJavascriptCallback( args[0], - base::Value(brave_vpn::wireguard::IsWireguardServiceRegistered())); + base::Value(brave_vpn::wireguard::IsWireguardServiceInstalled())); } void BraveVpnHandler::HandleIsBraveVpnConnected(const base::Value::List& args) { diff --git a/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.h b/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.h index 67e010446bfb..ecf5c6422d51 100644 --- a/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.h +++ b/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.h @@ -25,10 +25,9 @@ class BraveVpnHandler : public settings::SettingsPageUIHandler, // WebUIMessageHandler implementation. void RegisterMessages() override; - void HandleRegisterWireguardService(const base::Value::List& args); - void HandleIsWireguardServiceRegistered(const base::Value::List& args); - void OnWireguardServiceRegistered(const std::string& callback_id, - bool success); + void HandleIsWireguardServiceInstalled(const base::Value::List& args); + void OnWireguardServiceInstalled(const std::string& callback_id, + bool success); void HandleIsBraveVpnConnected(const base::Value::List& args); // brave_vpn::BraveVPNServiceObserver diff --git a/build/commands/lib/util.js b/build/commands/lib/util.js index 05594e976977..10f29db89c86 100644 --- a/build/commands/lib/util.js +++ b/build/commands/lib/util.js @@ -549,11 +549,30 @@ const util = { // So, this copying in every build doesn't affect compile performance. updateMidlFiles: () => { Log.progressScope('update midl files', () => { - for (const source of ["google_update", "brave"]) { - fs.copySync( - path.join(config.braveCoreDir, 'win_build_output', 'midl', source), - path.join(config.srcDir, - 'third_party', 'win_build_output', 'midl', source)) + const files = fs.readdirSync(path.join( + config.braveCoreDir, + 'win_build_output', 'midl')) + for (const file of files) { + const srcFile = path.join(config.braveCoreDir, + 'win_build_output', + 'midl', file) + const dstFile = path.join(config.srcDir, + 'third_party', + 'win_build_output', 'midl', file) + try { + const stat = fs.lstatSync(srcFile); + // only copy the directories here + // they each have a structure with x86/x64/arm64 versions of the files + if (stat.isDirectory()) { + fs.copySync(srcFile, dstFile) + } + } catch (e) { + throw new Error('error copying file \"' + + srcFile + "\" to \"" + + dstFile + "\"", { + cause: e + }) + } } }) }, diff --git a/build/commands/scripts/updatePatches.js b/build/commands/scripts/updatePatches.js index 8898a1204676..abbdd22c4d0f 100644 --- a/build/commands/scripts/updatePatches.js +++ b/build/commands/scripts/updatePatches.js @@ -1,3 +1,8 @@ +// Copyright (c) 2019 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at https://mozilla.org/MPL/2.0/. + const path = require('path') const config = require('../lib/config') const updatePatches = require('../lib/updatePatches') @@ -6,12 +11,13 @@ const chromiumPathFilter = (s) => s.length > 0 && !s.startsWith('chrome/app/theme/default') && !s.startsWith('chrome/app/theme/brave') && !s.startsWith('chrome/app/theme/chromium') && + !s.startsWith('third_party/win_build_output/midl/chrome/elevation_service') && + !s.startsWith('third_party/win_build_output/midl/google_update') && !s.endsWith('.png') && !s.endsWith('.xtb') && !s.endsWith('.grd') && !s.endsWith('.grdp') && !s.endsWith('.svg') && !s.endsWith('new_tab_page_view.xml') && !s.endsWith('channel_constants.xml') && - !s.includes('google_update_idl') && s !== 'chrome/VERSION' && s !== 'ui/webui/resources/css/text_defaults_md.css' diff --git a/build/config/brave_build.gni b/build/config/brave_build.gni index 0d2e07fd90eb..47afa5012473 100644 --- a/build/config/brave_build.gni +++ b/build/config/brave_build.gni @@ -22,6 +22,7 @@ import("//brave/components/search_engines/sources.gni") import("//brave/components/sync/service/sources.gni") import("//brave/components/sync_device_info/sources.gni") import("//brave/components/update_client/sources.gni") +import("//brave/elevation_service/sources.gni") import("//brave/installer/linux/sources.gni") import("//brave/net/dns/sources.gni") import("//brave/net/sources.gni") diff --git a/chromium_src/check_chromium_src_config.json5 b/chromium_src/check_chromium_src_config.json5 index 378b308ae77f..c00508fcddf0 100644 --- a/chromium_src/check_chromium_src_config.json5 +++ b/chromium_src/check_chromium_src_config.json5 @@ -33,6 +33,7 @@ "chrome/common/chrome_constants_unittest_mac.cc", "chrome/installer/mini_installer/brave_mini_installer_unittest.cc", "chrome/installer/setup/brave_behaviors.cc", + "chrome/installer/setup/test/install_worker_vpn_unittest.cc", "chrome/install_static/brave_install_details_unittest.cc", "chrome/install_static/brave_install_modes_unittest.cc", "chrome/install_static/brave_install_util_unittest.cc", diff --git a/chromium_src/chrome/elevation_service/DEPS b/chromium_src/chrome/elevation_service/DEPS new file mode 100644 index 000000000000..34c4b3361625 --- /dev/null +++ b/chromium_src/chrome/elevation_service/DEPS @@ -0,0 +1,9 @@ +include_rules = [ + "+brave/browser/brave_vpn/win/brave_vpn_wireguard_service", + "+brave/components/brave_vpn/browser/connection/ikev2/win", + "+brave/components/brave_vpn/common/buildflags", + "+brave/components/brave_vpn/common/wireguard/win", + "+brave/elevation_service", + "+brave/installer/setup/brave_vpn", + "+chrome/installer/util", +] diff --git a/chromium_src/chrome/elevation_service/elevation_service_idl.idl b/chromium_src/chrome/elevation_service/elevation_service_idl.idl new file mode 100644 index 000000000000..4abbc0c0e9ae --- /dev/null +++ b/chromium_src/chrome/elevation_service/elevation_service_idl.idl @@ -0,0 +1,180 @@ +// Copyright 2018 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import "oaidl.idl"; +import "ocidl.idl"; + +typedef enum ProtectionLevel { + // No validation: This never validates anything. + NONE = 0, + // Path validation: This will validate that the data is being decrypted by an + // executable whose NT path matches the executable that originally encrypted + // it. This should only be used for executables in trusted paths e.g. + // C:\Program Files, otherwise anyone could pretend to be your executable. + PATH_VALIDATION = 1, +} ProtectionLevel; + +[ + object, + oleautomation, + uuid(5A9A9462-2FA1-4FEB-B7F2-DF3D19134463), + helpstring("IElevator Interface"), + pointer_default(unique) +] +interface IElevator : IUnknown +{ + // Elevators are exposed as methods on IElevator, and provide High Integrity + // actions. Any changes to add or change a method in IElevator will require a + // security review. + // + // Runs the Chrome Recovery CRX elevated. + // + // @param crx_path Path for the recovery CRX. + // @param browser_appid Omaha AppID for the version of Chrome being recovered. + // @param browser_version Version of Chrome for the recovery CRX. + // @param session_id Omaha Session Id. + // @param caller_proc_id The process id of the calling process. + // @param proc_handle The process handle valid in the calling process context. + HRESULT RunRecoveryCRXElevated([in, string] const WCHAR* crx_path, + [in, string] const WCHAR* browser_appid, + [in, string] const WCHAR* browser_version, + [in, string] const WCHAR* session_id, + [in] DWORD caller_proc_id, + [out] ULONG_PTR* proc_handle); + + // Encrypts data with both caller and SYSTEM context DPAPI. + // + // @param protection_level the protection level to encrypt data at. + // @param plaintext The plaintext data to encrypt. + // @param ciphertext The ciphertext of the encrypted data. It is the + // responsibility of the caller to free this memory using + // SysFreeString. + // @param last_error The result of calling GetLastError if the operation + // failed. + // @return S_OK on success. Any other value on failure. + HRESULT EncryptData([in] ProtectionLevel protection_level, + [in] const BSTR plaintext, + [out] BSTR* ciphertext, + [out] DWORD* last_error); + + // Decrypts data with both caller and SYSTEM context DPAPI. + // + // This will only decrypt data that was encrypted via a paired EncryptData + // call from same application, with identity determined by the protection + // level of the original encrypt call. + // + // @param ciphertext The ciphertext data to decrypt. + // @param plaintext The plaintext of the decrypted data. It is the + // responsibility of the caller to free this memory using + // SysFreeString. + // @param last_error The result of calling GetLastError if the operation + // failed. + // @return S_OK on success. Any other value on failure. + HRESULT DecryptData([in] const BSTR ciphertext, + [out] BSTR* plaintext, + [out] DWORD* last_error); + + + + // Install the services used for Brave VPN + // + // These will only get installed when a customer purchases the product + // from account.brave.com and they have credentials. + // + // There are two services provided: + // - DNS protection: forcing routing through VPN adapter to bypass Smart + // Multi-homed Name Resolution (which can leak the DNS query). + // - WireGuard support: more robust VPN support than the built-in to Windows + // VPN. The built in one with IKEv2 is secure but things like + // reconnect after waking up don't work well with the system VPN. + // @return S_OK on success. + HRESULT InstallVPNServices(); +}; + +// The interfaces below are all IElevator with unique IIDs. IElevator is +// registered with unique IIDs for the various flavors of Chrome and Chromium. +// This allows the different flavors of Chrome/Chromium to co-exist without side +// effects. +[ + object, + oleautomation, + uuid(3218DA17-49C2-479A-8290-311DBFB86490), + helpstring("IElevatorChromium Interface"), + pointer_default(unique) +] +interface IElevatorChromium : IElevator +{ +}; + +[ + object, + oleautomation, + uuid(F396861E-0C8E-4C71-8256-2FAE6D759CE9), + helpstring("IElevatorChrome Interface"), + pointer_default(unique) +] +interface IElevatorChrome : IElevator +{ +}; + +[ + object, + oleautomation, + uuid(9EBAD7AC-6E1E-4A1C-AA85-1A70CADA8D82), + helpstring("IElevatorChromeBeta Interface"), + pointer_default(unique) +] +interface IElevatorChromeBeta : IElevator +{ +}; + +[ + object, + oleautomation, + uuid(1E43C77B-48E6-4A4C-9DB2-C2971706C255), + helpstring("IElevatorChromeDev Interface"), + pointer_default(unique) +] +interface IElevatorChromeDev : IElevator +{ +}; + +[ + object, + oleautomation, + uuid(1DB2116F-71B7-49F0-8970-33B1DACFB072), + helpstring("IElevatorChromeCanary Interface"), + pointer_default(unique) +] +interface IElevatorChromeCanary : IElevator +{ +}; + +[ + object, + oleautomation, + uuid(17239BF1-A1DC-4642-846C-1BAC85F96A10), + helpstring("IElevatorDevelopment Interface"), + pointer_default(unique) +] +interface IElevatorDevelopment : IElevator +{ +}; + +[ + uuid(C3B01C4D-FBD4-4E65-88AD-0972D75808C2), + version(1.0), + helpstring("Elevator 1.0 Type Library") +] +library ElevatorLib { + importlib("stdole2.tlb"); + + interface IElevator; + interface IElevatorChromium; + interface IElevatorChrome; + interface IElevatorChromeBeta; + interface IElevatorChromeDev; + interface IElevatorChromeCanary; + interface IElevatorDevelopment; +}; diff --git a/chromium_src/chrome/elevation_service/elevator.cc b/chromium_src/chrome/elevation_service/elevator.cc new file mode 100644 index 000000000000..3acafcab3683 --- /dev/null +++ b/chromium_src/chrome/elevation_service/elevator.cc @@ -0,0 +1,45 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "chrome/elevation_service/elevator.h" + +#include +#include + +#include + +#include "base/win/windows_types.h" +#include "brave/components/brave_vpn/common/buildflags/buildflags.h" + +#if BUILDFLAG(ENABLE_BRAVE_VPN) +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" +#endif + +#include "src/chrome/elevation_service/elevator.cc" + +namespace elevation_service { + +HRESULT Elevator::InstallVPNServices() { +#if BUILDFLAG(ENABLE_BRAVE_VPN) + if (!brave_vpn::IsBraveVPNHelperServiceInstalled()) { + auto success = brave_vpn::InstallBraveVPNHelperService(); + if (!success) { + return E_FAIL; + } + } + + if (!brave_vpn::wireguard::IsWireguardServiceInstalled()) { + auto success = brave_vpn::InstallBraveWireguardService(); + if (!success) { + return E_FAIL; + } + } +#endif + return S_OK; +} + +} // namespace elevation_service diff --git a/chromium_src/chrome/elevation_service/elevator.h b/chromium_src/chrome/elevation_service/elevator.h new file mode 100644 index 000000000000..329886a50b32 --- /dev/null +++ b/chromium_src/chrome/elevation_service/elevator.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_ELEVATION_SERVICE_ELEVATOR_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_ELEVATION_SERVICE_ELEVATOR_H_ + +#include "chrome/elevation_service/elevation_service_idl.h" + +#define IElevatorChromeDev IElevatorChromeDev, IElevatorDevelopment +#define DecryptData \ + InstallVPNServices() override; \ + IFACEMETHODIMP DecryptData + +#include "src/chrome/elevation_service/elevator.h" // IWYU pragma: export + +#undef DecryptData +#undef IElevatorChromeDev + +#endif // BRAVE_CHROMIUM_SRC_CHROME_ELEVATION_SERVICE_ELEVATOR_H_ diff --git a/chromium_src/chrome/install_static/chromium_install_modes.cc b/chromium_src/chrome/install_static/chromium_install_modes.cc index e0de07bf0664..f148bf0ec51a 100644 --- a/chromium_src/chrome/install_static/chromium_install_modes.cc +++ b/chromium_src/chrome/install_static/chromium_install_modes.cc @@ -62,10 +62,10 @@ const InstallConstants kInstallModes[] = { 0x4b6b, {0x85, 0x60, 0xe4, 0xb2, 0x3, 0xa9, 0x7a, 0x8b}}, // Elevator CLSID. - .elevator_iid = {0xb7965c30, - 0x7d58, - 0x4d86, - {0x9e, 0x18, 0x47, 0x94, 0x25, 0x64, 0x9, 0xee}}, + .elevator_iid = {0xf396861e, + 0x0c8e, + 0x4c71, + {0x82, 0x56, 0x2f, 0xae, 0x6d, 0x75, 0x9c, 0xe9}}, .default_channel_name = L"", // The empty string means "stable". .channel_strategy = ChannelStrategy::FLOATING, .supports_system_level = true, // Supports system-level installs. @@ -108,10 +108,10 @@ const InstallConstants kInstallModes[] = { 0x4347, {0xbe, 0xc0, 0xd7, 0x22, 0xca, 0x41, 0x2c, 0x75}}, // Elevator CLSID. - .elevator_iid = {0xd9d7b102, - 0xfc8a, - 0x4843, - {0xac, 0x35, 0x1e, 0xbc, 0xc7, 0xed, 0x12, 0x3d}}, + .elevator_iid = {0x9ebad7ac, + 0x6e1e, + 0x4a1c, + {0xaa, 0x85, 0x1a, 0x70, 0xca, 0xda, 0x8d, 0x82}}, .default_channel_name = L"beta", // Forced channel name. .channel_strategy = ChannelStrategy::FIXED, .supports_system_level = true, // Supports system-level installs. @@ -154,10 +154,10 @@ const InstallConstants kInstallModes[] = { 0x43b7, {0xb7, 0x18, 0x8f, 0x82, 0x61, 0x45, 0x97, 0xa3}}, // Elevator CLSID. - .elevator_iid = {0x9cf6868c, - 0x8c9f, - 0x4220, - {0x95, 0xbe, 0x13, 0x99, 0x9d, 0xd9, 0x9b, 0x48}}, + .elevator_iid = {0x1e43c77b, + 0x48e6, + 0x4a4c, + {0x9d, 0xb2, 0xc2, 0x97, 0x17, 0x06, 0xc2, 0x55}}, .default_channel_name = L"dev", // Forced channel name. .channel_strategy = ChannelStrategy::FIXED, .supports_system_level = true, // Supports system-level installs. @@ -203,10 +203,10 @@ const InstallConstants kInstallModes[] = { 0x4389, {0x87, 0xdb, 0xd0, 0x99, 0x48, 0x30, 0xbb, 0x17}}, // Elevator CLSID. - .elevator_iid = {0x648b3c2b, - 0xe53, - 0x4085, - {0xa9, 0x75, 0x11, 0x18, 0x1, 0x75, 0x8f, 0xe7}}, + .elevator_iid = {0x1db2116f, + 0x71b7, + 0x49f0, + {0x89, 0x70, 0x33, 0xb1, 0xda, 0xcf, 0xb0, 0x72}}, .default_channel_name = L"nightly", // Forced channel name. .channel_strategy = ChannelStrategy::FIXED, .supports_system_level = true, // Support system-level installs. @@ -256,10 +256,10 @@ const InstallConstants kInstallModes[] = { 0x4421, {0xaf, 0xe8, 0x58, 0xf3, 0xc9, 0x47, 0x43, 0x6a}}, // Elevator CLSID. - .elevator_iid = {0xedf6b466, - 0x4efc, - 0x4c88, - {0x83, 0x8c, 0x96, 0xb4, 0x39, 0x1c, 0x6a, 0xe}}, + .elevator_iid = {0x17239bf1, + 0xa1dc, + 0x4642, + {0x84, 0x6c, 0x1b, 0xac, 0x85, 0xf9, 0x6a, 0x10}}, .default_channel_name = L"", // Empty default channel name since no update integration. .channel_strategy = ChannelStrategy::UNSUPPORTED, diff --git a/chromium_src/chrome/installer/DEPS b/chromium_src/chrome/installer/DEPS index 27f2fb57e397..74e1d93cea49 100644 --- a/chromium_src/chrome/installer/DEPS +++ b/chromium_src/chrome/installer/DEPS @@ -1,7 +1,9 @@ include_rules = [ + "+brave/browser/brave_vpn/win/brave_vpn_wireguard_service", "+brave/components/brave_vpn/browser/connection/ikev2/win", - "+brave/components/brave_vpn/common/wireguard", + "+brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper", "+brave/components/brave_vpn/common/buildflags", + "+brave/components/brave_vpn/common/wireguard/win", "+brave/installer", "+chrome/common", "+chrome/install_static", diff --git a/chromium_src/chrome/installer/setup/install_worker.cc b/chromium_src/chrome/installer/setup/install_worker.cc index c0463916a144..bbcacbb4687e 100644 --- a/chromium_src/chrome/installer/setup/install_worker.cc +++ b/chromium_src/chrome/installer/setup/install_worker.cc @@ -5,6 +5,7 @@ #include +#include "base/check.h" #include "base/command_line.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -14,6 +15,7 @@ #include "base/process/launch.h" #include "base/process/process.h" #include "base/version.h" +#include "base/win/registry.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "build/buildflag.h" #include "chrome/install_static/install_util.h" @@ -34,87 +36,121 @@ #endif #if BUILDFLAG(ENABLE_BRAVE_VPN) +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" namespace { -// All BraveVpn services have support of "install" switch to make registration. -constexpr char kBraveVpnServiceInstall[] = "install"; - -base::FilePath GetBraveVPNHelperPath(const base::FilePath& target_path, - const base::Version& version) { - return target_path.AppendASCII(version.GetString()) - .Append(brave_vpn::kBraveVPNHelperExecutable); +// delete `BraveVpnWireguardService` from services and remove the tray icon. +bool UninstallBraveVPNWireguardService(const CallbackWorkItem&) { + return brave_vpn::UninstallBraveWireguardService() && + brave_vpn::UninstallStatusTrayIcon(); } -bool InstallBraveVPNService(const base::FilePath& exe_path, - const CallbackWorkItem&) { - if (!base::PathExists(exe_path)) { - return false; +// Brave 1.50.114+ would register `BraveVpnService` for system level installs. +// +// This change removes the service if it exists. We'll be updating the browser +// to install the services post-purchase (if possible) when the user has +// purchased Brave VPN and has credentials or when VPN is used. +// +// See https://github.com/brave/brave-browser/issues/33726 for more info +void AddUninstallVpnServiceWorkItems() { + DCHECK(::IsUserAnAdmin()); + // delete `BraveVpnService` from services + if (!installer::InstallServiceWorkItem::DeleteService( + brave_vpn::GetBraveVpnHelperServiceName(), + brave_vpn::kBraveVpnHelperRegistryStoragePath, {}, {})) { + VLOG(1) << "Failed to delete " << brave_vpn::GetBraveVpnHelperServiceName(); } - base::CommandLine cmd(exe_path); - cmd.AppendSwitch(kBraveVpnServiceInstall); - base::LaunchOptions options = base::LaunchOptions(); - options.wait = true; - return base::LaunchProcess(cmd, base::LaunchOptions()).IsValid(); } -// Adds work items to register brave vpn helper service for Windows. Only for -// system level installs. -void AddBraveVPNHelperServiceWorkItems(const base::FilePath& vpn_service_path, - WorkItemList* list) { +// Brave 1.57.47+ would register `BraveVpnWireguardService` for system level +// installs. +// +// This change removes the service if it exists. We'll be updating the browser +// to install the services post-purchase (if possible) when the user has +// purchased Brave VPN and has credentials or when VPN is used. +// +// See https://github.com/brave/brave-browser/issues/33726 for more info +void AddUninstallWireguardServiceWorkItems(WorkItemList* list) { DCHECK(::IsUserAnAdmin()); + list->AddCallbackWorkItem(base::BindOnce(&UninstallBraveVPNWireguardService), + base::NullCallback()); +} - if (vpn_service_path.empty()) { - VLOG(1) << "The path to brave_vpn_helper.exe is invalid."; - return; +} // namespace + +namespace installer { + +// We can consider removing this code and the registry key sometime in the +// future once enough time has gone by and we're confident folks have ran this +// cleanup. This same service cleanup happens on uninstall. +// +// For more info see https://github.com/brave/brave-browser/issues/33726 +bool OneTimeVpnServiceCleanup(const base::FilePath& target_path, + const base::Version& new_version, + WorkItemList* install_list, + bool is_test) { + // Check registry for `ran` value. + // Only run the clean up logic if this hasn't ran yet. + base::win::RegKey key; + LONG rv = key.Create(HKEY_LOCAL_MACHINE, + brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, + KEY_ALL_ACCESS); + if (rv != ERROR_SUCCESS) { + VLOG(1) << "Failed to open registry key:" + << brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath << "\n" + << logging::SystemErrorCodeToString(rv); + return false; } - WorkItem* install_service_work_item = new installer::InstallServiceWorkItem( - brave_vpn::GetBraveVpnHelperServiceName(), - brave_vpn::GetBraveVpnHelperServiceDisplayName(), SERVICE_DEMAND_START, - base::CommandLine(vpn_service_path), - base::CommandLine(base::CommandLine::NO_PROGRAM), - brave_vpn::kBraveVpnHelperRegistryStoragePath, {}, {}); - install_service_work_item->set_best_effort(true); - list->AddWorkItem(install_service_work_item); - list->AddCallbackWorkItem( - base::BindOnce(&InstallBraveVPNService, vpn_service_path), - base::NullCallback()); -} -// Adds work items to register brave vpn wireguard service for Windows. Only for -// system level installs. -void AddBraveVPNWireguardServiceWorkItems( - const base::FilePath& wireguard_service_path, - WorkItemList* list) { - DCHECK(::IsUserAnAdmin()); - if (wireguard_service_path.empty()) { - VLOG(1) << "The path to brave_vpn_wireguard_service.exe is invalid."; - return; + if (!key.Valid()) { + VLOG(1) << "Registry key not valid:" + << brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath; + return false; } - list->AddCallbackWorkItem( - base::BindOnce(&InstallBraveVPNService, wireguard_service_path), - base::NullCallback()); + + DWORD cleanup_ran = 0; + if (key.ReadValueDW(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, + &cleanup_ran) == ERROR_SUCCESS) { + if (cleanup_ran == 1) { + VLOG(1) << "OneTimeVpnServiceCleanup has already ran; skipping"; + return false; + } + } + + // If is_test=true, the removal won't happen. Default is false. + // See chromium_src/chrome/installer/setup/install_worker_unittest.cc + if (!is_test) { + AddUninstallWireguardServiceWorkItems(install_list); + AddUninstallVpnServiceWorkItems(); + } + + // Write registry value + cleanup_ran = 1; + rv = key.WriteValue(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, + &cleanup_ran, REG_DWORD, sizeof(DWORD)); + if (rv != ERROR_SUCCESS) { + VLOG(1) << "Failed to write registry key value: " + << brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath << ":" + << brave_vpn::kBraveVpnOneTimeServiceCleanupValue << "\n" + << logging::SystemErrorCodeToString(rv); + } + return true; } -} // namespace +} // namespace installer -#define GetElevationServicePath GetElevationServicePath( \ - target_path, new_version), install_list); \ - AddBraveVPNWireguardServiceWorkItems( \ - brave_vpn::GetBraveVPNWireguardServiceInstallationPath(target_path, \ - new_version), \ - install_list); \ - AddBraveVPNHelperServiceWorkItems(GetBraveVPNHelperPath +#define AddUpdateDowngradeVersionItem \ + OneTimeVpnServiceCleanup(target_path, new_version, install_list); \ + AddUpdateDowngradeVersionItem #endif // BUILDFLAG(ENABLE_BRAVE_VPN) #include "src/chrome/installer/setup/install_worker.cc" #if BUILDFLAG(ENABLE_BRAVE_VPN) -#undef GetElevationServicePath +#undef AddUpdateDowngradeVersionItem #endif // BUILDFLAG(ENABLE_BRAVE_VPN) #if defined(OFFICIAL_BUILD) #include "chrome/install_static/brave_restore_google_update_integration.h" diff --git a/chromium_src/chrome/installer/setup/install_worker.h b/chromium_src/chrome/installer/setup/install_worker.h new file mode 100644 index 000000000000..3acb0bf6673f --- /dev/null +++ b/chromium_src/chrome/installer/setup/install_worker.h @@ -0,0 +1,22 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_ + +#include "src/chrome/installer/setup/install_worker.h" // IWYU pragma: export + +namespace installer { + +// Method specifically used to do a one-time removal of VPN services from +// a person's machine. The service will then only be installed if they have +// purchased the Brave VPN product. +bool OneTimeVpnServiceCleanup(const base::FilePath& target_path, + const base::Version& new_version, + WorkItemList* install_list, + bool is_test = false); +} // namespace installer + +#endif // BRAVE_CHROMIUM_SRC_CHROME_INSTALLER_SETUP_INSTALL_WORKER_H_ diff --git a/chromium_src/chrome/installer/setup/sources.gni b/chromium_src/chrome/installer/setup/sources.gni index a8f33fd7d391..d8918673b4c1 100644 --- a/chromium_src/chrome/installer/setup/sources.gni +++ b/chromium_src/chrome/installer/setup/sources.gni @@ -15,6 +15,7 @@ if (is_win) { ] if (enable_brave_vpn) { brave_chromium_src_chrome_installer_setup_deps += [ + "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:install_utils", "//brave/components/brave_vpn/browser/connection/ikev2/win:ras_utils", "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", "//brave/components/brave_vpn/common/wireguard/win", diff --git a/chromium_src/chrome/installer/setup/test/BUILD.gn b/chromium_src/chrome/installer/setup/test/BUILD.gn new file mode 100644 index 000000000000..a16d18e4605a --- /dev/null +++ b/chromium_src/chrome/installer/setup/test/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at https://mozilla.org/MPL/2.0/. + +import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") + +if (enable_brave_vpn && is_win) { + source_set("vpn_unit_tests") { + testonly = true + sources = [ "install_worker_vpn_unittest.cc" ] + + deps = [ + "//base", + "//base/test:test_support", + "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", + "//brave/components/brave_vpn/common/buildflags:buildflags", + "//chrome/chrome_elf:nt_registry", + "//chrome/installer/setup:lib", + "//chrome/installer/util:with_no_strings", + "//testing/gmock", + "//testing/gtest", + ] + } +} diff --git a/chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc b/chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc new file mode 100644 index 000000000000..c3ef6377ddf7 --- /dev/null +++ b/chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc @@ -0,0 +1,173 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "chrome/installer/setup/install_worker.h" + +#include + +#include "base/test/test_reg_util_win.h" +#include "base/version.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/components/brave_vpn/common/buildflags/buildflags.h" +#include "chrome/chrome_elf/nt_registry/nt_registry.h" +#include "chrome/installer/util/set_reg_value_work_item.h" +#include "chrome/installer/util/work_item_list.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using ::testing::NiceMock; + +namespace installer { + +class BraveSetupInstallWorkerTest : public testing::Test { + public: + BraveSetupInstallWorkerTest() + : example_version_(base::Version("1.0.0.0")), + example_path_(FILE_PATH_LITERAL("elevation_service.exe")) {} + + protected: + base::Version example_version_; + base::FilePath example_path_; +}; + +// TODO(bsclifton): move this to a shared file. This was copied from: +// chromium_src/chrome/install_static/brave_user_data_dir_win_unittest.cc +class ScopedNTRegistryTestingOverride { + public: + ScopedNTRegistryTestingOverride(nt::ROOT_KEY root, const std::wstring& path) + : root_(root) { + EXPECT_TRUE(nt::SetTestingOverride(root_, path)); + } + ~ScopedNTRegistryTestingOverride() { + nt::SetTestingOverride(root_, std::wstring()); + } + + private: + nt::ROOT_KEY root_; +}; + +// based on chrome/installer/setup/install_worker_unittest.cc +class MockWorkItemList : public WorkItemList { + public: + MockWorkItemList() {} + + MOCK_METHOD5(AddCopyTreeWorkItem, + WorkItem*(const base::FilePath&, + const base::FilePath&, + const base::FilePath&, + CopyOverWriteOption, + const base::FilePath&)); + MOCK_METHOD1(AddCreateDirWorkItem, WorkItem*(const base::FilePath&)); + MOCK_METHOD3(AddCreateRegKeyWorkItem, + WorkItem*(HKEY, const std::wstring&, REGSAM)); + MOCK_METHOD3(AddDeleteRegKeyWorkItem, + WorkItem*(HKEY, const std::wstring&, REGSAM)); + MOCK_METHOD4( + AddDeleteRegValueWorkItem, + WorkItem*(HKEY, const std::wstring&, REGSAM, const std::wstring&)); + MOCK_METHOD2(AddDeleteTreeWorkItem, + WorkItem*(const base::FilePath&, const base::FilePath&)); + MOCK_METHOD4(AddMoveTreeWorkItem, + WorkItem*(const base::FilePath&, + const base::FilePath&, + const base::FilePath&, + MoveTreeOption)); + // Workaround for gmock problems with disambiguating between string pointers + // and DWORD. + WorkItem* AddSetRegValueWorkItem(HKEY a1, + const std::wstring& a2, + REGSAM a3, + const std::wstring& a4, + const std::wstring& a5, + bool a6) override { + return AddSetRegStringValueWorkItem(a1, a2, a3, a4, a5, a6); + } + + MOCK_METHOD6(AddSetRegStringValueWorkItem, + WorkItem*(HKEY, + const std::wstring&, + REGSAM, + const std::wstring&, + const std::wstring&, + bool)); + MOCK_METHOD6(AddSetRegDwordValueWorkItem, + WorkItem*(HKEY, + const std::wstring&, + REGSAM, + const std::wstring&, + DWORD, + bool)); +}; + +// Test for when registry key exists and value is already `1`. +TEST_F(BraveSetupInstallWorkerTest, CleanupAlreadyRan) { + registry_util::RegistryOverrideManager override_manager; + std::wstring temp; + ASSERT_NO_FATAL_FAILURE( + override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE, &temp)); + ScopedNTRegistryTestingOverride nt_override(nt::HKLM, temp); + + // Write out a value `1` (simulating already ran) + base::win::RegKey key(HKEY_LOCAL_MACHINE, + brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, + KEY_ALL_ACCESS); + DWORD cleanup_ran = 1; + key.WriteValue(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, cleanup_ran); + + NiceMock work_item_list; + EXPECT_FALSE(installer::OneTimeVpnServiceCleanup( + example_path_, example_version_, &work_item_list, true)); +} + +// Test for when no registry key exists yet. +TEST_F(BraveSetupInstallWorkerTest, CleanupNotRanYetNoKey) { + registry_util::RegistryOverrideManager override_manager; + std::wstring temp; + ASSERT_NO_FATAL_FAILURE( + override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE, &temp)); + ScopedNTRegistryTestingOverride nt_override(nt::HKLM, temp); + + NiceMock work_item_list; + EXPECT_TRUE(installer::OneTimeVpnServiceCleanup( + example_path_, example_version_, &work_item_list, true)); + + // Ensure it set `ran` to `1` + base::win::RegKey key(HKEY_LOCAL_MACHINE, + brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, + KEY_ALL_ACCESS); + DWORD cleanup_ran = 0; + LONG rv = key.ReadValueDW(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, + &cleanup_ran); + ASSERT_EQ(rv, ERROR_SUCCESS); + EXPECT_EQ(cleanup_ran, 1U); +} + +// Test for when registry key exists and there is a value, but it's not `1`. +TEST_F(BraveSetupInstallWorkerTest, CleanupNotRanKeyExists) { + registry_util::RegistryOverrideManager override_manager; + std::wstring temp; + ASSERT_NO_FATAL_FAILURE( + override_manager.OverrideRegistry(HKEY_LOCAL_MACHINE, &temp)); + ScopedNTRegistryTestingOverride nt_override(nt::HKLM, temp); + + // Write out a value `0` (ex: not `1`) + base::win::RegKey key(HKEY_LOCAL_MACHINE, + brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, + KEY_ALL_ACCESS); + DWORD cleanup_ran = 0; + key.WriteValue(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, cleanup_ran); + + NiceMock work_item_list; + EXPECT_TRUE(installer::OneTimeVpnServiceCleanup( + example_path_, example_version_, &work_item_list, true)); + + // Ensure it set `ran` to `1` + LONG rv = key.ReadValueDW(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, + &cleanup_ran); + ASSERT_EQ(rv, ERROR_SUCCESS); + EXPECT_EQ(cleanup_ran, 1U); +} + +} // namespace installer diff --git a/chromium_src/chrome/installer/setup/uninstall.cc b/chromium_src/chrome/installer/setup/uninstall.cc index a57da18aae36..bfac0213fec0 100644 --- a/chromium_src/chrome/installer/setup/uninstall.cc +++ b/chromium_src/chrome/installer/setup/uninstall.cc @@ -3,17 +3,24 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/logging.h" #include "base/process/launch.h" #include "base/process/process.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/installer/util/brave_shell_util.h" +#include "chrome/installer/setup/modify_params.h" +#include "chrome/installer/util/registry_util.h" +#include "chrome/installer/util/shell_util.h" +#include "chrome/installer/util/util_constants.h" +#include "chrome/installer/util/work_item.h" #if BUILDFLAG(ENABLE_BRAVE_VPN) +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/ras_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" #include "brave/components/brave_vpn/common/wireguard/win/service_details.h" #endif #define UninstallProduct UninstallProduct_ChromiumImpl @@ -26,17 +33,6 @@ namespace installer { namespace { -bool UninstallBraveVPNWireguardService(const base::FilePath& exe_path) { - if (!base::PathExists(exe_path)) { - return false; - } - base::CommandLine cmd(exe_path); - cmd.AppendSwitch(brave_vpn::kBraveVpnWireguardServiceUnnstallSwitchName); - base::LaunchOptions options = base::LaunchOptions(); - options.wait = true; - return base::LaunchProcess(cmd, options).IsValid(); -} - void DeleteBraveFileKeys(HKEY root) { // Delete Software\Classes\BraveXXXFile. std::wstring reg_prog_id(ShellUtil::kRegClasses); @@ -91,6 +87,7 @@ InstallStatus UninstallProduct(const ModifyParams& modify_params, } #if BUILDFLAG(ENABLE_BRAVE_VPN) if (installer_state->system_install()) { + // TODO(bsclifton): move this to a method if (!InstallServiceWorkItem::DeleteService( brave_vpn::GetBraveVpnHelperServiceName(), brave_vpn::kBraveVpnHelperRegistryStoragePath, {}, {})) { @@ -98,10 +95,8 @@ InstallStatus UninstallProduct(const ModifyParams& modify_params, << brave_vpn::GetBraveVpnHelperServiceName(); } - if (!UninstallBraveVPNWireguardService( - brave_vpn::GetBraveVPNWireguardServiceInstallationPath( - installer_state->target_path(), - *modify_params.current_version))) { + if (!brave_vpn::UninstallBraveWireguardService() || + !brave_vpn::UninstallStatusTrayIcon()) { LOG(WARNING) << "Failed to delete " << brave_vpn::GetBraveVpnWireguardServiceName(); } diff --git a/components/brave_vpn/browser/brave_vpn_service.cc b/components/brave_vpn/browser/brave_vpn_service.cc index d4286832f400..d1874bf2b163 100644 --- a/components/brave_vpn/browser/brave_vpn_service.cc +++ b/components/brave_vpn/browser/brave_vpn_service.cc @@ -774,8 +774,12 @@ void BraveVpnService::SetPurchasedState( obs->OnPurchasedStateChanged(state, description); #if !BUILDFLAG(IS_ANDROID) - if (state == PurchasedState::PURCHASED) + if (state == PurchasedState::PURCHASED) { connection_api_->CheckConnection(); + + // Some platform needs to install services to run vpn. + connection_api_->MaybeInstallSystemServices(); + } #endif } diff --git a/components/brave_vpn/browser/connection/BUILD.gn b/components/brave_vpn/browser/connection/BUILD.gn index 236584f91f8e..26264ff19384 100644 --- a/components/brave_vpn/browser/connection/BUILD.gn +++ b/components/brave_vpn/browser/connection/BUILD.gn @@ -21,6 +21,7 @@ source_set("api") { "//brave/components/brave_vpn/common/buildflags", "//brave/components/brave_vpn/common/mojom", "//components/prefs", + "//net", "//services/network/public/cpp", ] } diff --git a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc index 2dc1555f0b1a..8300a9c22085 100644 --- a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc +++ b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc @@ -8,15 +8,18 @@ #include #include +#include "base/check.h" #include "base/check_is_test.h" -#include "base/feature_list.h" +#include "base/functional/bind.h" +#include "base/functional/callback.h" #include "base/json/json_reader.h" +#include "base/logging.h" #include "base/memory/scoped_refptr.h" +#include "base/task/thread_pool.h" #include "brave/components/brave_vpn/browser/api/brave_vpn_api_helper.h" #include "brave/components/brave_vpn/common/brave_vpn_data_types.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" -#include "brave/components/brave_vpn/common/features.h" #include "brave/components/brave_vpn/common/pref_names.h" #include "build/build_config.h" #include "components/prefs/pref_service.h" @@ -27,21 +30,24 @@ namespace brave_vpn { std::unique_ptr CreateBraveVPNIKEv2ConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel); + version_info::Channel channel, + base::RepeatingCallback service_installer); std::unique_ptr CreateBraveVPNWireguardConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel); + version_info::Channel channel, + base::RepeatingCallback service_installer); std::unique_ptr CreateBraveVPNConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel) { + version_info::Channel channel, + base::RepeatingCallback service_installer) { #if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) if (IsBraveVPNWireguardEnabled(local_prefs)) { return CreateBraveVPNWireguardConnectionAPI(url_loader_factory, local_prefs, - channel); + channel, service_installer); } #endif #if BUILDFLAG(IS_ANDROID) @@ -49,7 +55,7 @@ std::unique_ptr CreateBraveVPNConnectionAPI( return nullptr; #else return CreateBraveVPNIKEv2ConnectionAPI(url_loader_factory, local_prefs, - channel); + channel, service_installer); #endif } @@ -58,7 +64,8 @@ BraveVPNOSConnectionAPI::BraveVPNOSConnectionAPI( PrefService* local_prefs) : local_prefs_(local_prefs), url_loader_factory_(url_loader_factory), - region_data_manager_(url_loader_factory, local_prefs) { + region_data_manager_(url_loader_factory, local_prefs), + weak_factory_(this) { DCHECK(url_loader_factory_); // Safe to use Unretained here because |region_data_manager_| is owned // instance. @@ -265,4 +272,57 @@ void BraveVPNOSConnectionAPI::ToggleConnection() { can_disconnect ? Disconnect() : Connect(); } +void BraveVPNOSConnectionAPI::MaybeInstallSystemServices() { + if (!install_system_service_callback_) { + VLOG(2) << __func__ << " : no install system service callback set"; + return; + } + + // Installation should only be called once per session. + // It's safe to call more than once because the install itself checks if + // the services are already registered before doing anything. + if (system_service_installed_event_.is_signaled()) { + VLOG(2) + << __func__ + << " : installation has already been performed this session; exiting"; + return; + } + + // This API could be called more than once because BraveVpnService is a + // per-profile service. If service install is in-progress now, just return. + if (install_in_progress_) { + VLOG(2) << __func__ << " : install already in progress; exiting"; + return; + } + +#if BUILDFLAG(IS_WIN) + install_in_progress_ = true; + base::ThreadPool::CreateCOMSTATaskRunner({base::MayBlock()}) + ->PostTaskAndReplyWithResult( + FROM_HERE, install_system_service_callback_, + base::BindOnce( + &BraveVPNOSConnectionAPI::OnInstallSystemServicesCompleted, + weak_factory_.GetWeakPtr())); +#endif +} + +void BraveVPNOSConnectionAPI::OnInstallSystemServicesCompleted(bool success) { + VLOG(1) << "OnInstallSystemServicesCompleted: success=" << success; + if (success) { + system_service_installed_event_.Signal(); + } + install_in_progress_ = false; +} + +bool BraveVPNOSConnectionAPI::ScheduleConnectRequestIfNeeded() { + if (!install_in_progress_) { + return false; + } + + system_service_installed_event_.Post( + FROM_HERE, base::BindOnce(&BraveVPNOSConnectionAPI::Connect, + weak_factory_.GetWeakPtr())); + return true; +} + } // namespace brave_vpn diff --git a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h index 733eb7cb3094..7c5226f479d1 100644 --- a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h +++ b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h @@ -10,8 +10,11 @@ #include #include "base/memory/raw_ptr.h" +#include "base/memory/scoped_refptr.h" +#include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/observer_list_types.h" +#include "base/one_shot_event.h" #include "brave/components/brave_vpn/browser/api/brave_vpn_api_request.h" #include "brave/components/brave_vpn/browser/connection/brave_vpn_region_data_manager.h" #include "brave/components/brave_vpn/common/mojom/brave_vpn.mojom.h" @@ -70,6 +73,7 @@ class BraveVPNOSConnectionAPI mojom::ConnectionState state); virtual void SetSelectedRegion(const std::string& name) = 0; virtual void FetchProfileCredentials() = 0; + virtual void MaybeInstallSystemServices(); protected: explicit BraveVPNOSConnectionAPI( @@ -96,6 +100,17 @@ class BraveVPNOSConnectionAPI // net::NetworkChangeNotifier::NetworkChangeObserver void OnNetworkChanged( net::NetworkChangeNotifier::ConnectionType type) override; + void OnInstallSystemServicesCompleted(bool success); + + // For now, this is called when Connect() is called. + // If system service installation is in-progress, connect request + // is queued and return true. + // Then, start connect after installation is done. + bool ScheduleConnectRequestIfNeeded(); + + // Installs system services (if neeeded) or is nullptr. + // Bound in brave_vpn::CreateBraveVPNConnectionAPI. + base::RepeatingCallback install_system_service_callback_; private: friend class BraveVpnButtonUnitTest; @@ -133,6 +148,16 @@ class BraveVPNOSConnectionAPI mojom::ConnectionState::DISCONNECTED; BraveVPNRegionDataManager region_data_manager_; base::ObserverList observers_; + // Used for tracking if the VPN dependencies are being installed. + // Guard against calling install_system_service_callback_ while a call + // is already in progress. + bool install_in_progress_ = false; + // Used for tracking if the VPN dependencies have been installed. + // If the user has Brave VPN purchased and loaded with this profile + // AND they did a system level install, we should call + // install_system_service_callback_ once per browser open. + base::OneShotEvent system_service_installed_event_; + base::WeakPtrFactory weak_factory_; }; // Create platform specific api instance. @@ -141,7 +166,8 @@ class BraveVPNOSConnectionAPI std::unique_ptr CreateBraveVPNConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel); + version_info::Channel channel, + base::RepeatingCallback service_installer); } // namespace brave_vpn diff --git a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm index d7ed786a1c80..4726528b444d 100644 --- a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm +++ b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm @@ -151,7 +151,9 @@ OSStatus StorePassword(const NSString* password, std::string* error_str) { std::unique_ptr CreateBraveVPNIKEv2ConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel) { + version_info::Channel channel, + base::RepeatingCallback service_installer) { + // service_installer not currently used on macOS. return std::make_unique(url_loader_factory, local_prefs, channel); } diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/BUILD.gn b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/BUILD.gn index de8d960bc36b..476c98ada39a 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/BUILD.gn +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/BUILD.gn @@ -20,8 +20,8 @@ config("no-missing-braces") { source_set("common") { sources = [ "brave_vpn_helper_constants.h", - "brave_vpn_helper_state.cc", - "brave_vpn_helper_state.h", + "brave_vpn_helper_utils.cc", + "brave_vpn_helper_utils.h", ] deps = [ @@ -29,7 +29,10 @@ source_set("common") { "//brave/components/brave_vpn/common", "//brave/components/brave_vpn/common/buildflags", "//brave/components/brave_vpn/common/win", + "//brave/components/brave_vpn/common/wireguard/win:win", "//chrome/install_static:install_static_util", + "//chrome/installer/util:with_no_strings", + "//components/version_info", ] } @@ -50,15 +53,12 @@ source_set("lib") { ":common", "//base", "//brave/components/brave_vpn/browser/connection/ikev2/win:ras_utils", - "//brave/components/brave_vpn/common", - "//brave/components/brave_vpn/common/win", "//brave/components/brave_vpn/common/wireguard/win", - "//third_party/abseil-cpp:absl", ] libs = [ - "Fwpuclnt.lib", - "Iphlpapi.lib", + "fwpuclnt.lib", + "iphlpapi.lib", "rasapi32.lib", ] } @@ -86,9 +86,6 @@ executable("brave_vpn_helper") { "//components/crash/core/app:run_as_crashpad_handler", "//components/version_info:channel", ] - libs = [ - "userenv.lib", # For GetUserProfileDirectoryW() - ] } process_version_rc_template("version_resources") { @@ -102,13 +99,12 @@ source_set("unit_tests") { sources = [ "vpn_dns_handler_unittest.cc" ] deps = [ - ":common", ":lib", "//base", "//base/test:test_support", "//brave/components/brave_vpn/browser/connection/ikev2/win:ras_utils", + "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", "//brave/components/brave_vpn/common", "//testing/gtest", - "//third_party/abseil-cpp:absl", ] } diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/DEPS b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/DEPS index d665ee20995f..47f5303ca452 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/DEPS +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/DEPS @@ -1,3 +1,4 @@ include_rules = [ + "+chrome/installer/util", "+chrome/install_static" ] diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h index 878f480bd19f..2a9971dea165 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h @@ -12,12 +12,13 @@ namespace brave_vpn { -inline constexpr char kBraveVpnHelperInstall[] = "install"; inline constexpr char kBraveVpnHelperCrashMe[] = "crash-me"; inline constexpr wchar_t kBraveVPNHelperExecutable[] = L"brave_vpn_helper.exe"; inline constexpr wchar_t kBraveVpnHelperFiltersInstalledValue[] = L"filters"; +inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupValue[] = L"ran"; + // Repeating interval to check the connection is live. -constexpr int kCheckConnectionIntervalInSeconds = 3; +inline constexpr int kCheckConnectionIntervalInSeconds = 3; /* UUID of WFP sublayer used by all instances */ #if BUILDFLAG(CHANNEL_NIGHTLY) @@ -25,6 +26,8 @@ inline constexpr wchar_t kBraveVPNServiceFilter[] = L"Brave VPN Nightly Service DNS Filter"; inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceNightly"; +inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = + L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupNightly"; // 23e10e29-eb83-4d2c-9d77-f6e9b547f39c inline constexpr GUID kVpnDnsSublayerGUID = { @@ -37,6 +40,8 @@ inline constexpr wchar_t kBraveVPNServiceFilter[] = L"Brave VPN Beta Service DNS Filter"; inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceBeta"; +inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = + L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupBeta"; // fc5fb7bc-e313-4f5e-8052-fe8b150f7de0 inline constexpr GUID kVpnDnsSublayerGUID = { @@ -49,6 +54,8 @@ inline constexpr wchar_t kBraveVPNServiceFilter[] = L"Brave VPN Dev Service DNS Filter"; inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceDev"; +inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = + L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupDev"; // c448b198-729d-4a89-879b-1cf0cd2460c0 inline constexpr GUID kVpnDnsSublayerGUID = { 0xc448b198, @@ -60,6 +67,8 @@ inline constexpr wchar_t kBraveVPNServiceFilter[] = L"Brave VPN Development Service DNS Filter"; inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceDevelopment"; +inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = + L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupDevelopment"; // 9c14e1f7-692f-495b-95e8-008113d3c0d6 inline constexpr GUID kVpnDnsSublayerGUID = { 0x9c14e1f7, @@ -71,6 +80,8 @@ inline constexpr wchar_t kBraveVPNServiceFilter[] = L"Brave VPN Service DNS Filter"; inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = L"Software\\BraveSoftware\\Brave\\Vpn\\HelperService"; +inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = + L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanup"; // 754b7cbd-cad3-474e-8d2c-054413fd4509 inline constexpr GUID kVpnDnsSublayerGUID = { 0x754b7cbd, diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc index cbf7a0aee62c..510314568d9d 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc @@ -15,8 +15,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" -#include "brave/components/brave_vpn/common/brave_vpn_constants.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "chrome/install_static/install_util.h" #include "chrome/install_static/product_install_details.h" #include "chrome/install_static/user_data_dir.h" diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.cc similarity index 79% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.cc rename to components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.cc index 7522ff7d9795..8917162903e0 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.cc @@ -1,16 +1,24 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ +// Copyright (c) 2023 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include +#include +#include +#include -#include "base/files/file_path.h" +#include +#include + +#include "base/check.h" #include "base/logging.h" +#include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "base/win/registry.h" +#include "base/win/windows_types.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #include "brave/components/brave_vpn/common/win/scoped_sc_handle.h" @@ -20,6 +28,19 @@ namespace brave_vpn { +// The service starts under system user so we save crashes to +// %PROGRAMDATA%\BraveSoftware\{service name}\Crashpad +base::FilePath GetVpnHelperServiceProfileDir() { + std::wstring program_data = + install_static::GetEnvironmentString(L"PROGRAMDATA"); + if (program_data.empty()) { + return base::FilePath(); + } + return base::FilePath(program_data) + .Append(install_static::kCompanyPathName) + .Append(brave_vpn::GetBraveVpnHelperServiceName()); +} + bool IsBraveVPNHelperServiceInstalled() { ScopedScHandle scm(::OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT)); if (!scm.IsValid()) { @@ -37,22 +58,6 @@ bool IsBraveVPNHelperServiceInstalled() { return service.IsValid(); } -std::wstring GetBraveVPNConnectionName() { - return base::UTF8ToWide( - brave_vpn::GetBraveVPNEntryName(install_static::GetChromeChannel())); -} - -std::wstring GetBraveVpnHelperServiceName() { - std::wstring name = GetBraveVpnHelperServiceDisplayName(); - name.erase(std::remove_if(name.begin(), name.end(), isspace), name.end()); - return name; -} - -std::wstring GetBraveVpnHelperServiceDisplayName() { - static constexpr wchar_t kBraveVpnServiceDisplayName[] = L" Vpn Service"; - return install_static::GetBaseAppName() + kBraveVpnServiceDisplayName; -} - bool IsNetworkFiltersInstalled() { DCHECK(IsBraveVPNHelperServiceInstalled()); base::win::RegKey service_storage_key( @@ -70,16 +75,20 @@ bool IsNetworkFiltersInstalled() { return current > 0; } -// The service starts under sytem user so we save crashes to -// %PROGRAMDATA%\BraveSoftware\{service name}\Crashpad -base::FilePath GetVpnHelperServiceProfileDir() { - auto program_data = install_static::GetEnvironmentString("PROGRAMDATA"); - if (program_data.empty()) { - return base::FilePath(); - } - return base::FilePath(base::UTF8ToWide(program_data)) - .Append(install_static::kCompanyPathName) - .Append(brave_vpn::GetBraveVpnHelperServiceName()); +std::wstring GetBraveVPNConnectionName() { + return base::UTF8ToWide( + brave_vpn::GetBraveVPNEntryName(install_static::GetChromeChannel())); +} + +std::wstring GetBraveVpnHelperServiceDisplayName() { + static constexpr wchar_t kBraveVpnServiceDisplayName[] = L" Vpn Service"; + return install_static::GetBaseAppName() + kBraveVpnServiceDisplayName; +} + +std::wstring GetBraveVpnHelperServiceName() { + std::wstring name = GetBraveVpnHelperServiceDisplayName(); + name.erase(std::remove_if(name.begin(), name.end(), isspace), name.end()); + return name; } } // namespace brave_vpn diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h similarity index 81% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h rename to components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h index 7018cf0ac8cc..afe0986c03a3 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h @@ -3,23 +3,22 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_STATE_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_STATE_H_ +#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ +#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ #include -namespace base { -class FilePath; -} // namespace base +#include "base/files/file_path.h" namespace brave_vpn { +base::FilePath GetVpnHelperServiceProfileDir(); bool IsBraveVPNHelperServiceInstalled(); bool IsNetworkFiltersInstalled(); std::wstring GetBraveVPNConnectionName(); -std::wstring GetBraveVpnHelperServiceName(); std::wstring GetBraveVpnHelperServiceDisplayName(); -base::FilePath GetVpnHelperServiceProfileDir(); +std::wstring GetBraveVpnHelperServiceName(); + } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_STATE_H_ +#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/main.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/main.cc index 25f5af0eec97..b9368925dabc 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/main.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/main.cc @@ -14,7 +14,7 @@ #include "base/win/process_startup_helper.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h" #include "components/crash/core/app/crash_switches.h" @@ -69,14 +69,6 @@ int main(int argc, char* argv[]) { base::win::SetupCRT(*command_line); - // Register vpn helper service in the system. - if (command_line->HasSwitch(brave_vpn::kBraveVpnHelperInstall)) { - auto success = brave_vpn::ConfigureServiceAutoRestart( - brave_vpn::GetBraveVpnHelperServiceName(), - brave_vpn::GetBraveVPNConnectionName()); - return success ? 0 : 1; - } - // Run the service. brave_vpn::ServiceMain* service = brave_vpn::ServiceMain::GetInstance(); if (!service->InitWithCommandLine(command_line)) { diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.cc index 8b3e42de9554..7e7114ffe188 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.cc @@ -15,7 +15,7 @@ #include "base/task/thread_pool.h" #include "base/threading/thread_restrictions.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" namespace brave_vpn { namespace { diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.cc index c2c6da8f228f..4be39ee1a323 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.cc @@ -12,7 +12,7 @@ #include "base/time/time.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_dns_delegate.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_state.h" +#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/ras_utils.h" #include "brave/components/brave_vpn/common/wireguard/win/service_commands.h" diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.cc index 0504f3ffbd25..ef9ebe8263a3 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.cc @@ -8,61 +8,22 @@ #include #include #include +#include +#include +#include #include #include #include "base/logging.h" -#include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" #include "base/win/registry.h" -#include "base/win/windows_version.h" +#include "base/win/windows_types.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/common/win/scoped_sc_handle.h" -#include "brave/components/brave_vpn/common/win/utils.h" namespace brave_vpn { namespace { -// Microsoft-Windows-NetworkProfile -// fbcfac3f-8459-419f-8e48-1f0b49cdb85e -constexpr GUID kNetworkProfileGUID = { - 0xfbcfac3f, - 0x8459, - 0x419f, - {0x8e, 0x48, 0x1f, 0x0b, 0x49, 0xcd, 0xb8, 0x5e}}; - -bool SetServiceTriggerForVPNConnection(SC_HANDLE hService, - const std::wstring& brave_vpn_entry) { - std::wstring brave_vpn_entry_with_null(brave_vpn_entry); - brave_vpn_entry_with_null += L'\0'; - // Allocate and set the SERVICE_TRIGGER_SPECIFIC_DATA_ITEM structure - SERVICE_TRIGGER_SPECIFIC_DATA_ITEM deviceData = {0}; - deviceData.dwDataType = SERVICE_TRIGGER_DATA_TYPE_STRING; - // Exclude EOL - deviceData.cbData = brave_vpn_entry_with_null.size() * - sizeof(brave_vpn_entry_with_null.front()); - deviceData.pData = (PBYTE)brave_vpn_entry_with_null.c_str(); - // Allocate and set the SERVICE_TRIGGER structure - SERVICE_TRIGGER serviceTrigger = {0}; - serviceTrigger.dwTriggerType = SERVICE_TRIGGER_TYPE_CUSTOM; - serviceTrigger.dwAction = SERVICE_TRIGGER_ACTION_SERVICE_START; - serviceTrigger.pTriggerSubtype = const_cast(&kNetworkProfileGUID); - serviceTrigger.cDataItems = 1; - serviceTrigger.pDataItems = &deviceData; - - // Allocate and set the SERVICE_TRIGGER_INFO structure - SERVICE_TRIGGER_INFO serviceTriggerInfo = {0}; - serviceTriggerInfo.cTriggers = 1; - serviceTriggerInfo.pTriggers = &serviceTrigger; - - // Call ChangeServiceConfig2 with the SERVICE_CONFIG_TRIGGER_INFO level - // and pass to it the address of the SERVICE_TRIGGER_INFO structure - return ChangeServiceConfig2(hService, SERVICE_CONFIG_TRIGGER_INFO, - &serviceTriggerInfo); -} - DWORD AddSublayer(GUID uuid) { FWPM_SESSION0 session = {}; HANDLE engine = nullptr; @@ -307,35 +268,6 @@ bool SubscribeRasConnectionNotification(HANDLE event_handle) { return success; } -bool ConfigureServiceAutoRestart(const std::wstring& service_name, - const std::wstring& brave_vpn_entry) { - ScopedScHandle scm(::OpenSCManager(nullptr, nullptr, SC_MANAGER_CONNECT)); - if (!scm.IsValid()) { - LOG(ERROR) << "::OpenSCManager failed. service_name: " << service_name - << ", error: " << std::hex << HRESULTFromLastError(); - return false; - } - ScopedScHandle service( - ::OpenService(scm.Get(), service_name.c_str(), SERVICE_ALL_ACCESS)); - if (!service.IsValid()) { - LOG(ERROR) << "::OpenService failed. service_name: " << service_name - << ", error: " << std::hex << HRESULTFromLastError(); - return false; - } - - if (!brave_vpn::SetServiceFailureActions(service.Get())) { - LOG(ERROR) << "SetServiceFailureActions failed:" << std::hex - << HRESULTFromLastError(); - return false; - } - if (!SetServiceTriggerForVPNConnection(service.Get(), brave_vpn_entry)) { - LOG(ERROR) << "SetServiceTriggerForVPNConnection failed:" << std::hex - << HRESULTFromLastError(); - return false; - } - return true; -} - void SetFiltersInstalledFlag() { base::win::RegKey key(HKEY_LOCAL_MACHINE, kBraveVpnHelperRegistryStoragePath, KEY_ALL_ACCESS); diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h index 3f4572be90e9..d9dfd99c1099 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h @@ -23,9 +23,6 @@ HANDLE OpenWpmSession(); bool CloseWpmSession(HANDLE engine); // Subscribes for RAS connection notification of any os vpn entry. bool SubscribeRasConnectionNotification(HANDLE event_handle); -// Configure VPN Service autorestart. -bool ConfigureServiceAutoRestart(const std::wstring& service_name, - const std::wstring& brave_vpn_entry); } // namespace brave_vpn #endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_VPN_UTILS_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc index 18535bae4a6e..3ad9aefb0d3e 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc @@ -11,6 +11,7 @@ #include #include +#include #include "base/logging.h" #include "base/notreached.h" @@ -43,16 +44,21 @@ RasOperationResult DisconnectEntry(const std::wstring& name) { std::unique_ptr CreateBraveVPNIKEv2ConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel) { - return std::make_unique(url_loader_factory, - local_prefs, channel); + version_info::Channel channel, + base::RepeatingCallback service_installer) { + return std::make_unique( + url_loader_factory, local_prefs, channel, service_installer); } BraveVPNOSConnectionAPIWin::BraveVPNOSConnectionAPIWin( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel) + version_info::Channel channel, + base::RepeatingCallback service_installer) : BraveVPNOSConnectionAPIBase(url_loader_factory, local_prefs, channel) { + if (service_installer) { + install_system_service_callback_ = std::move(service_installer); + } StartRasConnectionChangeMonitoring(); } diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h index fbd0053e4699..bea88a6a7422 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h @@ -25,7 +25,8 @@ class BraveVPNOSConnectionAPIWin : public BraveVPNOSConnectionAPIBase, BraveVPNOSConnectionAPIWin( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel); + version_info::Channel channel, + base::RepeatingCallback service_installer); BraveVPNOSConnectionAPIWin(const BraveVPNOSConnectionAPIWin&) = delete; BraveVPNOSConnectionAPIWin& operator=(const BraveVPNOSConnectionAPIWin&) = delete; diff --git a/components/brave_vpn/browser/connection/wireguard/brave_vpn_wireguard_connection_api_base.cc b/components/brave_vpn/browser/connection/wireguard/brave_vpn_wireguard_connection_api_base.cc index 64e3d789e1ee..df7213d311bd 100644 --- a/components/brave_vpn/browser/connection/wireguard/brave_vpn_wireguard_connection_api_base.cc +++ b/components/brave_vpn/browser/connection/wireguard/brave_vpn_wireguard_connection_api_base.cc @@ -49,6 +49,10 @@ void BraveVPNWireguardConnectionAPIBase::RequestNewProfileCredentials( } void BraveVPNWireguardConnectionAPIBase::Connect() { + if (ScheduleConnectRequestIfNeeded()) { + return; + } + VLOG(2) << __func__ << " : start connecting!"; SetLastConnectionError(std::string()); UpdateAndNotifyConnectionStateChange(ConnectionState::CONNECTING); diff --git a/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm b/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm index 63c2dfb4a25e..a27c2eb7a01d 100644 --- a/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm +++ b/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm @@ -16,7 +16,9 @@ CreateBraveVPNWireguardConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel) { + version_info::Channel channel, + base::RepeatingCallback service_installer) { + // service_installer not currently used on macOS. return std::make_unique(url_loader_factory, local_prefs); } diff --git a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc b/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc index b66ed4e69f87..99b33b2e5e4e 100644 --- a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc +++ b/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc @@ -7,6 +7,7 @@ #include #include +#include #include "brave/components/brave_vpn/browser/connection/wireguard/brave_vpn_wireguard_connection_api_base.h" #include "brave/components/brave_vpn/common/win/utils.h" @@ -25,15 +26,21 @@ using ConnectionState = mojom::ConnectionState; std::unique_ptr CreateBraveVPNWireguardConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel) { - return std::make_unique(url_loader_factory, - local_prefs); + version_info::Channel channel, + base::RepeatingCallback service_installer) { + return std::make_unique( + url_loader_factory, local_prefs, service_installer); } BraveVPNWireguardConnectionAPI::BraveVPNWireguardConnectionAPI( scoped_refptr url_loader_factory, - PrefService* local_prefs) - : BraveVPNWireguardConnectionAPIBase(url_loader_factory, local_prefs) {} + PrefService* local_prefs, + base::RepeatingCallback service_installer) + : BraveVPNWireguardConnectionAPIBase(url_loader_factory, local_prefs) { + if (service_installer) { + install_system_service_callback_ = std::move(service_installer); + } +} BraveVPNWireguardConnectionAPI::~BraveVPNWireguardConnectionAPI() {} diff --git a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h b/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h index dbe6c95ff745..9e4a00517995 100644 --- a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h +++ b/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h @@ -24,7 +24,8 @@ class BraveVPNWireguardConnectionAPI public: BraveVPNWireguardConnectionAPI( scoped_refptr url_loader_factory, - PrefService* local_prefs); + PrefService* local_prefs, + base::RepeatingCallback service_installer); BraveVPNWireguardConnectionAPI(const BraveVPNWireguardConnectionAPI&) = delete; diff --git a/components/brave_vpn/common/brave_vpn_utils.cc b/components/brave_vpn/common/brave_vpn_utils.cc index bbeb4d07f82f..9b8d85a0389a 100644 --- a/components/brave_vpn/common/brave_vpn_utils.cc +++ b/components/brave_vpn/common/brave_vpn_utils.cc @@ -73,7 +73,7 @@ void MigrateWireguardFeatureFlag(PrefService* local_prefs) { local_prefs->SetBoolean( prefs::kBraveVPNWireguardEnabled, base::FeatureList::IsEnabled(features::kBraveVPNUseWireguardService) && - brave_vpn::wireguard::IsWireguardServiceRegistered()); + brave_vpn::wireguard::IsWireguardServiceInstalled()); } } #endif // BUILDFLAG(IS_WIN) diff --git a/components/brave_vpn/common/win/BUILD.gn b/components/brave_vpn/common/win/BUILD.gn index d551b3abc12a..13edc9fe2df1 100644 --- a/components/brave_vpn/common/win/BUILD.gn +++ b/components/brave_vpn/common/win/BUILD.gn @@ -15,6 +15,7 @@ source_set("win") { ] visibility = [ "//brave/browser/*", + "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/*", "//brave/components/brave_vpn/*", "//chrome/browser/*", ] diff --git a/components/brave_vpn/common/win/scoped_sc_handle.h b/components/brave_vpn/common/win/scoped_sc_handle.h index 9f4257a58fa3..be0545510e8a 100644 --- a/components/brave_vpn/common/win/scoped_sc_handle.h +++ b/components/brave_vpn/common/win/scoped_sc_handle.h @@ -11,6 +11,7 @@ #include "base/types/expected.h" #include "base/win/scoped_handle.h" +#include "base/win/windows_types.h" // Helper for methods which perform system operations which may fail. The // failure reason is returned as an HRESULT. diff --git a/components/brave_vpn/common/wireguard/win/service_constants.h b/components/brave_vpn/common/wireguard/win/service_constants.h index 30ecef1d99f1..5b9088dc2e44 100644 --- a/components/brave_vpn/common/wireguard/win/service_constants.h +++ b/components/brave_vpn/common/wireguard/win/service_constants.h @@ -15,13 +15,6 @@ inline constexpr wchar_t kBraveVpnWireguardServiceExecutable[] = inline constexpr wchar_t kBraveVpnWireguardCounterOfTunnelUsage[] = L"tunnel_launches_counter"; -// Register and configure windows service. -inline constexpr char kBraveVpnWireguardServiceInstallSwitchName[] = "install"; - -// Remove config and all stuff related to service. -inline constexpr char kBraveVpnWireguardServiceUnnstallSwitchName[] = - "uninstall"; - // Load wireguard binaries and connect to vpn using passed config. inline constexpr char kBraveVpnWireguardServiceConnectSwitchName[] = "connect"; diff --git a/components/brave_vpn/common/wireguard/win/service_details.cc b/components/brave_vpn/common/wireguard/win/service_details.cc index 460c5b02d76f..cd63a93ca078 100644 --- a/components/brave_vpn/common/wireguard/win/service_details.cc +++ b/components/brave_vpn/common/wireguard/win/service_details.cc @@ -108,6 +108,7 @@ std::wstring GetBraveVpnWireguardTunnelServiceName() { return kBraveWireguardTunnelServiceName; } +// only used by `chromium_src/chrome/installer/setup/install_worker.cc` base::FilePath GetBraveVPNWireguardServiceInstallationPath( const base::FilePath& target_path, const base::Version& version) { @@ -117,12 +118,9 @@ base::FilePath GetBraveVPNWireguardServiceInstallationPath( } base::FilePath GetBraveVPNWireguardServiceExecutablePath() { - base::FilePath exe_dir; - base::PathService::Get(base::DIR_EXE, &exe_dir); - return version_info::IsOfficialBuild() - ? brave_vpn::GetBraveVPNWireguardServiceInstallationPath( - exe_dir, version_info::GetVersion()) - : exe_dir.Append(brave_vpn::kBraveVpnWireguardServiceExecutable); + base::FilePath asset_dir = base::PathService::CheckedGet(base::DIR_ASSETS); + return asset_dir.Append(brave_vpn::kBraveVpnWireguardServiceSubFolder) + .Append(brave_vpn::kBraveVpnWireguardServiceExecutable); } } // namespace brave_vpn diff --git a/components/brave_vpn/common/wireguard/win/storage_utils.cc b/components/brave_vpn/common/wireguard/win/storage_utils.cc index 4ab056d1a9a5..eabf6f910ea3 100644 --- a/components/brave_vpn/common/wireguard/win/storage_utils.cc +++ b/components/brave_vpn/common/wireguard/win/storage_utils.cc @@ -153,7 +153,7 @@ bool ShouldFallbackToIKEv2() { DWORD launch = 0; storage->ReadValueDW(kBraveVpnWireguardCounterOfTunnelUsage, &launch); return launch >= kBraveVpnWireguardMaxFailedAttempts || - !wireguard::IsWireguardServiceRegistered(); + !wireguard::IsWireguardServiceInstalled(); } // Increments number of usages for the wireguard tunnel service. diff --git a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.cc b/components/brave_vpn/common/wireguard/win/wireguard_utils_win.cc index c023f1bb929c..a2b7883fcecd 100644 --- a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.cc +++ b/components/brave_vpn/common/wireguard/win/wireguard_utils_win.cc @@ -35,7 +35,7 @@ std::optional g_wireguard_service_registered_for_testing; namespace wireguard { -bool IsWireguardServiceRegistered() { +bool IsWireguardServiceInstalled() { if (g_wireguard_service_registered_for_testing.has_value()) { return g_wireguard_service_registered_for_testing.value(); } diff --git a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h b/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h index fba7ee16dd48..ce78cf236387 100644 --- a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h +++ b/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h @@ -18,7 +18,7 @@ namespace brave_vpn { namespace wireguard { bool IsBraveVPNWireguardTunnelServiceRunning(); -bool IsWireguardServiceRegistered(); +bool IsWireguardServiceInstalled(); void WireguardGenerateKeypair(WireguardGenerateKeypairCallback callback); std::optional CreateWireguardConfig( const std::string& client_private_key, diff --git a/elevation_service/README.md b/elevation_service/README.md new file mode 100644 index 000000000000..8454458e729d --- /dev/null +++ b/elevation_service/README.md @@ -0,0 +1,29 @@ +## Elevation service + +[Please see the documentation in upstream Chromium](https://source.chromium.org/chromium/chromium/src/+/main:chrome/elevation_service/README.md). + +### When does this get registered + +This Windows-specific service is registered for system level installs. There are two ways a system level install can be done: +- UAC prompt raised during Brave install (ex: person has admin privs) and person clicks `Yes` to accept escalation. +- Brave installer executable is invoked with `--system-level` argument in command line which has admin privs. + + +### What is the service used for? + +Currently, the elevation service is only used to install the `Brave VPN` services once the browser detects the product was purchased. + + +### Debugging + +The service executable is inside the versioned folder of Brave. It's possible to debug the service interactively by using the following procedure: + +1. Open `regedit.exe` +2. Navigate to `[HKEY_CLASSES_ROOT\AppID\{5693E62D-00D6-4421-AFE8-58F3C947436A}]` (or if building another channel, [check here to find the right AppID](https://github.com/brave/brave-core/blob/master/chromium_src/chrome/install_static/chromium_install_modes.cc)). +3. Delete the `LocalService` value (should be set to something like `BraveDevelopmentElevationService`) and create a new String value called `RunAs` with the data value set to `Interactive User`. +4. Open an admin `cmd.exe` instance. +5. Navigate to the path where you built the elevation service executable (ex: `C:\brave\src\out\Component`). +6. Launch the exe via `elevation_service.exe --console`. +7. After debugging, don't forget to undo step 3. + +These steps will let you run a locally compiled version of elevation service. This is very helpful for debugging or tracing the logic there. diff --git a/elevation_service/sources.gni b/elevation_service/sources.gni new file mode 100644 index 000000000000..ad48b5b8e503 --- /dev/null +++ b/elevation_service/sources.gni @@ -0,0 +1,17 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at https://mozilla.org/MPL/2.0/. + +import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") + +brave_elevation_service_lib_deps = + [ "//brave/components/brave_vpn/common/buildflags" ] + +if (is_win && enable_brave_vpn) { + brave_elevation_service_lib_deps += [ + "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:install_utils", + "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", + "//brave/components/brave_vpn/common/wireguard/win", + ] +} diff --git a/patches/chrome-elevation_service-BUILD.gn.patch b/patches/chrome-elevation_service-BUILD.gn.patch new file mode 100644 index 000000000000..5afbd25dfc8e --- /dev/null +++ b/patches/chrome-elevation_service-BUILD.gn.patch @@ -0,0 +1,20 @@ +diff --git a/chrome/elevation_service/BUILD.gn b/chrome/elevation_service/BUILD.gn +index 6ae8694531550df2835f3afbe5a699403f7495fb..fc1e83132d6a1bc880bdc8ca55c0f73da1574e30 100644 +--- a/chrome/elevation_service/BUILD.gn ++++ b/chrome/elevation_service/BUILD.gn +@@ -10,6 +10,7 @@ import("//testing/test.gni") + + midl("elevation_service_idl") { + sources = [ "elevation_service_idl.idl" ] ++ sources -= [ "elevation_service_idl.idl" ] sources += ["//brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl" ] + + writes_tlb = true + } +@@ -97,6 +98,7 @@ source_set("lib") { + "crypt32.lib", + "rpcrt4.lib", + ] ++ deps += brave_elevation_service_lib_deps + } + + process_version_rc_template("version_resources") { diff --git a/patches/chrome-installer-mini_installer-chrome.release.patch b/patches/chrome-installer-mini_installer-chrome.release.patch index eed219842dd7..7639ae192c7e 100644 --- a/patches/chrome-installer-mini_installer-chrome.release.patch +++ b/patches/chrome-installer-mini_installer-chrome.release.patch @@ -1,5 +1,5 @@ diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release -index 948fc15a146b85f8e4b91e677e54ac2ae77bbabe..db4b1186e95d0407af7495ad1057cc4787c02bca 100644 +index 948fc15a146b85f8e4b91e677e54ac2ae77bbabe..8debc2f85562a462ecdf1a1e1517bbc94eeb85af 100644 --- a/chrome/installer/mini_installer/chrome.release +++ b/chrome/installer/mini_installer/chrome.release @@ -6,7 +6,7 @@ @@ -11,7 +11,7 @@ index 948fc15a146b85f8e4b91e677e54ac2ae77bbabe..db4b1186e95d0407af7495ad1057cc47 chrome_proxy.exe: %(ChromeDir)s\ # # Chrome version dir assembly manifest. -@@ -18,9 +18,18 @@ chrome_proxy.exe: %(ChromeDir)s\ +@@ -18,9 +18,19 @@ chrome_proxy.exe: %(ChromeDir)s\ # # Chrome version dir entries, sorted alphabetically. # @@ -20,6 +20,7 @@ index 948fc15a146b85f8e4b91e677e54ac2ae77bbabe..db4b1186e95d0407af7495ad1057cc47 +brave_vpn_wireguard_service.exe: %(VersionDir)s\BraveVpnWireguardService\ +tunnel.dll: %(VersionDir)s\BraveVpnWireguardService\ +wireguard.dll: %(VersionDir)s\BraveVpnWireguardService\ ++elevation_service.exe: %(VersionDir)s\ chrome.dll: %(VersionDir)s\ +chrome.dll.sig: %(VersionDir)s\ +brave_resources.pak: %(VersionDir)s\ @@ -30,7 +31,7 @@ index 948fc15a146b85f8e4b91e677e54ac2ae77bbabe..db4b1186e95d0407af7495ad1057cc47 chrome_elf.dll: %(VersionDir)s\ chrome_pwa_launcher.exe: %(VersionDir)s\ chrome_wer.dll: %(VersionDir)s\ -@@ -60,6 +69,7 @@ MEIPreload\preloaded_data.pb: %(VersionDir)s\MEIPreload\ +@@ -60,6 +70,7 @@ MEIPreload\preloaded_data.pb: %(VersionDir)s\MEIPreload\ [HIDPI] chrome_200_percent.pak: %(VersionDir)s\ diff --git a/test/BUILD.gn b/test/BUILD.gn index db4124db5d9f..bcef3f0d093b 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -622,6 +622,12 @@ if (!is_android) { "//testing/gmock", "//testing/gtest", ] + + if (enable_brave_vpn) { + deps += [ + "//brave/chromium_src/chrome/installer/setup/test:vpn_unit_tests", + ] + } } } } diff --git a/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.dlldata.c b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.dlldata.c new file mode 100644 index 000000000000..6eda5609d245 --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.dlldata.c @@ -0,0 +1,38 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + +#define PROXY_DELEGATION + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( elevation_service_idl ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( elevation_service_idl ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.h b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.h new file mode 100644 index 000000000000..4e3355d9d82b --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.h @@ -0,0 +1,1036 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=ARM64 8.01.0628 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __elevation_service_idl_h__ +#define __elevation_service_idl_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#ifndef DECLSPEC_XFGVIRT +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) +#else +#define DECLSPEC_XFGVIRT(base, func) +#endif +#endif + +/* Forward Declarations */ + +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; + +#endif /* __IElevator_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromium_FWD_DEFINED__ +#define __IElevatorChromium_FWD_DEFINED__ +typedef interface IElevatorChromium IElevatorChromium; + +#endif /* __IElevatorChromium_FWD_DEFINED__ */ + + +#ifndef __IElevatorChrome_FWD_DEFINED__ +#define __IElevatorChrome_FWD_DEFINED__ +typedef interface IElevatorChrome IElevatorChrome; + +#endif /* __IElevatorChrome_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_FWD_DEFINED__ +#define __IElevatorChromeBeta_FWD_DEFINED__ +typedef interface IElevatorChromeBeta IElevatorChromeBeta; + +#endif /* __IElevatorChromeBeta_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_FWD_DEFINED__ +#define __IElevatorChromeDev_FWD_DEFINED__ +typedef interface IElevatorChromeDev IElevatorChromeDev; + +#endif /* __IElevatorChromeDev_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_FWD_DEFINED__ +#define __IElevatorChromeCanary_FWD_DEFINED__ +typedef interface IElevatorChromeCanary IElevatorChromeCanary; + +#endif /* __IElevatorChromeCanary_FWD_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_FWD_DEFINED__ +#define __IElevatorDevelopment_FWD_DEFINED__ +typedef interface IElevatorDevelopment IElevatorDevelopment; + +#endif /* __IElevatorDevelopment_FWD_DEFINED__ */ + + +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; + +#endif /* __IElevator_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromium_FWD_DEFINED__ +#define __IElevatorChromium_FWD_DEFINED__ +typedef interface IElevatorChromium IElevatorChromium; + +#endif /* __IElevatorChromium_FWD_DEFINED__ */ + + +#ifndef __IElevatorChrome_FWD_DEFINED__ +#define __IElevatorChrome_FWD_DEFINED__ +typedef interface IElevatorChrome IElevatorChrome; + +#endif /* __IElevatorChrome_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_FWD_DEFINED__ +#define __IElevatorChromeBeta_FWD_DEFINED__ +typedef interface IElevatorChromeBeta IElevatorChromeBeta; + +#endif /* __IElevatorChromeBeta_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_FWD_DEFINED__ +#define __IElevatorChromeDev_FWD_DEFINED__ +typedef interface IElevatorChromeDev IElevatorChromeDev; + +#endif /* __IElevatorChromeDev_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_FWD_DEFINED__ +#define __IElevatorChromeCanary_FWD_DEFINED__ +typedef interface IElevatorChromeCanary IElevatorChromeCanary; + +#endif /* __IElevatorChromeCanary_FWD_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_FWD_DEFINED__ +#define __IElevatorDevelopment_FWD_DEFINED__ +typedef interface IElevatorDevelopment IElevatorDevelopment; + +#endif /* __IElevatorDevelopment_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_elevation_service_idl_0000_0000 */ +/* [local] */ + +typedef +enum ProtectionLevel + { + NONE = 0, + PATH_VALIDATION = 1 + } ProtectionLevel; + + + +extern RPC_IF_HANDLE __MIDL_itf_elevation_service_idl_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_elevation_service_idl_0000_0000_v0_0_s_ifspec; + +#ifndef __IElevator_INTERFACE_DEFINED__ +#define __IElevator_INTERFACE_DEFINED__ + +/* interface IElevator */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5A9A9462-2FA1-4FEB-B7F2-DF3D19134463") + IElevator : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE RunRecoveryCRXElevated( + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle) = 0; + + virtual HRESULT STDMETHODCALLTYPE EncryptData( + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error) = 0; + + virtual HRESULT STDMETHODCALLTYPE DecryptData( + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error) = 0; + + virtual HRESULT STDMETHODCALLTYPE InstallVPNServices( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IElevatorVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevator * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevator * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevator * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevator * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevator * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevator * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevator * This); + + END_INTERFACE + } IElevatorVtbl; + + interface IElevator + { + CONST_VTBL struct IElevatorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevator_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevator_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevator_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevator_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevator_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromium_INTERFACE_DEFINED__ +#define __IElevatorChromium_INTERFACE_DEFINED__ + +/* interface IElevatorChromium */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromium; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3218DA17-49C2-479A-8290-311DBFB86490") + IElevatorChromium : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromiumVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromium * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromium * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromium * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromium * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromium * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromium * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromium * This); + + END_INTERFACE + } IElevatorChromiumVtbl; + + interface IElevatorChromium + { + CONST_VTBL struct IElevatorChromiumVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromium_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromium_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromium_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromium_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromium_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromium_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromium_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromium_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChrome_INTERFACE_DEFINED__ +#define __IElevatorChrome_INTERFACE_DEFINED__ + +/* interface IElevatorChrome */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChrome; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F396861E-0C8E-4C71-8256-2FAE6D759CE9") + IElevatorChrome : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChrome * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChrome * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChrome * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChrome * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChrome * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChrome * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChrome * This); + + END_INTERFACE + } IElevatorChromeVtbl; + + interface IElevatorChrome + { + CONST_VTBL struct IElevatorChromeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChrome_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChrome_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChrome_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChrome_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChrome_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChrome_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChrome_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChrome_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_INTERFACE_DEFINED__ +#define __IElevatorChromeBeta_INTERFACE_DEFINED__ + +/* interface IElevatorChromeBeta */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeBeta; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EBAD7AC-6E1E-4A1C-AA85-1A70CADA8D82") + IElevatorChromeBeta : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeBetaVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeBeta * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeBeta * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeBeta * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeBeta * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeBeta * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeBeta * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeBeta * This); + + END_INTERFACE + } IElevatorChromeBetaVtbl; + + interface IElevatorChromeBeta + { + CONST_VTBL struct IElevatorChromeBetaVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeBeta_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeBeta_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeBeta_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeBeta_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeBeta_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeBeta_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeBeta_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeBeta_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_INTERFACE_DEFINED__ +#define __IElevatorChromeDev_INTERFACE_DEFINED__ + +/* interface IElevatorChromeDev */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeDev; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1E43C77B-48E6-4A4C-9DB2-C2971706C255") + IElevatorChromeDev : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeDevVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeDev * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeDev * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeDev * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeDev * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeDev * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeDev * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeDev * This); + + END_INTERFACE + } IElevatorChromeDevVtbl; + + interface IElevatorChromeDev + { + CONST_VTBL struct IElevatorChromeDevVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeDev_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeDev_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeDev_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeDev_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeDev_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeDev_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeDev_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeDev_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_INTERFACE_DEFINED__ +#define __IElevatorChromeCanary_INTERFACE_DEFINED__ + +/* interface IElevatorChromeCanary */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeCanary; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1DB2116F-71B7-49F0-8970-33B1DACFB072") + IElevatorChromeCanary : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeCanaryVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeCanary * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeCanary * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeCanary * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeCanary * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeCanary * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeCanary * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeCanary * This); + + END_INTERFACE + } IElevatorChromeCanaryVtbl; + + interface IElevatorChromeCanary + { + CONST_VTBL struct IElevatorChromeCanaryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeCanary_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeCanary_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeCanary_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeCanary_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeCanary_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeCanary_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeCanary_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeCanary_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_INTERFACE_DEFINED__ +#define __IElevatorDevelopment_INTERFACE_DEFINED__ + +/* interface IElevatorDevelopment */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorDevelopment; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("17239BF1-A1DC-4642-846C-1BAC85F96A10") + IElevatorDevelopment : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorDevelopmentVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorDevelopment * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorDevelopment * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorDevelopment * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorDevelopment * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorDevelopment * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorDevelopment * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorDevelopment * This); + + END_INTERFACE + } IElevatorDevelopmentVtbl; + + interface IElevatorDevelopment + { + CONST_VTBL struct IElevatorDevelopmentVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorDevelopment_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorDevelopment_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorDevelopment_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorDevelopment_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorDevelopment_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorDevelopment_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorDevelopment_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorDevelopment_INTERFACE_DEFINED__ */ + + + +#ifndef __ElevatorLib_LIBRARY_DEFINED__ +#define __ElevatorLib_LIBRARY_DEFINED__ + +/* library ElevatorLib */ +/* [helpstring][version][uuid] */ + + + + + + + + + +EXTERN_C const IID LIBID_ElevatorLib; +#endif /* __ElevatorLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); +unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); +unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); +void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.tlb b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl.tlb new file mode 100644 index 0000000000000000000000000000000000000000..7a7256c3ffdda7a42cb99e685f04774103848afa GIT binary patch literal 3768 zcmbtXeQZ-z6hGYtbQ>_B<6~nR&rA(}m{C6d=pVz3wTu0Hr0VfxJAVIm}D5GS6zB1ufwNhE+@}j7dh&(k{&OG~+YO z7-Rg0ad#2Xc}As}sGsSBJi?}e_0G>HT4?zIJ&*j%Q7t`4S^O%G)__xAu0&M~O%36U{L<>?9@avmP z3XbtJtT={Z#lSg`@aP!x3XX9L4mn1n6(cSK@c8H$^9zpQM4cF4v|@}E9AiPjF%&Dt zek;aA!7-c#$M9G&KDJ_9EHDQ0MJ)lhY;(}PHX1o#&%w_J!*j?`U%ay?EIHOG?I)Sn zRx|O<#eYTn>z|hzmv%d+?ps1}Zs@oDJAPXF$qdn*p~madCNu{>JO{t;oue-tTX(bL z%wLx`SGjy44w;JYE=d;(YhY-x%9f`1Ihmfdpsa{p+gf?IZ`}Lb+fCO`Uwf({DA%)c zX4Qr%|IuxuW9w_bJ{ulGZ+Ejz-D~gt{no-gfzh6IUkvOWzm9$no0FH$eN-2%+5Xv~ z>iC73H%D;?fWPlMZ{4-l!1fPMPrbi#{?snq3$5%Yw)AxEnLW4sZ^SpAn)zYEz+D0T z+aJ`g{PkFK%Rznh$wPNvUV{4rd_K&n=7)X7o&b>BI!c(~m@YOnn0lY8s?aSI!qyt0 z4}TcPtr2qx*k?JB_1(MD; z9$|k9>$okyjg~&{jigoQv(}i;9%skS$C;eYv&M2-9NnsmLCuUAfk>aqYAL%?&%3Yq zrGU>%IK$t6X;+}5eOs`zyNmf!e+At+*0nd+FoIe<9%1#&*{q` z?&3x)^pLEaHvExd_G{6wF4So&rwUK>`A#Edijc|f0%B0;8Ci+@tIh2l?OQXt?i;?& zE#0lbo-F~tZ%enoqdilDa?xb?zyrrNAA_4nlZxh(a&^FqSEu_FBu)S7J4i`Afjd!$-}9v zZ*VK!BXObd`88neqKt*&=fWB*5=BPsZCy!E9bS^#Oj({ zc{)?OidvV|v1OW7sig-8@E%t4i2beQf3rB3)#Pk)k~3LNt|k|`l1_S-xn4tPrU)y2 zBTAd!7f`G>Nbxib5A$z$SkX*HQw$N-LePuH_z)_QsA5J2M41aactGV^MvELyRYh+H zU|-Qod?_k@M+JD!p8}~no{z<0=-gwvm$8bfl05K#fbrC~6h1-L(ESJ4Th>j@leRhT z70E|`!yGxGXJYPToMq%A#`mKm<6ohJ?B78p%wNKYJ1ed4OeU>4azI~&t-^?&jd>$K z-n|N$e_<{QY0Nein@_usC literal 0 HcmV?d00001 diff --git a/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_i.c b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_i.c new file mode 100644 index 000000000000..dc120e9114fd --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_i.c @@ -0,0 +1,100 @@ + + +/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ + +/* link this file in with the server and any clients */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=ARM64 8.01.0628 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +#ifdef __cplusplus +extern "C"{ +#endif + + +#include +#include + +#ifdef _MIDL_USE_GUIDDEF_ + +#ifndef INITGUID +#define INITGUID +#include +#undef INITGUID +#else +#include +#endif + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#else // !_MIDL_USE_GUIDDEF_ + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} + +#endif // !_MIDL_USE_GUIDDEF_ + +MIDL_DEFINE_GUID(IID, IID_IElevator,0x5A9A9462,0x2FA1,0x4FEB,0xB7,0xF2,0xDF,0x3D,0x19,0x13,0x44,0x63); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromium,0x3218DA17,0x49C2,0x479A,0x82,0x90,0x31,0x1D,0xBF,0xB8,0x64,0x90); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChrome,0xF396861E,0x0C8E,0x4C71,0x82,0x56,0x2F,0xAE,0x6D,0x75,0x9C,0xE9); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeBeta,0x9EBAD7AC,0x6E1E,0x4A1C,0xAA,0x85,0x1A,0x70,0xCA,0xDA,0x8D,0x82); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeDev,0x1E43C77B,0x48E6,0x4A4C,0x9D,0xB2,0xC2,0x97,0x17,0x06,0xC2,0x55); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeCanary,0x1DB2116F,0x71B7,0x49F0,0x89,0x70,0x33,0xB1,0xDA,0xCF,0xB0,0x72); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorDevelopment,0x17239BF1,0xA1DC,0x4642,0x84,0x6C,0x1B,0xAC,0x85,0xF9,0x6A,0x10); + + +MIDL_DEFINE_GUID(IID, LIBID_ElevatorLib,0xC3B01C4D,0xFBD4,0x4E65,0x88,0xAD,0x09,0x72,0xD7,0x58,0x08,0xC2); + +#undef MIDL_DEFINE_GUID + +#ifdef __cplusplus +} +#endif + + + diff --git a/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_p.c b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_p.c new file mode 100644 index 000000000000..d2c8ef20eafa --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/arm64/elevation_service_idl_p.c @@ -0,0 +1,1100 @@ + + +/* this ALWAYS GENERATED file contains the proxy stub code */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=ARM64 8.01.0628 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if defined(_M_ARM64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ +#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ + +#define USE_STUBLESS_PROXY + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REDQ_RPCPROXY_H_VERSION__ +#define __REQUIRED_RPCPROXY_H_VERSION__ 475 +#endif + + +#include "rpcproxy.h" +#ifndef __RPCPROXY_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCPROXY_H_VERSION__ */ + + +#include "elevation_service_idl.h" + +#define TYPE_FORMAT_STRING_SIZE 69 +#define PROC_FORMAT_STRING_SIZE 229 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 1 + +typedef struct _elevation_service_idl_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_TYPE_FORMAT_STRING; + +typedef struct _elevation_service_idl_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_PROC_FORMAT_STRING; + +typedef struct _elevation_service_idl_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax_2_0 = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define XFG_TRAMPOLINES(ObjectType)\ +NDR_SHAREABLE unsigned long ObjectType ## _UserSize_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\ +{\ +return ObjectType ## _UserSize(pFlags, Offset, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserMarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserMarshal(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserUnmarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserUnmarshal(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE void ObjectType ## _UserFree_XFG(unsigned long * pFlags, void * pObject)\ +{\ +ObjectType ## _UserFree(pFlags, (ObjectType *)pObject);\ +} +#define XFG_TRAMPOLINES64(ObjectType)\ +NDR_SHAREABLE unsigned long ObjectType ## _UserSize64_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\ +{\ +return ObjectType ## _UserSize64(pFlags, Offset, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserMarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserMarshal64(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserUnmarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserUnmarshal64(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE void ObjectType ## _UserFree64_XFG(unsigned long * pFlags, void * pObject)\ +{\ +ObjectType ## _UserFree64(pFlags, (ObjectType *)pObject);\ +} +#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType)\ +static void* ObjectType ## _bind_XFG(HandleType pObject)\ +{\ +return ObjectType ## _bind((ObjectType) pObject);\ +}\ +static void ObjectType ## _unbind_XFG(HandleType pObject, handle_t ServerHandle)\ +{\ +ObjectType ## _unbind((ObjectType) pObject, ServerHandle);\ +} +#define XFG_TRAMPOLINE_FPTR(Function) Function ## _XFG +#define XFG_TRAMPOLINE_FPTR_DEPENDENT_SYMBOL(Symbol) Symbol ## _XFG +#else +#define XFG_TRAMPOLINES(ObjectType) +#define XFG_TRAMPOLINES64(ObjectType) +#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType) +#define XFG_TRAMPOLINE_FPTR(Function) Function +#define XFG_TRAMPOLINE_FPTR_DEPENDENT_SYMBOL(Symbol) Symbol +#endif + + +extern const elevation_service_idl_MIDL_TYPE_FORMAT_STRING elevation_service_idl__MIDL_TypeFormatString; +extern const elevation_service_idl_MIDL_PROC_FORMAT_STRING elevation_service_idl__MIDL_ProcFormatString; +extern const elevation_service_idl_MIDL_EXPR_FORMAT_STRING elevation_service_idl__MIDL_ExprFormatString; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevator_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromium_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromium_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChrome_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChrome_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeBeta_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeBeta_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeDev_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeDev_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeCanary_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeCanary_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorDevelopment_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorDevelopment_ProxyInfo; + + +extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ]; + +#if !defined(__RPC_ARM64__) +#error Invalid build platform for this stub. +#endif + +static const elevation_service_idl_MIDL_PROC_FORMAT_STRING elevation_service_idl__MIDL_ProcFormatString = + { + 0, + { + + /* Procedure RunRecoveryCRXElevated */ + + 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 2 */ NdrFcLong( 0x0 ), /* 0 */ +/* 6 */ NdrFcShort( 0x3 ), /* 3 */ +/* 8 */ NdrFcShort( 0x40 ), /* ARM64 Stack size/offset = 64 */ +/* 10 */ NdrFcShort( 0x8 ), /* 8 */ +/* 12 */ NdrFcShort( 0x24 ), /* 36 */ +/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ + 0x7, /* 7 */ +/* 16 */ 0x12, /* 18 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 18 */ NdrFcShort( 0x0 ), /* 0 */ +/* 20 */ NdrFcShort( 0x0 ), /* 0 */ +/* 22 */ NdrFcShort( 0x0 ), /* 0 */ +/* 24 */ NdrFcShort( 0x7 ), /* 7 */ +/* 26 */ 0x7, /* 7 */ + 0x80, /* 128 */ +/* 28 */ 0x81, /* 129 */ + 0x82, /* 130 */ +/* 30 */ 0x83, /* 131 */ + 0x84, /* 132 */ +/* 32 */ 0x85, /* 133 */ + 0x86, /* 134 */ + + /* Parameter crx_path */ + +/* 34 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 36 */ NdrFcShort( 0x8 ), /* ARM64 Stack size/offset = 8 */ +/* 38 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter browser_appid */ + +/* 40 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 42 */ NdrFcShort( 0x10 ), /* ARM64 Stack size/offset = 16 */ +/* 44 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter browser_version */ + +/* 46 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 48 */ NdrFcShort( 0x18 ), /* ARM64 Stack size/offset = 24 */ +/* 50 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter session_id */ + +/* 52 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 54 */ NdrFcShort( 0x20 ), /* ARM64 Stack size/offset = 32 */ +/* 56 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter caller_proc_id */ + +/* 58 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 60 */ NdrFcShort( 0x28 ), /* ARM64 Stack size/offset = 40 */ +/* 62 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Parameter proc_handle */ + +/* 64 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 66 */ NdrFcShort( 0x30 ), /* ARM64 Stack size/offset = 48 */ +/* 68 */ 0xb9, /* FC_UINT3264 */ + 0x0, /* 0 */ + + /* Return value */ + +/* 70 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 72 */ NdrFcShort( 0x38 ), /* ARM64 Stack size/offset = 56 */ +/* 74 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure EncryptData */ + +/* 76 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 78 */ NdrFcLong( 0x0 ), /* 0 */ +/* 82 */ NdrFcShort( 0x4 ), /* 4 */ +/* 84 */ NdrFcShort( 0x30 ), /* ARM64 Stack size/offset = 48 */ +/* 86 */ NdrFcShort( 0x6 ), /* 6 */ +/* 88 */ NdrFcShort( 0x24 ), /* 36 */ +/* 90 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x5, /* 5 */ +/* 92 */ 0x10, /* 16 */ + 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ +/* 94 */ NdrFcShort( 0x1 ), /* 1 */ +/* 96 */ NdrFcShort( 0x1 ), /* 1 */ +/* 98 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ NdrFcShort( 0x5 ), /* 5 */ +/* 102 */ 0x5, /* 5 */ + 0x80, /* 128 */ +/* 104 */ 0x81, /* 129 */ + 0x82, /* 130 */ +/* 106 */ 0x83, /* 131 */ + 0x84, /* 132 */ + + /* Parameter protection_level */ + +/* 108 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 110 */ NdrFcShort( 0x8 ), /* ARM64 Stack size/offset = 8 */ +/* 112 */ 0xd, /* FC_ENUM16 */ + 0x0, /* 0 */ + + /* Parameter plaintext */ + +/* 114 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ +/* 116 */ NdrFcShort( 0x10 ), /* ARM64 Stack size/offset = 16 */ +/* 118 */ NdrFcShort( 0x24 ), /* Type Offset=36 */ + + /* Parameter ciphertext */ + +/* 120 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ +/* 122 */ NdrFcShort( 0x18 ), /* ARM64 Stack size/offset = 24 */ +/* 124 */ NdrFcShort( 0x36 ), /* Type Offset=54 */ + + /* Parameter last_error */ + +/* 126 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 128 */ NdrFcShort( 0x20 ), /* ARM64 Stack size/offset = 32 */ +/* 130 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Return value */ + +/* 132 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 134 */ NdrFcShort( 0x28 ), /* ARM64 Stack size/offset = 40 */ +/* 136 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure DecryptData */ + +/* 138 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 140 */ NdrFcLong( 0x0 ), /* 0 */ +/* 144 */ NdrFcShort( 0x5 ), /* 5 */ +/* 146 */ NdrFcShort( 0x28 ), /* ARM64 Stack size/offset = 40 */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 150 */ NdrFcShort( 0x24 ), /* 36 */ +/* 152 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x4, /* 4 */ +/* 154 */ 0x10, /* 16 */ + 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ +/* 156 */ NdrFcShort( 0x1 ), /* 1 */ +/* 158 */ NdrFcShort( 0x1 ), /* 1 */ +/* 160 */ NdrFcShort( 0x0 ), /* 0 */ +/* 162 */ NdrFcShort( 0x4 ), /* 4 */ +/* 164 */ 0x4, /* 4 */ + 0x80, /* 128 */ +/* 166 */ 0x81, /* 129 */ + 0x82, /* 130 */ +/* 168 */ 0x83, /* 131 */ + 0x0, /* 0 */ + + /* Parameter ciphertext */ + +/* 170 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ +/* 172 */ NdrFcShort( 0x8 ), /* ARM64 Stack size/offset = 8 */ +/* 174 */ NdrFcShort( 0x24 ), /* Type Offset=36 */ + + /* Parameter plaintext */ + +/* 176 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ +/* 178 */ NdrFcShort( 0x10 ), /* ARM64 Stack size/offset = 16 */ +/* 180 */ NdrFcShort( 0x36 ), /* Type Offset=54 */ + + /* Parameter last_error */ + +/* 182 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 184 */ NdrFcShort( 0x18 ), /* ARM64 Stack size/offset = 24 */ +/* 186 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Return value */ + +/* 188 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 190 */ NdrFcShort( 0x20 ), /* ARM64 Stack size/offset = 32 */ +/* 192 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure InstallVPNServices */ + +/* 194 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 196 */ NdrFcLong( 0x0 ), /* 0 */ +/* 200 */ NdrFcShort( 0x6 ), /* 6 */ +/* 202 */ NdrFcShort( 0x10 ), /* ARM64 Stack size/offset = 16 */ +/* 204 */ NdrFcShort( 0x0 ), /* 0 */ +/* 206 */ NdrFcShort( 0x8 ), /* 8 */ +/* 208 */ 0x44, /* Oi2 Flags: has return, has ext, */ + 0x1, /* 1 */ +/* 210 */ 0xc, /* 12 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 212 */ NdrFcShort( 0x0 ), /* 0 */ +/* 214 */ NdrFcShort( 0x0 ), /* 0 */ +/* 216 */ NdrFcShort( 0x0 ), /* 0 */ +/* 218 */ NdrFcShort( 0x1 ), /* 1 */ +/* 220 */ 0x1, /* 1 */ + 0x80, /* 128 */ + + /* Return value */ + +/* 222 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 224 */ NdrFcShort( 0x8 ), /* ARM64 Stack size/offset = 8 */ +/* 226 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const elevation_service_idl_MIDL_TYPE_FORMAT_STRING elevation_service_idl__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 4 */ + 0x25, /* FC_C_WSTRING */ + 0x5c, /* FC_PAD */ +/* 6 */ + 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ +/* 8 */ 0xb9, /* FC_UINT3264 */ + 0x5c, /* FC_PAD */ +/* 10 */ + 0x12, 0x0, /* FC_UP */ +/* 12 */ NdrFcShort( 0xe ), /* Offset= 14 (26) */ +/* 14 */ + 0x1b, /* FC_CARRAY */ + 0x1, /* 1 */ +/* 16 */ NdrFcShort( 0x2 ), /* 2 */ +/* 18 */ 0x9, /* Corr desc: FC_ULONG */ + 0x0, /* */ +/* 20 */ NdrFcShort( 0xfffc ), /* -4 */ +/* 22 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ +/* 24 */ 0x6, /* FC_SHORT */ + 0x5b, /* FC_END */ +/* 26 */ + 0x17, /* FC_CSTRUCT */ + 0x3, /* 3 */ +/* 28 */ NdrFcShort( 0x8 ), /* 8 */ +/* 30 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (14) */ +/* 32 */ 0x8, /* FC_LONG */ + 0x8, /* FC_LONG */ +/* 34 */ 0x5c, /* FC_PAD */ + 0x5b, /* FC_END */ +/* 36 */ 0xb4, /* FC_USER_MARSHAL */ + 0x83, /* 131 */ +/* 38 */ NdrFcShort( 0x0 ), /* 0 */ +/* 40 */ NdrFcShort( 0x8 ), /* 8 */ +/* 42 */ NdrFcShort( 0x0 ), /* 0 */ +/* 44 */ NdrFcShort( 0xffde ), /* Offset= -34 (10) */ +/* 46 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 48 */ NdrFcShort( 0x6 ), /* Offset= 6 (54) */ +/* 50 */ + 0x13, 0x0, /* FC_OP */ +/* 52 */ NdrFcShort( 0xffe6 ), /* Offset= -26 (26) */ +/* 54 */ 0xb4, /* FC_USER_MARSHAL */ + 0x83, /* 131 */ +/* 56 */ NdrFcShort( 0x0 ), /* 0 */ +/* 58 */ NdrFcShort( 0x8 ), /* 8 */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (50) */ +/* 64 */ + 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ +/* 66 */ 0x8, /* FC_LONG */ + 0x5c, /* FC_PAD */ + + 0x0 + } + }; + +XFG_TRAMPOLINES(BSTR) + +static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] = + { + + { + (USER_MARSHAL_SIZING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserSize) + ,(USER_MARSHAL_MARSHALLING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserMarshal) + ,(USER_MARSHAL_UNMARSHALLING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserUnmarshal) + ,(USER_MARSHAL_FREEING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserFree) + + } + + + }; + + + +/* Standard interface: __MIDL_itf_elevation_service_idl_0000_0000, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ + + +/* Object interface: IUnknown, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ + + +/* Object interface: IElevator, ver. 0.0, + GUID={0x5A9A9462,0x2FA1,0x4FEB,{0xB7,0xF2,0xDF,0x3D,0x19,0x13,0x44,0x63}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevator_FormatStringOffsetTable[] = + { + 0, + 76, + 138, + 194 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevator_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevator_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevator_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorProxyVtbl = +{ + &IElevator_ProxyInfo, + &IID_IElevator, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + (void *) (INT_PTR) -1 /* IElevator::RunRecoveryCRXElevated */ , + (void *) (INT_PTR) -1 /* IElevator::EncryptData */ , + (void *) (INT_PTR) -1 /* IElevator::DecryptData */ , + (void *) (INT_PTR) -1 /* IElevator::InstallVPNServices */ +}; + +const CInterfaceStubVtbl _IElevatorStubVtbl = +{ + &IID_IElevator, + &IElevator_ServerInfo, + 7, + 0, /* pure interpreted */ + CStdStubBuffer_METHODS +}; + + +/* Object interface: IElevatorChromium, ver. 0.0, + GUID={0x3218DA17,0x49C2,0x479A,{0x82,0x90,0x31,0x1D,0xBF,0xB8,0x64,0x90}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromium_FormatStringOffsetTable[] = + { + 0, + 76, + 138, + 194, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromium_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromium_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromium_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromium_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromiumProxyVtbl = +{ + 0, + &IID_IElevatorChromium, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromium_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromiumStubVtbl = +{ + &IID_IElevatorChromium, + &IElevatorChromium_ServerInfo, + 7, + &IElevatorChromium_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChrome, ver. 0.0, + GUID={0xF396861E,0x0C8E,0x4C71,{0x82,0x56,0x2F,0xAE,0x6D,0x75,0x9C,0xE9}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChrome_FormatStringOffsetTable[] = + { + 0, + 76, + 138, + 194, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChrome_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChrome_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChrome_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChrome_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeProxyVtbl = +{ + 0, + &IID_IElevatorChrome, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChrome_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeStubVtbl = +{ + &IID_IElevatorChrome, + &IElevatorChrome_ServerInfo, + 7, + &IElevatorChrome_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeBeta, ver. 0.0, + GUID={0x9EBAD7AC,0x6E1E,0x4A1C,{0xAA,0x85,0x1A,0x70,0xCA,0xDA,0x8D,0x82}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeBeta_FormatStringOffsetTable[] = + { + 0, + 76, + 138, + 194, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeBeta_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeBeta_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeBeta_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeBeta_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeBetaProxyVtbl = +{ + 0, + &IID_IElevatorChromeBeta, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeBeta_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeBetaStubVtbl = +{ + &IID_IElevatorChromeBeta, + &IElevatorChromeBeta_ServerInfo, + 7, + &IElevatorChromeBeta_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeDev, ver. 0.0, + GUID={0x1E43C77B,0x48E6,0x4A4C,{0x9D,0xB2,0xC2,0x97,0x17,0x06,0xC2,0x55}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeDev_FormatStringOffsetTable[] = + { + 0, + 76, + 138, + 194, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeDev_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeDev_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeDev_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeDev_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeDevProxyVtbl = +{ + 0, + &IID_IElevatorChromeDev, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeDev_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeDevStubVtbl = +{ + &IID_IElevatorChromeDev, + &IElevatorChromeDev_ServerInfo, + 7, + &IElevatorChromeDev_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeCanary, ver. 0.0, + GUID={0x1DB2116F,0x71B7,0x49F0,{0x89,0x70,0x33,0xB1,0xDA,0xCF,0xB0,0x72}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeCanary_FormatStringOffsetTable[] = + { + 0, + 76, + 138, + 194, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeCanary_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeCanary_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeCanary_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeCanary_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeCanaryProxyVtbl = +{ + 0, + &IID_IElevatorChromeCanary, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeCanary_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeCanaryStubVtbl = +{ + &IID_IElevatorChromeCanary, + &IElevatorChromeCanary_ServerInfo, + 7, + &IElevatorChromeCanary_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorDevelopment, ver. 0.0, + GUID={0x17239BF1,0xA1DC,0x4642,{0x84,0x6C,0x1B,0xAC,0x85,0xF9,0x6A,0x10}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorDevelopment_FormatStringOffsetTable[] = + { + 0, + 76, + 138, + 194, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorDevelopment_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorDevelopment_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorDevelopment_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorDevelopment_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorDevelopmentProxyVtbl = +{ + 0, + &IID_IElevatorDevelopment, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorDevelopment_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorDevelopmentStubVtbl = +{ + &IID_IElevatorDevelopment, + &IElevatorDevelopment_ServerInfo, + 7, + &IElevatorDevelopment_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + +#ifdef __cplusplus +namespace { +#endif +static const MIDL_STUB_DESC Object_StubDesc = + { + 0, + NdrOleAllocate, + NdrOleFree, + 0, + 0, + 0, + 0, + 0, + elevation_service_idl__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x8010274, /* MIDL Version 8.1.628 */ + 0, + UserMarshalRoutines, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; +#ifdef __cplusplus +} +#endif + +const CInterfaceProxyVtbl * const _elevation_service_idl_ProxyVtblList[] = +{ + ( CInterfaceProxyVtbl *) &_IElevatorChromiumProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeCanaryProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeDevProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeBetaProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorDevelopmentProxyVtbl, + 0 +}; + +const CInterfaceStubVtbl * const _elevation_service_idl_StubVtblList[] = +{ + ( CInterfaceStubVtbl *) &_IElevatorChromiumStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeCanaryStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeDevStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeBetaStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorDevelopmentStubVtbl, + 0 +}; + +PCInterfaceName const _elevation_service_idl_InterfaceNamesList[] = +{ + "IElevatorChromium", + "IElevatorChrome", + "IElevator", + "IElevatorChromeCanary", + "IElevatorChromeDev", + "IElevatorChromeBeta", + "IElevatorDevelopment", + 0 +}; + +const IID * const _elevation_service_idl_BaseIIDList[] = +{ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + 0, + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + 0 +}; + + +#define _elevation_service_idl_CHECK_IID(n) IID_GENERIC_CHECK_IID( _elevation_service_idl, pIID, n) + +int __stdcall _elevation_service_idl_IID_Lookup( const IID * pIID, int * pIndex ) +{ + IID_BS_LOOKUP_SETUP + + IID_BS_LOOKUP_INITIAL_TEST( _elevation_service_idl, 7, 4 ) + IID_BS_LOOKUP_NEXT_TEST( _elevation_service_idl, 2 ) + IID_BS_LOOKUP_NEXT_TEST( _elevation_service_idl, 1 ) + IID_BS_LOOKUP_RETURN_RESULT( _elevation_service_idl, 7, *pIndex ) + +} + +EXTERN_C const ExtendedProxyFileInfo elevation_service_idl_ProxyFileInfo = +{ + (PCInterfaceProxyVtblList *) & _elevation_service_idl_ProxyVtblList, + (PCInterfaceStubVtblList *) & _elevation_service_idl_StubVtblList, + (const PCInterfaceName * ) & _elevation_service_idl_InterfaceNamesList, + (const IID ** ) & _elevation_service_idl_BaseIIDList, + & _elevation_service_idl_IID_Lookup, + 7, + 2, + 0, /* table of [async_uuid] interfaces */ + 0, /* Filler1 */ + 0, /* Filler2 */ + 0 /* Filler3 */ +}; +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* defined(_M_ARM64) */ + diff --git a/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.dlldata.c b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.dlldata.c new file mode 100644 index 000000000000..6eda5609d245 --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.dlldata.c @@ -0,0 +1,38 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + +#define PROXY_DELEGATION + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( elevation_service_idl ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( elevation_service_idl ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h new file mode 100644 index 000000000000..94cef34235e9 --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.h @@ -0,0 +1,1036 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.xx.xxxx + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __elevation_service_idl_h__ +#define __elevation_service_idl_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#ifndef DECLSPEC_XFGVIRT +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) +#else +#define DECLSPEC_XFGVIRT(base, func) +#endif +#endif + +/* Forward Declarations */ + +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; + +#endif /* __IElevator_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromium_FWD_DEFINED__ +#define __IElevatorChromium_FWD_DEFINED__ +typedef interface IElevatorChromium IElevatorChromium; + +#endif /* __IElevatorChromium_FWD_DEFINED__ */ + + +#ifndef __IElevatorChrome_FWD_DEFINED__ +#define __IElevatorChrome_FWD_DEFINED__ +typedef interface IElevatorChrome IElevatorChrome; + +#endif /* __IElevatorChrome_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_FWD_DEFINED__ +#define __IElevatorChromeBeta_FWD_DEFINED__ +typedef interface IElevatorChromeBeta IElevatorChromeBeta; + +#endif /* __IElevatorChromeBeta_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_FWD_DEFINED__ +#define __IElevatorChromeDev_FWD_DEFINED__ +typedef interface IElevatorChromeDev IElevatorChromeDev; + +#endif /* __IElevatorChromeDev_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_FWD_DEFINED__ +#define __IElevatorChromeCanary_FWD_DEFINED__ +typedef interface IElevatorChromeCanary IElevatorChromeCanary; + +#endif /* __IElevatorChromeCanary_FWD_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_FWD_DEFINED__ +#define __IElevatorDevelopment_FWD_DEFINED__ +typedef interface IElevatorDevelopment IElevatorDevelopment; + +#endif /* __IElevatorDevelopment_FWD_DEFINED__ */ + + +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; + +#endif /* __IElevator_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromium_FWD_DEFINED__ +#define __IElevatorChromium_FWD_DEFINED__ +typedef interface IElevatorChromium IElevatorChromium; + +#endif /* __IElevatorChromium_FWD_DEFINED__ */ + + +#ifndef __IElevatorChrome_FWD_DEFINED__ +#define __IElevatorChrome_FWD_DEFINED__ +typedef interface IElevatorChrome IElevatorChrome; + +#endif /* __IElevatorChrome_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_FWD_DEFINED__ +#define __IElevatorChromeBeta_FWD_DEFINED__ +typedef interface IElevatorChromeBeta IElevatorChromeBeta; + +#endif /* __IElevatorChromeBeta_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_FWD_DEFINED__ +#define __IElevatorChromeDev_FWD_DEFINED__ +typedef interface IElevatorChromeDev IElevatorChromeDev; + +#endif /* __IElevatorChromeDev_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_FWD_DEFINED__ +#define __IElevatorChromeCanary_FWD_DEFINED__ +typedef interface IElevatorChromeCanary IElevatorChromeCanary; + +#endif /* __IElevatorChromeCanary_FWD_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_FWD_DEFINED__ +#define __IElevatorDevelopment_FWD_DEFINED__ +typedef interface IElevatorDevelopment IElevatorDevelopment; + +#endif /* __IElevatorDevelopment_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_elevation_service_idl_0000_0000 */ +/* [local] */ + +typedef +enum ProtectionLevel + { + NONE = 0, + PATH_VALIDATION = 1 + } ProtectionLevel; + + + +extern RPC_IF_HANDLE __MIDL_itf_elevation_service_idl_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_elevation_service_idl_0000_0000_v0_0_s_ifspec; + +#ifndef __IElevator_INTERFACE_DEFINED__ +#define __IElevator_INTERFACE_DEFINED__ + +/* interface IElevator */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5A9A9462-2FA1-4FEB-B7F2-DF3D19134463") + IElevator : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE RunRecoveryCRXElevated( + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle) = 0; + + virtual HRESULT STDMETHODCALLTYPE EncryptData( + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error) = 0; + + virtual HRESULT STDMETHODCALLTYPE DecryptData( + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error) = 0; + + virtual HRESULT STDMETHODCALLTYPE InstallVPNServices( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IElevatorVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevator * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevator * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevator * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevator * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevator * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevator * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevator * This); + + END_INTERFACE + } IElevatorVtbl; + + interface IElevator + { + CONST_VTBL struct IElevatorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevator_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevator_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevator_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevator_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevator_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromium_INTERFACE_DEFINED__ +#define __IElevatorChromium_INTERFACE_DEFINED__ + +/* interface IElevatorChromium */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromium; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3218DA17-49C2-479A-8290-311DBFB86490") + IElevatorChromium : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromiumVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromium * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromium * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromium * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromium * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromium * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromium * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromium * This); + + END_INTERFACE + } IElevatorChromiumVtbl; + + interface IElevatorChromium + { + CONST_VTBL struct IElevatorChromiumVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromium_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromium_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromium_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromium_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromium_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromium_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromium_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromium_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChrome_INTERFACE_DEFINED__ +#define __IElevatorChrome_INTERFACE_DEFINED__ + +/* interface IElevatorChrome */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChrome; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F396861E-0C8E-4C71-8256-2FAE6D759CE9") + IElevatorChrome : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChrome * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChrome * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChrome * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChrome * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChrome * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChrome * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChrome * This); + + END_INTERFACE + } IElevatorChromeVtbl; + + interface IElevatorChrome + { + CONST_VTBL struct IElevatorChromeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChrome_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChrome_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChrome_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChrome_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChrome_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChrome_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChrome_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChrome_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_INTERFACE_DEFINED__ +#define __IElevatorChromeBeta_INTERFACE_DEFINED__ + +/* interface IElevatorChromeBeta */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeBeta; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EBAD7AC-6E1E-4A1C-AA85-1A70CADA8D82") + IElevatorChromeBeta : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeBetaVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeBeta * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeBeta * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeBeta * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeBeta * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeBeta * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeBeta * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeBeta * This); + + END_INTERFACE + } IElevatorChromeBetaVtbl; + + interface IElevatorChromeBeta + { + CONST_VTBL struct IElevatorChromeBetaVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeBeta_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeBeta_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeBeta_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeBeta_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeBeta_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeBeta_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeBeta_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeBeta_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_INTERFACE_DEFINED__ +#define __IElevatorChromeDev_INTERFACE_DEFINED__ + +/* interface IElevatorChromeDev */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeDev; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1E43C77B-48E6-4A4C-9DB2-C2971706C255") + IElevatorChromeDev : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeDevVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeDev * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeDev * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeDev * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeDev * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeDev * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeDev * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeDev * This); + + END_INTERFACE + } IElevatorChromeDevVtbl; + + interface IElevatorChromeDev + { + CONST_VTBL struct IElevatorChromeDevVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeDev_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeDev_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeDev_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeDev_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeDev_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeDev_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeDev_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeDev_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_INTERFACE_DEFINED__ +#define __IElevatorChromeCanary_INTERFACE_DEFINED__ + +/* interface IElevatorChromeCanary */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeCanary; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1DB2116F-71B7-49F0-8970-33B1DACFB072") + IElevatorChromeCanary : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeCanaryVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeCanary * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeCanary * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeCanary * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeCanary * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeCanary * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeCanary * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeCanary * This); + + END_INTERFACE + } IElevatorChromeCanaryVtbl; + + interface IElevatorChromeCanary + { + CONST_VTBL struct IElevatorChromeCanaryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeCanary_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeCanary_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeCanary_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeCanary_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeCanary_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeCanary_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeCanary_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeCanary_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_INTERFACE_DEFINED__ +#define __IElevatorDevelopment_INTERFACE_DEFINED__ + +/* interface IElevatorDevelopment */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorDevelopment; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("17239BF1-A1DC-4642-846C-1BAC85F96A10") + IElevatorDevelopment : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorDevelopmentVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorDevelopment * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorDevelopment * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorDevelopment * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorDevelopment * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorDevelopment * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorDevelopment * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorDevelopment * This); + + END_INTERFACE + } IElevatorDevelopmentVtbl; + + interface IElevatorDevelopment + { + CONST_VTBL struct IElevatorDevelopmentVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorDevelopment_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorDevelopment_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorDevelopment_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorDevelopment_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorDevelopment_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorDevelopment_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorDevelopment_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorDevelopment_INTERFACE_DEFINED__ */ + + + +#ifndef __ElevatorLib_LIBRARY_DEFINED__ +#define __ElevatorLib_LIBRARY_DEFINED__ + +/* library ElevatorLib */ +/* [helpstring][version][uuid] */ + + + + + + + + + +EXTERN_C const IID LIBID_ElevatorLib; +#endif /* __ElevatorLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); +unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); +unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); +void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.tlb b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl.tlb new file mode 100644 index 0000000000000000000000000000000000000000..7a7256c3ffdda7a42cb99e685f04774103848afa GIT binary patch literal 3768 zcmbtXeQZ-z6hGYtbQ>_B<6~nR&rA(}m{C6d=pVz3wTu0Hr0VfxJAVIm}D5GS6zB1ufwNhE+@}j7dh&(k{&OG~+YO z7-Rg0ad#2Xc}As}sGsSBJi?}e_0G>HT4?zIJ&*j%Q7t`4S^O%G)__xAu0&M~O%36U{L<>?9@avmP z3XbtJtT={Z#lSg`@aP!x3XX9L4mn1n6(cSK@c8H$^9zpQM4cF4v|@}E9AiPjF%&Dt zek;aA!7-c#$M9G&KDJ_9EHDQ0MJ)lhY;(}PHX1o#&%w_J!*j?`U%ay?EIHOG?I)Sn zRx|O<#eYTn>z|hzmv%d+?ps1}Zs@oDJAPXF$qdn*p~madCNu{>JO{t;oue-tTX(bL z%wLx`SGjy44w;JYE=d;(YhY-x%9f`1Ihmfdpsa{p+gf?IZ`}Lb+fCO`Uwf({DA%)c zX4Qr%|IuxuW9w_bJ{ulGZ+Ejz-D~gt{no-gfzh6IUkvOWzm9$no0FH$eN-2%+5Xv~ z>iC73H%D;?fWPlMZ{4-l!1fPMPrbi#{?snq3$5%Yw)AxEnLW4sZ^SpAn)zYEz+D0T z+aJ`g{PkFK%Rznh$wPNvUV{4rd_K&n=7)X7o&b>BI!c(~m@YOnn0lY8s?aSI!qyt0 z4}TcPtr2qx*k?JB_1(MD; z9$|k9>$okyjg~&{jigoQv(}i;9%skS$C;eYv&M2-9NnsmLCuUAfk>aqYAL%?&%3Yq zrGU>%IK$t6X;+}5eOs`zyNmf!e+At+*0nd+FoIe<9%1#&*{q` z?&3x)^pLEaHvExd_G{6wF4So&rwUK>`A#Edijc|f0%B0;8Ci+@tIh2l?OQXt?i;?& zE#0lbo-F~tZ%enoqdilDa?xb?zyrrNAA_4nlZxh(a&^FqSEu_FBu)S7J4i`Afjd!$-}9v zZ*VK!BXObd`88neqKt*&=fWB*5=BPsZCy!E9bS^#Oj({ zc{)?OidvV|v1OW7sig-8@E%t4i2beQf3rB3)#Pk)k~3LNt|k|`l1_S-xn4tPrU)y2 zBTAd!7f`G>Nbxib5A$z$SkX*HQw$N-LePuH_z)_QsA5J2M41aactGV^MvELyRYh+H zU|-Qod?_k@M+JD!p8}~no{z<0=-gwvm$8bfl05K#fbrC~6h1-L(ESJ4Th>j@leRhT z70E|`!yGxGXJYPToMq%A#`mKm<6ohJ?B78p%wNKYJ1ed4OeU>4azI~&t-^?&jd>$K z-n|N$e_<{QY0Nein@_usC literal 0 HcmV?d00001 diff --git a/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c new file mode 100644 index 000000000000..fa4ccbd86a2b --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_i.c @@ -0,0 +1,100 @@ + + +/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ + +/* link this file in with the server and any clients */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.xx.xxxx + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +#ifdef __cplusplus +extern "C"{ +#endif + + +#include +#include + +#ifdef _MIDL_USE_GUIDDEF_ + +#ifndef INITGUID +#define INITGUID +#include +#undef INITGUID +#else +#include +#endif + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#else // !_MIDL_USE_GUIDDEF_ + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} + +#endif // !_MIDL_USE_GUIDDEF_ + +MIDL_DEFINE_GUID(IID, IID_IElevator,0x5A9A9462,0x2FA1,0x4FEB,0xB7,0xF2,0xDF,0x3D,0x19,0x13,0x44,0x63); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromium,0x3218DA17,0x49C2,0x479A,0x82,0x90,0x31,0x1D,0xBF,0xB8,0x64,0x90); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChrome,0xF396861E,0x0C8E,0x4C71,0x82,0x56,0x2F,0xAE,0x6D,0x75,0x9C,0xE9); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeBeta,0x9EBAD7AC,0x6E1E,0x4A1C,0xAA,0x85,0x1A,0x70,0xCA,0xDA,0x8D,0x82); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeDev,0x1E43C77B,0x48E6,0x4A4C,0x9D,0xB2,0xC2,0x97,0x17,0x06,0xC2,0x55); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeCanary,0x1DB2116F,0x71B7,0x49F0,0x89,0x70,0x33,0xB1,0xDA,0xCF,0xB0,0x72); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorDevelopment,0x17239BF1,0xA1DC,0x4642,0x84,0x6C,0x1B,0xAC,0x85,0xF9,0x6A,0x10); + + +MIDL_DEFINE_GUID(IID, LIBID_ElevatorLib,0xC3B01C4D,0xFBD4,0x4E65,0x88,0xAD,0x09,0x72,0xD7,0x58,0x08,0xC2); + +#undef MIDL_DEFINE_GUID + +#ifdef __cplusplus +} +#endif + + + diff --git a/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c new file mode 100644 index 000000000000..47e85ec2e72d --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/x64/elevation_service_idl_p.c @@ -0,0 +1,1078 @@ + + +/* this ALWAYS GENERATED file contains the proxy stub code */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.xx.xxxx + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if defined(_M_AMD64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ +#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ + +#define USE_STUBLESS_PROXY + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REDQ_RPCPROXY_H_VERSION__ +#define __REQUIRED_RPCPROXY_H_VERSION__ 475 +#endif + + +#include "rpcproxy.h" +#ifndef __RPCPROXY_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCPROXY_H_VERSION__ */ + + +#include "elevation_service_idl.h" + +#define TYPE_FORMAT_STRING_SIZE 69 +#define PROC_FORMAT_STRING_SIZE 207 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 1 + +typedef struct _elevation_service_idl_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_TYPE_FORMAT_STRING; + +typedef struct _elevation_service_idl_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_PROC_FORMAT_STRING; + +typedef struct _elevation_service_idl_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax_2_0 = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define XFG_TRAMPOLINES(ObjectType)\ +NDR_SHAREABLE unsigned long ObjectType ## _UserSize_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\ +{\ +return ObjectType ## _UserSize(pFlags, Offset, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserMarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserMarshal(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserUnmarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserUnmarshal(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE void ObjectType ## _UserFree_XFG(unsigned long * pFlags, void * pObject)\ +{\ +ObjectType ## _UserFree(pFlags, (ObjectType *)pObject);\ +} +#define XFG_TRAMPOLINES64(ObjectType)\ +NDR_SHAREABLE unsigned long ObjectType ## _UserSize64_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\ +{\ +return ObjectType ## _UserSize64(pFlags, Offset, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserMarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserMarshal64(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserUnmarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserUnmarshal64(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE void ObjectType ## _UserFree64_XFG(unsigned long * pFlags, void * pObject)\ +{\ +ObjectType ## _UserFree64(pFlags, (ObjectType *)pObject);\ +} +#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType)\ +static void* ObjectType ## _bind_XFG(HandleType pObject)\ +{\ +return ObjectType ## _bind((ObjectType) pObject);\ +}\ +static void ObjectType ## _unbind_XFG(HandleType pObject, handle_t ServerHandle)\ +{\ +ObjectType ## _unbind((ObjectType) pObject, ServerHandle);\ +} +#define XFG_TRAMPOLINE_FPTR(Function) Function ## _XFG +#define XFG_TRAMPOLINE_FPTR_DEPENDENT_SYMBOL(Symbol) Symbol ## _XFG +#else +#define XFG_TRAMPOLINES(ObjectType) +#define XFG_TRAMPOLINES64(ObjectType) +#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType) +#define XFG_TRAMPOLINE_FPTR(Function) Function +#define XFG_TRAMPOLINE_FPTR_DEPENDENT_SYMBOL(Symbol) Symbol +#endif + + +extern const elevation_service_idl_MIDL_TYPE_FORMAT_STRING elevation_service_idl__MIDL_TypeFormatString; +extern const elevation_service_idl_MIDL_PROC_FORMAT_STRING elevation_service_idl__MIDL_ProcFormatString; +extern const elevation_service_idl_MIDL_EXPR_FORMAT_STRING elevation_service_idl__MIDL_ExprFormatString; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevator_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromium_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromium_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChrome_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChrome_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeBeta_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeBeta_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeDev_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeDev_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeCanary_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeCanary_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorDevelopment_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorDevelopment_ProxyInfo; + + +extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ]; + +#if !defined(__RPC_WIN64__) +#error Invalid build platform for this stub. +#endif + +static const elevation_service_idl_MIDL_PROC_FORMAT_STRING elevation_service_idl__MIDL_ProcFormatString = + { + 0, + { + + /* Procedure RunRecoveryCRXElevated */ + + 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 2 */ NdrFcLong( 0x0 ), /* 0 */ +/* 6 */ NdrFcShort( 0x3 ), /* 3 */ +/* 8 */ NdrFcShort( 0x40 ), /* X64 Stack size/offset = 64 */ +/* 10 */ NdrFcShort( 0x8 ), /* 8 */ +/* 12 */ NdrFcShort( 0x24 ), /* 36 */ +/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ + 0x7, /* 7 */ +/* 16 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 18 */ NdrFcShort( 0x0 ), /* 0 */ +/* 20 */ NdrFcShort( 0x0 ), /* 0 */ +/* 22 */ NdrFcShort( 0x0 ), /* 0 */ +/* 24 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter crx_path */ + +/* 26 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 28 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 30 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter browser_appid */ + +/* 32 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 34 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 36 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter browser_version */ + +/* 38 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 40 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 42 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter session_id */ + +/* 44 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 46 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 48 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter caller_proc_id */ + +/* 50 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 52 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ +/* 54 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Parameter proc_handle */ + +/* 56 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 58 */ NdrFcShort( 0x30 ), /* X64 Stack size/offset = 48 */ +/* 60 */ 0xb9, /* FC_UINT3264 */ + 0x0, /* 0 */ + + /* Return value */ + +/* 62 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 64 */ NdrFcShort( 0x38 ), /* X64 Stack size/offset = 56 */ +/* 66 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure EncryptData */ + +/* 68 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 70 */ NdrFcLong( 0x0 ), /* 0 */ +/* 74 */ NdrFcShort( 0x4 ), /* 4 */ +/* 76 */ NdrFcShort( 0x30 ), /* X64 Stack size/offset = 48 */ +/* 78 */ NdrFcShort( 0x6 ), /* 6 */ +/* 80 */ NdrFcShort( 0x24 ), /* 36 */ +/* 82 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x5, /* 5 */ +/* 84 */ 0xa, /* 10 */ + 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ +/* 86 */ NdrFcShort( 0x1 ), /* 1 */ +/* 88 */ NdrFcShort( 0x1 ), /* 1 */ +/* 90 */ NdrFcShort( 0x0 ), /* 0 */ +/* 92 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter protection_level */ + +/* 94 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 96 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 98 */ 0xd, /* FC_ENUM16 */ + 0x0, /* 0 */ + + /* Parameter plaintext */ + +/* 100 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ +/* 102 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 104 */ NdrFcShort( 0x24 ), /* Type Offset=36 */ + + /* Parameter ciphertext */ + +/* 106 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ +/* 108 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 110 */ NdrFcShort( 0x36 ), /* Type Offset=54 */ + + /* Parameter last_error */ + +/* 112 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 114 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 116 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Return value */ + +/* 118 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 120 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ +/* 122 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure DecryptData */ + +/* 124 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 126 */ NdrFcLong( 0x0 ), /* 0 */ +/* 130 */ NdrFcShort( 0x5 ), /* 5 */ +/* 132 */ NdrFcShort( 0x28 ), /* X64 Stack size/offset = 40 */ +/* 134 */ NdrFcShort( 0x0 ), /* 0 */ +/* 136 */ NdrFcShort( 0x24 ), /* 36 */ +/* 138 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x4, /* 4 */ +/* 140 */ 0xa, /* 10 */ + 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ +/* 142 */ NdrFcShort( 0x1 ), /* 1 */ +/* 144 */ NdrFcShort( 0x1 ), /* 1 */ +/* 146 */ NdrFcShort( 0x0 ), /* 0 */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter ciphertext */ + +/* 150 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ +/* 152 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 154 */ NdrFcShort( 0x24 ), /* Type Offset=36 */ + + /* Parameter plaintext */ + +/* 156 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ +/* 158 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 160 */ NdrFcShort( 0x36 ), /* Type Offset=54 */ + + /* Parameter last_error */ + +/* 162 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 164 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 166 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Return value */ + +/* 168 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 170 */ NdrFcShort( 0x20 ), /* X64 Stack size/offset = 32 */ +/* 172 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure InstallVPNServices */ + +/* 174 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 176 */ NdrFcLong( 0x0 ), /* 0 */ +/* 180 */ NdrFcShort( 0x6 ), /* 6 */ +/* 182 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 184 */ NdrFcShort( 0x0 ), /* 0 */ +/* 186 */ NdrFcShort( 0x8 ), /* 8 */ +/* 188 */ 0x44, /* Oi2 Flags: has return, has ext, */ + 0x1, /* 1 */ +/* 190 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 192 */ NdrFcShort( 0x0 ), /* 0 */ +/* 194 */ NdrFcShort( 0x0 ), /* 0 */ +/* 196 */ NdrFcShort( 0x0 ), /* 0 */ +/* 198 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Return value */ + +/* 200 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 202 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 204 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const elevation_service_idl_MIDL_TYPE_FORMAT_STRING elevation_service_idl__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 4 */ + 0x25, /* FC_C_WSTRING */ + 0x5c, /* FC_PAD */ +/* 6 */ + 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ +/* 8 */ 0xb9, /* FC_UINT3264 */ + 0x5c, /* FC_PAD */ +/* 10 */ + 0x12, 0x0, /* FC_UP */ +/* 12 */ NdrFcShort( 0xe ), /* Offset= 14 (26) */ +/* 14 */ + 0x1b, /* FC_CARRAY */ + 0x1, /* 1 */ +/* 16 */ NdrFcShort( 0x2 ), /* 2 */ +/* 18 */ 0x9, /* Corr desc: FC_ULONG */ + 0x0, /* */ +/* 20 */ NdrFcShort( 0xfffc ), /* -4 */ +/* 22 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ +/* 24 */ 0x6, /* FC_SHORT */ + 0x5b, /* FC_END */ +/* 26 */ + 0x17, /* FC_CSTRUCT */ + 0x3, /* 3 */ +/* 28 */ NdrFcShort( 0x8 ), /* 8 */ +/* 30 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (14) */ +/* 32 */ 0x8, /* FC_LONG */ + 0x8, /* FC_LONG */ +/* 34 */ 0x5c, /* FC_PAD */ + 0x5b, /* FC_END */ +/* 36 */ 0xb4, /* FC_USER_MARSHAL */ + 0x83, /* 131 */ +/* 38 */ NdrFcShort( 0x0 ), /* 0 */ +/* 40 */ NdrFcShort( 0x8 ), /* 8 */ +/* 42 */ NdrFcShort( 0x0 ), /* 0 */ +/* 44 */ NdrFcShort( 0xffde ), /* Offset= -34 (10) */ +/* 46 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 48 */ NdrFcShort( 0x6 ), /* Offset= 6 (54) */ +/* 50 */ + 0x13, 0x0, /* FC_OP */ +/* 52 */ NdrFcShort( 0xffe6 ), /* Offset= -26 (26) */ +/* 54 */ 0xb4, /* FC_USER_MARSHAL */ + 0x83, /* 131 */ +/* 56 */ NdrFcShort( 0x0 ), /* 0 */ +/* 58 */ NdrFcShort( 0x8 ), /* 8 */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (50) */ +/* 64 */ + 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ +/* 66 */ 0x8, /* FC_LONG */ + 0x5c, /* FC_PAD */ + + 0x0 + } + }; + +XFG_TRAMPOLINES(BSTR) + +static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] = + { + + { + (USER_MARSHAL_SIZING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserSize) + ,(USER_MARSHAL_MARSHALLING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserMarshal) + ,(USER_MARSHAL_UNMARSHALLING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserUnmarshal) + ,(USER_MARSHAL_FREEING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserFree) + + } + + + }; + + + +/* Standard interface: __MIDL_itf_elevation_service_idl_0000_0000, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ + + +/* Object interface: IUnknown, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ + + +/* Object interface: IElevator, ver. 0.0, + GUID={0x5A9A9462,0x2FA1,0x4FEB,{0xB7,0xF2,0xDF,0x3D,0x19,0x13,0x44,0x63}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevator_FormatStringOffsetTable[] = + { + 0, + 68, + 124, + 174 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevator_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevator_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevator_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorProxyVtbl = +{ + &IElevator_ProxyInfo, + &IID_IElevator, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + (void *) (INT_PTR) -1 /* IElevator::RunRecoveryCRXElevated */ , + (void *) (INT_PTR) -1 /* IElevator::EncryptData */ , + (void *) (INT_PTR) -1 /* IElevator::DecryptData */ , + (void *) (INT_PTR) -1 /* IElevator::InstallVPNServices */ +}; + +const CInterfaceStubVtbl _IElevatorStubVtbl = +{ + &IID_IElevator, + &IElevator_ServerInfo, + 7, + 0, /* pure interpreted */ + CStdStubBuffer_METHODS +}; + + +/* Object interface: IElevatorChromium, ver. 0.0, + GUID={0x3218DA17,0x49C2,0x479A,{0x82,0x90,0x31,0x1D,0xBF,0xB8,0x64,0x90}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromium_FormatStringOffsetTable[] = + { + 0, + 68, + 124, + 174, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromium_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromium_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromium_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromium_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromiumProxyVtbl = +{ + 0, + &IID_IElevatorChromium, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromium_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromiumStubVtbl = +{ + &IID_IElevatorChromium, + &IElevatorChromium_ServerInfo, + 7, + &IElevatorChromium_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChrome, ver. 0.0, + GUID={0xF396861E,0x0C8E,0x4C71,{0x82,0x56,0x2F,0xAE,0x6D,0x75,0x9C,0xE9}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChrome_FormatStringOffsetTable[] = + { + 0, + 68, + 124, + 174, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChrome_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChrome_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChrome_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChrome_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeProxyVtbl = +{ + 0, + &IID_IElevatorChrome, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChrome_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeStubVtbl = +{ + &IID_IElevatorChrome, + &IElevatorChrome_ServerInfo, + 7, + &IElevatorChrome_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeBeta, ver. 0.0, + GUID={0x9EBAD7AC,0x6E1E,0x4A1C,{0xAA,0x85,0x1A,0x70,0xCA,0xDA,0x8D,0x82}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeBeta_FormatStringOffsetTable[] = + { + 0, + 68, + 124, + 174, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeBeta_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeBeta_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeBeta_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeBeta_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeBetaProxyVtbl = +{ + 0, + &IID_IElevatorChromeBeta, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeBeta_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeBetaStubVtbl = +{ + &IID_IElevatorChromeBeta, + &IElevatorChromeBeta_ServerInfo, + 7, + &IElevatorChromeBeta_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeDev, ver. 0.0, + GUID={0x1E43C77B,0x48E6,0x4A4C,{0x9D,0xB2,0xC2,0x97,0x17,0x06,0xC2,0x55}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeDev_FormatStringOffsetTable[] = + { + 0, + 68, + 124, + 174, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeDev_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeDev_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeDev_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeDev_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeDevProxyVtbl = +{ + 0, + &IID_IElevatorChromeDev, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeDev_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeDevStubVtbl = +{ + &IID_IElevatorChromeDev, + &IElevatorChromeDev_ServerInfo, + 7, + &IElevatorChromeDev_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeCanary, ver. 0.0, + GUID={0x1DB2116F,0x71B7,0x49F0,{0x89,0x70,0x33,0xB1,0xDA,0xCF,0xB0,0x72}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeCanary_FormatStringOffsetTable[] = + { + 0, + 68, + 124, + 174, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeCanary_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeCanary_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeCanary_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeCanary_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeCanaryProxyVtbl = +{ + 0, + &IID_IElevatorChromeCanary, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeCanary_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeCanaryStubVtbl = +{ + &IID_IElevatorChromeCanary, + &IElevatorChromeCanary_ServerInfo, + 7, + &IElevatorChromeCanary_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorDevelopment, ver. 0.0, + GUID={0x17239BF1,0xA1DC,0x4642,{0x84,0x6C,0x1B,0xAC,0x85,0xF9,0x6A,0x10}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorDevelopment_FormatStringOffsetTable[] = + { + 0, + 68, + 124, + 174, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorDevelopment_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorDevelopment_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorDevelopment_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorDevelopment_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorDevelopmentProxyVtbl = +{ + 0, + &IID_IElevatorDevelopment, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorDevelopment_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorDevelopmentStubVtbl = +{ + &IID_IElevatorDevelopment, + &IElevatorDevelopment_ServerInfo, + 7, + &IElevatorDevelopment_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + +#ifdef __cplusplus +namespace { +#endif +static const MIDL_STUB_DESC Object_StubDesc = + { + 0, + NdrOleAllocate, + NdrOleFree, + 0, + 0, + 0, + 0, + 0, + elevation_service_idl__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x8010274, /* MIDL Version 8.1.628 */ + 0, + UserMarshalRoutines, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; +#ifdef __cplusplus +} +#endif + +const CInterfaceProxyVtbl * const _elevation_service_idl_ProxyVtblList[] = +{ + ( CInterfaceProxyVtbl *) &_IElevatorChromiumProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeCanaryProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeDevProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeBetaProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorDevelopmentProxyVtbl, + 0 +}; + +const CInterfaceStubVtbl * const _elevation_service_idl_StubVtblList[] = +{ + ( CInterfaceStubVtbl *) &_IElevatorChromiumStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeCanaryStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeDevStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeBetaStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorDevelopmentStubVtbl, + 0 +}; + +PCInterfaceName const _elevation_service_idl_InterfaceNamesList[] = +{ + "IElevatorChromium", + "IElevatorChrome", + "IElevator", + "IElevatorChromeCanary", + "IElevatorChromeDev", + "IElevatorChromeBeta", + "IElevatorDevelopment", + 0 +}; + +const IID * const _elevation_service_idl_BaseIIDList[] = +{ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + 0, + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + 0 +}; + + +#define _elevation_service_idl_CHECK_IID(n) IID_GENERIC_CHECK_IID( _elevation_service_idl, pIID, n) + +int __stdcall _elevation_service_idl_IID_Lookup( const IID * pIID, int * pIndex ) +{ + IID_BS_LOOKUP_SETUP + + IID_BS_LOOKUP_INITIAL_TEST( _elevation_service_idl, 7, 4 ) + IID_BS_LOOKUP_NEXT_TEST( _elevation_service_idl, 2 ) + IID_BS_LOOKUP_NEXT_TEST( _elevation_service_idl, 1 ) + IID_BS_LOOKUP_RETURN_RESULT( _elevation_service_idl, 7, *pIndex ) + +} + +EXTERN_C const ExtendedProxyFileInfo elevation_service_idl_ProxyFileInfo = +{ + (PCInterfaceProxyVtblList *) & _elevation_service_idl_ProxyVtblList, + (PCInterfaceStubVtblList *) & _elevation_service_idl_StubVtblList, + (const PCInterfaceName * ) & _elevation_service_idl_InterfaceNamesList, + (const IID ** ) & _elevation_service_idl_BaseIIDList, + & _elevation_service_idl_IID_Lookup, + 7, + 2, + 0, /* table of [async_uuid] interfaces */ + 0, /* Filler1 */ + 0, /* Filler2 */ + 0 /* Filler3 */ +}; +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* defined(_M_AMD64)*/ + diff --git a/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.dlldata.c b/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.dlldata.c new file mode 100644 index 000000000000..6eda5609d245 --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.dlldata.c @@ -0,0 +1,38 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + +#define PROXY_DELEGATION + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( elevation_service_idl ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( elevation_service_idl ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h b/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h new file mode 100644 index 000000000000..6820cc028bb9 --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.h @@ -0,0 +1,1036 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.xx.xxxx + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __elevation_service_idl_h__ +#define __elevation_service_idl_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#ifndef DECLSPEC_XFGVIRT +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) +#else +#define DECLSPEC_XFGVIRT(base, func) +#endif +#endif + +/* Forward Declarations */ + +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; + +#endif /* __IElevator_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromium_FWD_DEFINED__ +#define __IElevatorChromium_FWD_DEFINED__ +typedef interface IElevatorChromium IElevatorChromium; + +#endif /* __IElevatorChromium_FWD_DEFINED__ */ + + +#ifndef __IElevatorChrome_FWD_DEFINED__ +#define __IElevatorChrome_FWD_DEFINED__ +typedef interface IElevatorChrome IElevatorChrome; + +#endif /* __IElevatorChrome_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_FWD_DEFINED__ +#define __IElevatorChromeBeta_FWD_DEFINED__ +typedef interface IElevatorChromeBeta IElevatorChromeBeta; + +#endif /* __IElevatorChromeBeta_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_FWD_DEFINED__ +#define __IElevatorChromeDev_FWD_DEFINED__ +typedef interface IElevatorChromeDev IElevatorChromeDev; + +#endif /* __IElevatorChromeDev_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_FWD_DEFINED__ +#define __IElevatorChromeCanary_FWD_DEFINED__ +typedef interface IElevatorChromeCanary IElevatorChromeCanary; + +#endif /* __IElevatorChromeCanary_FWD_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_FWD_DEFINED__ +#define __IElevatorDevelopment_FWD_DEFINED__ +typedef interface IElevatorDevelopment IElevatorDevelopment; + +#endif /* __IElevatorDevelopment_FWD_DEFINED__ */ + + +#ifndef __IElevator_FWD_DEFINED__ +#define __IElevator_FWD_DEFINED__ +typedef interface IElevator IElevator; + +#endif /* __IElevator_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromium_FWD_DEFINED__ +#define __IElevatorChromium_FWD_DEFINED__ +typedef interface IElevatorChromium IElevatorChromium; + +#endif /* __IElevatorChromium_FWD_DEFINED__ */ + + +#ifndef __IElevatorChrome_FWD_DEFINED__ +#define __IElevatorChrome_FWD_DEFINED__ +typedef interface IElevatorChrome IElevatorChrome; + +#endif /* __IElevatorChrome_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_FWD_DEFINED__ +#define __IElevatorChromeBeta_FWD_DEFINED__ +typedef interface IElevatorChromeBeta IElevatorChromeBeta; + +#endif /* __IElevatorChromeBeta_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_FWD_DEFINED__ +#define __IElevatorChromeDev_FWD_DEFINED__ +typedef interface IElevatorChromeDev IElevatorChromeDev; + +#endif /* __IElevatorChromeDev_FWD_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_FWD_DEFINED__ +#define __IElevatorChromeCanary_FWD_DEFINED__ +typedef interface IElevatorChromeCanary IElevatorChromeCanary; + +#endif /* __IElevatorChromeCanary_FWD_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_FWD_DEFINED__ +#define __IElevatorDevelopment_FWD_DEFINED__ +typedef interface IElevatorDevelopment IElevatorDevelopment; + +#endif /* __IElevatorDevelopment_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_elevation_service_idl_0000_0000 */ +/* [local] */ + +typedef +enum ProtectionLevel + { + NONE = 0, + PATH_VALIDATION = 1 + } ProtectionLevel; + + + +extern RPC_IF_HANDLE __MIDL_itf_elevation_service_idl_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_elevation_service_idl_0000_0000_v0_0_s_ifspec; + +#ifndef __IElevator_INTERFACE_DEFINED__ +#define __IElevator_INTERFACE_DEFINED__ + +/* interface IElevator */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5A9A9462-2FA1-4FEB-B7F2-DF3D19134463") + IElevator : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE RunRecoveryCRXElevated( + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle) = 0; + + virtual HRESULT STDMETHODCALLTYPE EncryptData( + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error) = 0; + + virtual HRESULT STDMETHODCALLTYPE DecryptData( + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error) = 0; + + virtual HRESULT STDMETHODCALLTYPE InstallVPNServices( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IElevatorVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevator * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevator * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevator * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevator * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevator * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevator * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevator * This); + + END_INTERFACE + } IElevatorVtbl; + + interface IElevator + { + CONST_VTBL struct IElevatorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevator_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevator_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevator_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevator_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevator_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromium_INTERFACE_DEFINED__ +#define __IElevatorChromium_INTERFACE_DEFINED__ + +/* interface IElevatorChromium */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromium; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3218DA17-49C2-479A-8290-311DBFB86490") + IElevatorChromium : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromiumVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromium * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromium * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromium * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromium * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromium * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromium * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromium * This); + + END_INTERFACE + } IElevatorChromiumVtbl; + + interface IElevatorChromium + { + CONST_VTBL struct IElevatorChromiumVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromium_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromium_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromium_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromium_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromium_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromium_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromium_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromium_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChrome_INTERFACE_DEFINED__ +#define __IElevatorChrome_INTERFACE_DEFINED__ + +/* interface IElevatorChrome */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChrome; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F396861E-0C8E-4C71-8256-2FAE6D759CE9") + IElevatorChrome : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChrome * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChrome * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChrome * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChrome * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChrome * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChrome * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChrome * This); + + END_INTERFACE + } IElevatorChromeVtbl; + + interface IElevatorChrome + { + CONST_VTBL struct IElevatorChromeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChrome_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChrome_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChrome_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChrome_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChrome_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChrome_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChrome_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChrome_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeBeta_INTERFACE_DEFINED__ +#define __IElevatorChromeBeta_INTERFACE_DEFINED__ + +/* interface IElevatorChromeBeta */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeBeta; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9EBAD7AC-6E1E-4A1C-AA85-1A70CADA8D82") + IElevatorChromeBeta : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeBetaVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeBeta * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeBeta * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeBeta * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeBeta * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeBeta * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeBeta * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeBeta * This); + + END_INTERFACE + } IElevatorChromeBetaVtbl; + + interface IElevatorChromeBeta + { + CONST_VTBL struct IElevatorChromeBetaVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeBeta_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeBeta_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeBeta_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeBeta_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeBeta_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeBeta_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeBeta_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeBeta_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeDev_INTERFACE_DEFINED__ +#define __IElevatorChromeDev_INTERFACE_DEFINED__ + +/* interface IElevatorChromeDev */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeDev; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1E43C77B-48E6-4A4C-9DB2-C2971706C255") + IElevatorChromeDev : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeDevVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeDev * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeDev * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeDev * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeDev * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeDev * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeDev * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeDev * This); + + END_INTERFACE + } IElevatorChromeDevVtbl; + + interface IElevatorChromeDev + { + CONST_VTBL struct IElevatorChromeDevVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeDev_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeDev_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeDev_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeDev_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeDev_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeDev_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeDev_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeDev_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorChromeCanary_INTERFACE_DEFINED__ +#define __IElevatorChromeCanary_INTERFACE_DEFINED__ + +/* interface IElevatorChromeCanary */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorChromeCanary; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1DB2116F-71B7-49F0-8970-33B1DACFB072") + IElevatorChromeCanary : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorChromeCanaryVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorChromeCanary * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorChromeCanary * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorChromeCanary * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorChromeCanary * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorChromeCanary * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorChromeCanary * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorChromeCanary * This); + + END_INTERFACE + } IElevatorChromeCanaryVtbl; + + interface IElevatorChromeCanary + { + CONST_VTBL struct IElevatorChromeCanaryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorChromeCanary_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorChromeCanary_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorChromeCanary_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorChromeCanary_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorChromeCanary_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorChromeCanary_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorChromeCanary_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorChromeCanary_INTERFACE_DEFINED__ */ + + +#ifndef __IElevatorDevelopment_INTERFACE_DEFINED__ +#define __IElevatorDevelopment_INTERFACE_DEFINED__ + +/* interface IElevatorDevelopment */ +/* [unique][helpstring][uuid][oleautomation][object] */ + + +EXTERN_C const IID IID_IElevatorDevelopment; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("17239BF1-A1DC-4642-846C-1BAC85F96A10") + IElevatorDevelopment : public IElevator + { + public: + }; + + +#else /* C style interface */ + + typedef struct IElevatorDevelopmentVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IElevatorDevelopment * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IElevatorDevelopment * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IElevatorDevelopment * This); + + DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated) + HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )( + IElevatorDevelopment * This, + /* [string][in] */ const WCHAR *crx_path, + /* [string][in] */ const WCHAR *browser_appid, + /* [string][in] */ const WCHAR *browser_version, + /* [string][in] */ const WCHAR *session_id, + /* [in] */ DWORD caller_proc_id, + /* [out] */ ULONG_PTR *proc_handle); + + DECLSPEC_XFGVIRT(IElevator, EncryptData) + HRESULT ( STDMETHODCALLTYPE *EncryptData )( + IElevatorDevelopment * This, + /* [in] */ ProtectionLevel protection_level, + /* [in] */ const BSTR plaintext, + /* [out] */ BSTR *ciphertext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, DecryptData) + HRESULT ( STDMETHODCALLTYPE *DecryptData )( + IElevatorDevelopment * This, + /* [in] */ const BSTR ciphertext, + /* [out] */ BSTR *plaintext, + /* [out] */ DWORD *last_error); + + DECLSPEC_XFGVIRT(IElevator, InstallVPNServices) + HRESULT ( STDMETHODCALLTYPE *InstallVPNServices )( + IElevatorDevelopment * This); + + END_INTERFACE + } IElevatorDevelopmentVtbl; + + interface IElevatorDevelopment + { + CONST_VTBL struct IElevatorDevelopmentVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IElevatorDevelopment_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IElevatorDevelopment_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IElevatorDevelopment_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IElevatorDevelopment_RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) \ + ( (This)->lpVtbl -> RunRecoveryCRXElevated(This,crx_path,browser_appid,browser_version,session_id,caller_proc_id,proc_handle) ) + +#define IElevatorDevelopment_EncryptData(This,protection_level,plaintext,ciphertext,last_error) \ + ( (This)->lpVtbl -> EncryptData(This,protection_level,plaintext,ciphertext,last_error) ) + +#define IElevatorDevelopment_DecryptData(This,ciphertext,plaintext,last_error) \ + ( (This)->lpVtbl -> DecryptData(This,ciphertext,plaintext,last_error) ) + +#define IElevatorDevelopment_InstallVPNServices(This) \ + ( (This)->lpVtbl -> InstallVPNServices(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IElevatorDevelopment_INTERFACE_DEFINED__ */ + + + +#ifndef __ElevatorLib_LIBRARY_DEFINED__ +#define __ElevatorLib_LIBRARY_DEFINED__ + +/* library ElevatorLib */ +/* [helpstring][version][uuid] */ + + + + + + + + + +EXTERN_C const IID LIBID_ElevatorLib; +#endif /* __ElevatorLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); +unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); +unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); +void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.tlb b/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl.tlb new file mode 100644 index 0000000000000000000000000000000000000000..ace66065854c5fbf3f160c4cca06a433e7bf5077 GIT binary patch literal 3768 zcmbtXZERCj7(U$wbQ`e2CTwFH7p8_EI>yJ3{upLsWv*DZF~*9r07-G;2G=UHjmuceUkD8ERrV)M+BCsf^KOhqDdD?rrOWjBl-t@ia zyr0iG?>YCJ+ig3VJ9C6Xkn;1Ajc7!Z(mwt!FZ~><>QUByBhcFi_PhnYRWP6YPlsN~IlG%Tp4-hd*L`i~u5`DB) zIdfp3xEZ8!=5e4PCENSN$kf-Y&J|~}oX0qmF~0@Bk+Mb1t7=76j#!YiP+zk;FKdjS z83hc@!r(qo^l*%MS!3K}LSWQe7%>Ha_Td=wv&L|;PT&_UjFGG{7G#Z~Ss42)jIpdS zoLOVIER2sWj0;&}aK5Z1>87nux!Wdl4qS8UXQRP6Y^*Qe+2fX-<5cnE&~2+6`{u&G zvi0@P^NowUoD=sfqdYtC+rI5TE%{_hh}#48*Hlbk4t;PAea|~bUO2k;M%(GXE^R6= zaR&gI#IMUs6^dg3HCts%NqCN@dd(~=v8!52@AQl|J@&i7Dac)nGxEYLw<@#DP+~f24=$kDCtufM{`PhzH zE&GbN&Z<9K%Xe%x{iEonfyq73{rM<)W{bUyoQW**vcO|m_$iDZF=n0xN}jDfjC>k= z>a4u=mOt-}gjMG=Ry$if_l{l9Jvlkc7z@SX$d<6|*UhNm4fXiomW<1Hz59ws8L(f1 zY5l&7JH2hK&-&XtJD^wo%f#)Y9eW}jG7#;T#!yqou2irL&g?a(*w7U)2K_PJ>{Vl1 zB>wdF7}0^aH2iuj7J_?vZx)G>VP!+ocqkf4+X}?38*v$@&d(r~Z?U*k8_>gHq>CBR zzyr2IvHp*wvR97;!_qft&8f&0dA{9w$?3a-@5DW_QuW@ ze^;Z|<8JKqw6&&dP$I{3#b$M@wy-APg#t`s%o`o@qQrDNiquM#aBJ!W1H!WOO?34pYLG>TCQ&uzGk^ED}=MbDV&K4QPRL~Q>S&MP}5CK*9;ld1N4hUu?e+ML^DHuvY>=3xZj6bMsgfZpO0rd ziR;R<#GRB{1r&v@z@rJ=yMlxH@IAsC(yt?n*1-tzaT5cz585S_$K=aTc7ue z((`;{pL61w$-Waj4aOG3{pd*NFBS)o-;w-2FNTeGR?6R*NLYQ&f#)h?H89U?_UrLf z<17^>^5meh#BwI+k6-c|hIuk$%iyVE%fv>+GLq!zc7X9evO5>t0uA38p23%y5Y!Dm n4!#0j11<$G6S)aAA_uuZhf0BN*CF%}^bKemG(31ekQn +#include + +#ifdef _MIDL_USE_GUIDDEF_ + +#ifndef INITGUID +#define INITGUID +#include +#undef INITGUID +#else +#include +#endif + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#else // !_MIDL_USE_GUIDDEF_ + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} + +#endif // !_MIDL_USE_GUIDDEF_ + +MIDL_DEFINE_GUID(IID, IID_IElevator,0x5A9A9462,0x2FA1,0x4FEB,0xB7,0xF2,0xDF,0x3D,0x19,0x13,0x44,0x63); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromium,0x3218DA17,0x49C2,0x479A,0x82,0x90,0x31,0x1D,0xBF,0xB8,0x64,0x90); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChrome,0xF396861E,0x0C8E,0x4C71,0x82,0x56,0x2F,0xAE,0x6D,0x75,0x9C,0xE9); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeBeta,0x9EBAD7AC,0x6E1E,0x4A1C,0xAA,0x85,0x1A,0x70,0xCA,0xDA,0x8D,0x82); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeDev,0x1E43C77B,0x48E6,0x4A4C,0x9D,0xB2,0xC2,0x97,0x17,0x06,0xC2,0x55); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorChromeCanary,0x1DB2116F,0x71B7,0x49F0,0x89,0x70,0x33,0xB1,0xDA,0xCF,0xB0,0x72); + + +MIDL_DEFINE_GUID(IID, IID_IElevatorDevelopment,0x17239BF1,0xA1DC,0x4642,0x84,0x6C,0x1B,0xAC,0x85,0xF9,0x6A,0x10); + + +MIDL_DEFINE_GUID(IID, LIBID_ElevatorLib,0xC3B01C4D,0xFBD4,0x4E65,0x88,0xAD,0x09,0x72,0xD7,0x58,0x08,0xC2); + +#undef MIDL_DEFINE_GUID + +#ifdef __cplusplus +} +#endif + + + diff --git a/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c b/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c new file mode 100644 index 000000000000..0a92ab999306 --- /dev/null +++ b/win_build_output/midl/chrome/elevation_service/x86/elevation_service_idl_p.c @@ -0,0 +1,1081 @@ + + +/* this ALWAYS GENERATED file contains the proxy stub code */ + + + /* File created by MIDL compiler version 8.xx.xxxx */ +/* at a redacted point in time + */ +/* Compiler settings for ../../brave/chromium_src/chrome/elevation_service/elevation_service_idl.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.xx.xxxx + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ +#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ +#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */ + +#pragma optimize("", off ) + +#define USE_STUBLESS_PROXY + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REDQ_RPCPROXY_H_VERSION__ +#define __REQUIRED_RPCPROXY_H_VERSION__ 475 +#endif + + +#include "rpcproxy.h" +#ifndef __RPCPROXY_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCPROXY_H_VERSION__ */ + + +#include "elevation_service_idl.h" + +#define TYPE_FORMAT_STRING_SIZE 65 +#define PROC_FORMAT_STRING_SIZE 199 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 1 + +typedef struct _elevation_service_idl_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_TYPE_FORMAT_STRING; + +typedef struct _elevation_service_idl_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_PROC_FORMAT_STRING; + +typedef struct _elevation_service_idl_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } elevation_service_idl_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax_2_0 = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + +#if defined(_CONTROL_FLOW_GUARD_XFG) +#define XFG_TRAMPOLINES(ObjectType)\ +NDR_SHAREABLE unsigned long ObjectType ## _UserSize_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\ +{\ +return ObjectType ## _UserSize(pFlags, Offset, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserMarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserMarshal(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserUnmarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserUnmarshal(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE void ObjectType ## _UserFree_XFG(unsigned long * pFlags, void * pObject)\ +{\ +ObjectType ## _UserFree(pFlags, (ObjectType *)pObject);\ +} +#define XFG_TRAMPOLINES64(ObjectType)\ +NDR_SHAREABLE unsigned long ObjectType ## _UserSize64_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\ +{\ +return ObjectType ## _UserSize64(pFlags, Offset, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserMarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserMarshal64(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE unsigned char * ObjectType ## _UserUnmarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\ +{\ +return ObjectType ## _UserUnmarshal64(pFlags, pBuffer, (ObjectType *)pObject);\ +}\ +NDR_SHAREABLE void ObjectType ## _UserFree64_XFG(unsigned long * pFlags, void * pObject)\ +{\ +ObjectType ## _UserFree64(pFlags, (ObjectType *)pObject);\ +} +#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType)\ +static void* ObjectType ## _bind_XFG(HandleType pObject)\ +{\ +return ObjectType ## _bind((ObjectType) pObject);\ +}\ +static void ObjectType ## _unbind_XFG(HandleType pObject, handle_t ServerHandle)\ +{\ +ObjectType ## _unbind((ObjectType) pObject, ServerHandle);\ +} +#define XFG_TRAMPOLINE_FPTR(Function) Function ## _XFG +#define XFG_TRAMPOLINE_FPTR_DEPENDENT_SYMBOL(Symbol) Symbol ## _XFG +#else +#define XFG_TRAMPOLINES(ObjectType) +#define XFG_TRAMPOLINES64(ObjectType) +#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType) +#define XFG_TRAMPOLINE_FPTR(Function) Function +#define XFG_TRAMPOLINE_FPTR_DEPENDENT_SYMBOL(Symbol) Symbol +#endif + + +extern const elevation_service_idl_MIDL_TYPE_FORMAT_STRING elevation_service_idl__MIDL_TypeFormatString; +extern const elevation_service_idl_MIDL_PROC_FORMAT_STRING elevation_service_idl__MIDL_ProcFormatString; +extern const elevation_service_idl_MIDL_EXPR_FORMAT_STRING elevation_service_idl__MIDL_ExprFormatString; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevator_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromium_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromium_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChrome_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChrome_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeBeta_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeBeta_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeDev_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeDev_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorChromeCanary_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorChromeCanary_ProxyInfo; + +#ifdef __cplusplus +namespace { +#endif + +extern const MIDL_STUB_DESC Object_StubDesc; +#ifdef __cplusplus +} +#endif + + +extern const MIDL_SERVER_INFO IElevatorDevelopment_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IElevatorDevelopment_ProxyInfo; + + +extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ]; + +#if !defined(__RPC_WIN32__) +#error Invalid build platform for this stub. +#endif + +#if !(TARGET_IS_NT50_OR_LATER) +#error You need Windows 2000 or later to run this stub because it uses these features: +#error /robust command line switch. +#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems. +#error This app will fail with the RPC_X_WRONG_STUB_VERSION error. +#endif + + +static const elevation_service_idl_MIDL_PROC_FORMAT_STRING elevation_service_idl__MIDL_ProcFormatString = + { + 0, + { + + /* Procedure RunRecoveryCRXElevated */ + + 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 2 */ NdrFcLong( 0x0 ), /* 0 */ +/* 6 */ NdrFcShort( 0x3 ), /* 3 */ +/* 8 */ NdrFcShort( 0x20 ), /* x86 Stack size/offset = 32 */ +/* 10 */ NdrFcShort( 0x8 ), /* 8 */ +/* 12 */ NdrFcShort( 0x24 ), /* 36 */ +/* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ + 0x7, /* 7 */ +/* 16 */ 0x8, /* 8 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 18 */ NdrFcShort( 0x0 ), /* 0 */ +/* 20 */ NdrFcShort( 0x0 ), /* 0 */ +/* 22 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter crx_path */ + +/* 24 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 26 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 28 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter browser_appid */ + +/* 30 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 32 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 34 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter browser_version */ + +/* 36 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 38 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 40 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter session_id */ + +/* 42 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ +/* 44 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ +/* 46 */ NdrFcShort( 0x4 ), /* Type Offset=4 */ + + /* Parameter caller_proc_id */ + +/* 48 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 50 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ +/* 52 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Parameter proc_handle */ + +/* 54 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 56 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 58 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Return value */ + +/* 60 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 62 */ NdrFcShort( 0x1c ), /* x86 Stack size/offset = 28 */ +/* 64 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure EncryptData */ + +/* 66 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 68 */ NdrFcLong( 0x0 ), /* 0 */ +/* 72 */ NdrFcShort( 0x4 ), /* 4 */ +/* 74 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */ +/* 76 */ NdrFcShort( 0x6 ), /* 6 */ +/* 78 */ NdrFcShort( 0x24 ), /* 36 */ +/* 80 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x5, /* 5 */ +/* 82 */ 0x8, /* 8 */ + 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ +/* 84 */ NdrFcShort( 0x1 ), /* 1 */ +/* 86 */ NdrFcShort( 0x1 ), /* 1 */ +/* 88 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter protection_level */ + +/* 90 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 92 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 94 */ 0xd, /* FC_ENUM16 */ + 0x0, /* 0 */ + + /* Parameter plaintext */ + +/* 96 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ +/* 98 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 100 */ NdrFcShort( 0x24 ), /* Type Offset=36 */ + + /* Parameter ciphertext */ + +/* 102 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ +/* 104 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 106 */ NdrFcShort( 0x36 ), /* Type Offset=54 */ + + /* Parameter last_error */ + +/* 108 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 110 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ +/* 112 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Return value */ + +/* 114 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 116 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ +/* 118 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure DecryptData */ + +/* 120 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 122 */ NdrFcLong( 0x0 ), /* 0 */ +/* 126 */ NdrFcShort( 0x5 ), /* 5 */ +/* 128 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */ +/* 130 */ NdrFcShort( 0x0 ), /* 0 */ +/* 132 */ NdrFcShort( 0x24 ), /* 36 */ +/* 134 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ + 0x4, /* 4 */ +/* 136 */ 0x8, /* 8 */ + 0x7, /* Ext Flags: new corr desc, clt corr check, srv corr check, */ +/* 138 */ NdrFcShort( 0x1 ), /* 1 */ +/* 140 */ NdrFcShort( 0x1 ), /* 1 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter ciphertext */ + +/* 144 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ +/* 146 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 148 */ NdrFcShort( 0x24 ), /* Type Offset=36 */ + + /* Parameter plaintext */ + +/* 150 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ +/* 152 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 154 */ NdrFcShort( 0x36 ), /* Type Offset=54 */ + + /* Parameter last_error */ + +/* 156 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ +/* 158 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ +/* 160 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Return value */ + +/* 162 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 164 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ +/* 166 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + /* Procedure InstallVPNServices */ + +/* 168 */ 0x33, /* FC_AUTO_HANDLE */ + 0x6c, /* Old Flags: object, Oi2 */ +/* 170 */ NdrFcLong( 0x0 ), /* 0 */ +/* 174 */ NdrFcShort( 0x6 ), /* 6 */ +/* 176 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ +/* 178 */ NdrFcShort( 0x0 ), /* 0 */ +/* 180 */ NdrFcShort( 0x8 ), /* 8 */ +/* 182 */ 0x44, /* Oi2 Flags: has return, has ext, */ + 0x1, /* 1 */ +/* 184 */ 0x8, /* 8 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 186 */ NdrFcShort( 0x0 ), /* 0 */ +/* 188 */ NdrFcShort( 0x0 ), /* 0 */ +/* 190 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Return value */ + +/* 192 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ +/* 194 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ +/* 196 */ 0x8, /* FC_LONG */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const elevation_service_idl_MIDL_TYPE_FORMAT_STRING elevation_service_idl__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x8, /* FC_RP [simple_pointer] */ +/* 4 */ + 0x25, /* FC_C_WSTRING */ + 0x5c, /* FC_PAD */ +/* 6 */ + 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ +/* 8 */ 0x8, /* FC_LONG */ + 0x5c, /* FC_PAD */ +/* 10 */ + 0x12, 0x0, /* FC_UP */ +/* 12 */ NdrFcShort( 0xe ), /* Offset= 14 (26) */ +/* 14 */ + 0x1b, /* FC_CARRAY */ + 0x1, /* 1 */ +/* 16 */ NdrFcShort( 0x2 ), /* 2 */ +/* 18 */ 0x9, /* Corr desc: FC_ULONG */ + 0x0, /* */ +/* 20 */ NdrFcShort( 0xfffc ), /* -4 */ +/* 22 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ +/* 24 */ 0x6, /* FC_SHORT */ + 0x5b, /* FC_END */ +/* 26 */ + 0x17, /* FC_CSTRUCT */ + 0x3, /* 3 */ +/* 28 */ NdrFcShort( 0x8 ), /* 8 */ +/* 30 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (14) */ +/* 32 */ 0x8, /* FC_LONG */ + 0x8, /* FC_LONG */ +/* 34 */ 0x5c, /* FC_PAD */ + 0x5b, /* FC_END */ +/* 36 */ 0xb4, /* FC_USER_MARSHAL */ + 0x83, /* 131 */ +/* 38 */ NdrFcShort( 0x0 ), /* 0 */ +/* 40 */ NdrFcShort( 0x4 ), /* 4 */ +/* 42 */ NdrFcShort( 0x0 ), /* 0 */ +/* 44 */ NdrFcShort( 0xffde ), /* Offset= -34 (10) */ +/* 46 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 48 */ NdrFcShort( 0x6 ), /* Offset= 6 (54) */ +/* 50 */ + 0x13, 0x0, /* FC_OP */ +/* 52 */ NdrFcShort( 0xffe6 ), /* Offset= -26 (26) */ +/* 54 */ 0xb4, /* FC_USER_MARSHAL */ + 0x83, /* 131 */ +/* 56 */ NdrFcShort( 0x0 ), /* 0 */ +/* 58 */ NdrFcShort( 0x4 ), /* 4 */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (50) */ + + 0x0 + } + }; + +XFG_TRAMPOLINES(BSTR) + +static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] = + { + + { + (USER_MARSHAL_SIZING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserSize) + ,(USER_MARSHAL_MARSHALLING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserMarshal) + ,(USER_MARSHAL_UNMARSHALLING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserUnmarshal) + ,(USER_MARSHAL_FREEING_ROUTINE)XFG_TRAMPOLINE_FPTR(BSTR_UserFree) + + } + + + }; + + + +/* Standard interface: __MIDL_itf_elevation_service_idl_0000_0000, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ + + +/* Object interface: IUnknown, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ + + +/* Object interface: IElevator, ver. 0.0, + GUID={0x5A9A9462,0x2FA1,0x4FEB,{0xB7,0xF2,0xDF,0x3D,0x19,0x13,0x44,0x63}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevator_FormatStringOffsetTable[] = + { + 0, + 66, + 120, + 168 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevator_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevator_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevator_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevator_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorProxyVtbl = +{ + &IElevator_ProxyInfo, + &IID_IElevator, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + (void *) (INT_PTR) -1 /* IElevator::RunRecoveryCRXElevated */ , + (void *) (INT_PTR) -1 /* IElevator::EncryptData */ , + (void *) (INT_PTR) -1 /* IElevator::DecryptData */ , + (void *) (INT_PTR) -1 /* IElevator::InstallVPNServices */ +}; + +const CInterfaceStubVtbl _IElevatorStubVtbl = +{ + &IID_IElevator, + &IElevator_ServerInfo, + 7, + 0, /* pure interpreted */ + CStdStubBuffer_METHODS +}; + + +/* Object interface: IElevatorChromium, ver. 0.0, + GUID={0x3218DA17,0x49C2,0x479A,{0x82,0x90,0x31,0x1D,0xBF,0xB8,0x64,0x90}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromium_FormatStringOffsetTable[] = + { + 0, + 66, + 120, + 168, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromium_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromium_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromium_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromium_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromiumProxyVtbl = +{ + 0, + &IID_IElevatorChromium, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromium_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromiumStubVtbl = +{ + &IID_IElevatorChromium, + &IElevatorChromium_ServerInfo, + 7, + &IElevatorChromium_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChrome, ver. 0.0, + GUID={0xF396861E,0x0C8E,0x4C71,{0x82,0x56,0x2F,0xAE,0x6D,0x75,0x9C,0xE9}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChrome_FormatStringOffsetTable[] = + { + 0, + 66, + 120, + 168, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChrome_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChrome_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChrome_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChrome_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeProxyVtbl = +{ + 0, + &IID_IElevatorChrome, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChrome_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeStubVtbl = +{ + &IID_IElevatorChrome, + &IElevatorChrome_ServerInfo, + 7, + &IElevatorChrome_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeBeta, ver. 0.0, + GUID={0x9EBAD7AC,0x6E1E,0x4A1C,{0xAA,0x85,0x1A,0x70,0xCA,0xDA,0x8D,0x82}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeBeta_FormatStringOffsetTable[] = + { + 0, + 66, + 120, + 168, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeBeta_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeBeta_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeBeta_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeBeta_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeBetaProxyVtbl = +{ + 0, + &IID_IElevatorChromeBeta, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeBeta_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeBetaStubVtbl = +{ + &IID_IElevatorChromeBeta, + &IElevatorChromeBeta_ServerInfo, + 7, + &IElevatorChromeBeta_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeDev, ver. 0.0, + GUID={0x1E43C77B,0x48E6,0x4A4C,{0x9D,0xB2,0xC2,0x97,0x17,0x06,0xC2,0x55}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeDev_FormatStringOffsetTable[] = + { + 0, + 66, + 120, + 168, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeDev_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeDev_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeDev_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeDev_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeDevProxyVtbl = +{ + 0, + &IID_IElevatorChromeDev, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeDev_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeDevStubVtbl = +{ + &IID_IElevatorChromeDev, + &IElevatorChromeDev_ServerInfo, + 7, + &IElevatorChromeDev_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorChromeCanary, ver. 0.0, + GUID={0x1DB2116F,0x71B7,0x49F0,{0x89,0x70,0x33,0xB1,0xDA,0xCF,0xB0,0x72}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorChromeCanary_FormatStringOffsetTable[] = + { + 0, + 66, + 120, + 168, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorChromeCanary_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeCanary_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorChromeCanary_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorChromeCanary_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorChromeCanaryProxyVtbl = +{ + 0, + &IID_IElevatorChromeCanary, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorChromeCanary_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorChromeCanaryStubVtbl = +{ + &IID_IElevatorChromeCanary, + &IElevatorChromeCanary_ServerInfo, + 7, + &IElevatorChromeCanary_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + + +/* Object interface: IElevatorDevelopment, ver. 0.0, + GUID={0x17239BF1,0xA1DC,0x4642,{0x84,0x6C,0x1B,0xAC,0x85,0xF9,0x6A,0x10}} */ + +#pragma code_seg(".orpc") +static const unsigned short IElevatorDevelopment_FormatStringOffsetTable[] = + { + 0, + 66, + 120, + 168, + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IElevatorDevelopment_ProxyInfo = + { + &Object_StubDesc, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorDevelopment_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IElevatorDevelopment_ServerInfo = + { + &Object_StubDesc, + 0, + elevation_service_idl__MIDL_ProcFormatString.Format, + &IElevatorDevelopment_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(7) _IElevatorDevelopmentProxyVtbl = +{ + 0, + &IID_IElevatorDevelopment, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy , + 0 /* forced delegation IElevator::RunRecoveryCRXElevated */ , + 0 /* forced delegation IElevator::EncryptData */ , + 0 /* forced delegation IElevator::DecryptData */ , + 0 /* forced delegation IElevator::InstallVPNServices */ +}; + + +EXTERN_C DECLSPEC_SELECTANY const PRPC_STUB_FUNCTION IElevatorDevelopment_table[] = +{ + NdrStubCall2, + NdrStubCall2, + NdrStubCall2, + NdrStubCall2 +}; + +CInterfaceStubVtbl _IElevatorDevelopmentStubVtbl = +{ + &IID_IElevatorDevelopment, + &IElevatorDevelopment_ServerInfo, + 7, + &IElevatorDevelopment_table[-3], + CStdStubBuffer_DELEGATING_METHODS +}; + +#ifdef __cplusplus +namespace { +#endif +static const MIDL_STUB_DESC Object_StubDesc = + { + 0, + NdrOleAllocate, + NdrOleFree, + 0, + 0, + 0, + 0, + 0, + elevation_service_idl__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x8010274, /* MIDL Version 8.1.628 */ + 0, + UserMarshalRoutines, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; +#ifdef __cplusplus +} +#endif + +const CInterfaceProxyVtbl * const _elevation_service_idl_ProxyVtblList[] = +{ + ( CInterfaceProxyVtbl *) &_IElevatorChromiumProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeCanaryProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeDevProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorChromeBetaProxyVtbl, + ( CInterfaceProxyVtbl *) &_IElevatorDevelopmentProxyVtbl, + 0 +}; + +const CInterfaceStubVtbl * const _elevation_service_idl_StubVtblList[] = +{ + ( CInterfaceStubVtbl *) &_IElevatorChromiumStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeCanaryStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeDevStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorChromeBetaStubVtbl, + ( CInterfaceStubVtbl *) &_IElevatorDevelopmentStubVtbl, + 0 +}; + +PCInterfaceName const _elevation_service_idl_InterfaceNamesList[] = +{ + "IElevatorChromium", + "IElevatorChrome", + "IElevator", + "IElevatorChromeCanary", + "IElevatorChromeDev", + "IElevatorChromeBeta", + "IElevatorDevelopment", + 0 +}; + +const IID * const _elevation_service_idl_BaseIIDList[] = +{ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + 0, + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + &IID_IElevator, /* forced */ + 0 +}; + + +#define _elevation_service_idl_CHECK_IID(n) IID_GENERIC_CHECK_IID( _elevation_service_idl, pIID, n) + +int __stdcall _elevation_service_idl_IID_Lookup( const IID * pIID, int * pIndex ) +{ + IID_BS_LOOKUP_SETUP + + IID_BS_LOOKUP_INITIAL_TEST( _elevation_service_idl, 7, 4 ) + IID_BS_LOOKUP_NEXT_TEST( _elevation_service_idl, 2 ) + IID_BS_LOOKUP_NEXT_TEST( _elevation_service_idl, 1 ) + IID_BS_LOOKUP_RETURN_RESULT( _elevation_service_idl, 7, *pIndex ) + +} + +EXTERN_C const ExtendedProxyFileInfo elevation_service_idl_ProxyFileInfo = +{ + (PCInterfaceProxyVtblList *) & _elevation_service_idl_ProxyVtblList, + (PCInterfaceStubVtblList *) & _elevation_service_idl_StubVtblList, + (const PCInterfaceName * ) & _elevation_service_idl_InterfaceNamesList, + (const IID ** ) & _elevation_service_idl_BaseIIDList, + & _elevation_service_idl_IID_Lookup, + 7, + 2, + 0, /* table of [async_uuid] interfaces */ + 0, /* Filler1 */ + 0, /* Filler2 */ + 0 /* Filler3 */ +}; +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_) */ + From 20df120dfe12bd28510af1d67d0a011356a5f743 Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Mon, 29 Jan 2024 17:37:13 +0900 Subject: [PATCH 2/3] Merge pull request #21762 from brave/wg_default_prefs Updated Wireguard enabled state timing --- chromium_src/chrome/browser/prefs/browser_prefs.cc | 10 ---------- chromium_src/chrome/browser/prefs/sources.gni | 5 ----- .../browser/connection/brave_vpn_os_connection_api.cc | 5 +++++ components/brave_vpn/common/brave_vpn_utils.cc | 2 +- components/brave_vpn/common/brave_vpn_utils.h | 2 +- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/chromium_src/chrome/browser/prefs/browser_prefs.cc b/chromium_src/chrome/browser/prefs/browser_prefs.cc index ab7c07bdcc44..cfdff6f68de9 100644 --- a/chromium_src/chrome/browser/prefs/browser_prefs.cc +++ b/chromium_src/chrome/browser/prefs/browser_prefs.cc @@ -15,7 +15,6 @@ #include "brave/components/brave_news/browser/brave_news_p3a.h" #include "brave/components/brave_search_conversion/p3a.h" #include "brave/components/brave_sync/brave_sync_prefs.h" -#include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/components/brave_wallet/browser/brave_wallet_prefs.h" #include "brave/components/brave_wallet/browser/keyring_service.h" #include "brave/components/constants/pref_names.h" @@ -44,10 +43,6 @@ #include "brave/browser/widevine/widevine_utils.h" #endif -#if BUILDFLAG(ENABLE_BRAVE_VPN) && BUILDFLAG(IS_WIN) -#include "brave/components/brave_vpn/common/brave_vpn_utils.h" -#endif - #if !BUILDFLAG(ENABLE_EXTENSIONS) #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_ #endif // !BUILDFLAG(ENABLE_EXTENSIONS) @@ -250,11 +245,6 @@ void MigrateObsoleteLocalStatePrefs(PrefService* local_state) { decentralized_dns::MigrateObsoleteLocalStatePrefs(local_state); -#if BUILDFLAG(ENABLE_BRAVE_VPN) && BUILDFLAG(IS_WIN) - // Migrating the feature flag here because dependencies relying on its value. - brave_vpn::MigrateWireguardFeatureFlag(local_state); -#endif - #if !BUILDFLAG(IS_ANDROID) // Added 10/2022 local_state->ClearPref(kDefaultBrowserPromptEnabled); diff --git a/chromium_src/chrome/browser/prefs/sources.gni b/chromium_src/chrome/browser/prefs/sources.gni index afd9e6012ba9..f4339ef5cdfe 100644 --- a/chromium_src/chrome/browser/prefs/sources.gni +++ b/chromium_src/chrome/browser/prefs/sources.gni @@ -3,7 +3,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//components/gcm_driver/config.gni") import("//third_party/widevine/cdm/widevine.gni") @@ -21,10 +20,6 @@ if (enable_widevine) { brave_chromium_src_chrome_browser_prefs_deps += [ "//brave/browser/widevine" ] } -if (enable_brave_vpn) { - brave_chromium_src_chrome_browser_prefs_deps += - [ "//brave/components/brave_vpn/common" ] -} if (!use_gcm_from_platform) { brave_chromium_src_chrome_browser_prefs_deps += [ "//brave/browser/gcm_driver" ] diff --git a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc index 8300a9c22085..7e70f76b99ab 100644 --- a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc +++ b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc @@ -309,6 +309,11 @@ void BraveVPNOSConnectionAPI::MaybeInstallSystemServices() { void BraveVPNOSConnectionAPI::OnInstallSystemServicesCompleted(bool success) { VLOG(1) << "OnInstallSystemServicesCompleted: success=" << success; if (success) { +#if BUILDFLAG(IS_WIN) + // Update prefs first before signaling the event because the event could + // check the prefs. + UpdateWireguardEnabledPrefsIfNeeded(local_prefs_); +#endif system_service_installed_event_.Signal(); } install_in_progress_ = false; diff --git a/components/brave_vpn/common/brave_vpn_utils.cc b/components/brave_vpn/common/brave_vpn_utils.cc index 9b8d85a0389a..69a9f53cba74 100644 --- a/components/brave_vpn/common/brave_vpn_utils.cc +++ b/components/brave_vpn/common/brave_vpn_utils.cc @@ -66,7 +66,7 @@ bool IsBraveVPNWireguardEnabled(PrefService* local_state) { #endif } #if BUILDFLAG(IS_WIN) -void MigrateWireguardFeatureFlag(PrefService* local_prefs) { +void UpdateWireguardEnabledPrefsIfNeeded(PrefService* local_prefs) { auto* wireguard_enabled_pref = local_prefs->FindPreference(prefs::kBraveVPNWireguardEnabled); if (wireguard_enabled_pref && wireguard_enabled_pref->IsDefaultValue()) { diff --git a/components/brave_vpn/common/brave_vpn_utils.h b/components/brave_vpn/common/brave_vpn_utils.h index 6394c99420e0..4b8d511e7bca 100644 --- a/components/brave_vpn/common/brave_vpn_utils.h +++ b/components/brave_vpn/common/brave_vpn_utils.h @@ -38,7 +38,7 @@ bool HasValidSkusCredential(PrefService* local_prefs); std::string GetSkusCredential(PrefService* local_prefs); bool IsBraveVPNWireguardEnabled(PrefService* local_state); #if BUILDFLAG(IS_WIN) -void MigrateWireguardFeatureFlag(PrefService* local_prefs); +void UpdateWireguardEnabledPrefsIfNeeded(PrefService* local_prefs); #endif // BUILDFLAG(IS_WIN) } // namespace brave_vpn From 5a32f0a092786df4454bb0d4df21ec8a9cfa6c85 Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Thu, 8 Feb 2024 11:06:29 -0700 Subject: [PATCH 3/3] Merge pull request #21549 from brave/remove_install_static_deps_from_vpn_component Removed install_static deps from vpn component --- browser/brave_browser_process_impl.cc | 9 +- browser/brave_vpn/BUILD.gn | 25 +++++ .../brave_vpn/brave_vpn_service_factory.cc | 2 + browser/brave_vpn/dns/BUILD.gn | 1 - .../dns/brave_vpn_dns_observer_service_win.cc | 2 +- browser/brave_vpn/sources.gni | 16 ++-- browser/brave_vpn/vpn_utils.cc | 37 ++++++++ browser/brave_vpn/vpn_utils.h | 17 ++++ browser/brave_vpn/win/BUILD.gn | 57 ++++++++++- .../brave_vpn}/win/brave_vpn_helper/BUILD.gn | 10 +- .../brave_vpn}/win/brave_vpn_helper/DEPS | 0 .../brave_vpn_helper/brave_vpn_dns_delegate.h | 6 +- .../win/brave_vpn_helper/brave_vpn_helper.ver | 0 .../brave_vpn_helper_constants.h | 21 +++++ .../brave_vpn_helper_crash_reporter_client.cc | 6 +- .../brave_vpn_helper_crash_reporter_client.h | 6 +- .../brave_vpn_helper_utils.cc | 47 +++++++++- .../brave_vpn_helper/brave_vpn_helper_utils.h | 8 +- .../brave_vpn}/win/brave_vpn_helper/main.cc | 10 +- .../win/brave_vpn_helper/service_main.cc | 6 +- .../win/brave_vpn_helper/service_main.h | 10 +- .../win/brave_vpn_helper/vpn_dns_handler.cc | 14 +-- .../win/brave_vpn_helper/vpn_dns_handler.h | 6 +- .../vpn_dns_handler_unittest.cc | 6 +- .../win/brave_vpn_helper/vpn_utils.cc | 84 ++++++++++++++--- .../win/brave_vpn_helper/vpn_utils.h | 6 +- .../win/brave_vpn_service_delegate_win.cc | 26 +++++ .../win/brave_vpn_service_delegate_win.h | 28 ++++++ .../brave_vpn_wireguard_connection_api_win.cc | 43 ++++----- .../brave_vpn_wireguard_connection_api_win.h | 21 +++-- ...rave_vpn_wireguard_observer_service_win.cc | 2 +- .../win/brave_vpn_wireguard_service/BUILD.gn | 9 +- ...wireguard_service_crash_reporter_client.cc | 2 +- .../install_utils.cc | 12 +-- .../win/brave_vpn_wireguard_service/main.cc | 2 +- .../service/BUILD.gn | 4 +- .../service/wireguard_service_runner.cc | 4 +- .../service/wireguard_tunnel_service.cc | 8 +- .../status_tray/BUILD.gn | 6 +- .../status_tray/ras/BUILD.gn | 1 + .../status_tray/ras/ras_utils.cc | 2 + .../status_tray/status_tray_runner.cc | 8 +- .../status_tray_runner_unittest.cc | 2 +- .../brave_vpn}/win/service_commands.cc | 4 +- .../brave_vpn}/win/service_commands.h | 6 +- .../brave_vpn}/win/service_constants.h | 7 +- .../brave_vpn}/win/service_details.cc | 87 ++++++++++++----- .../brave_vpn}/win/service_details.h | 6 +- .../brave_vpn}/win/storage_utils.cc | 8 +- .../brave_vpn}/win/storage_utils.h | 7 +- .../brave_vpn}/win/storage_utils_unittest.cc | 8 +- .../brave_vpn}/win/wireguard_utils_win.cc | 6 +- .../brave_vpn}/win/wireguard_utils_win.h | 12 +-- browser/ui/BUILD.gn | 4 +- browser/ui/browser_commands.cc | 6 +- browser/ui/toolbar/brave_vpn_menu_model.cc | 2 +- .../settings/brave_vpn/brave_vpn_handler.cc | 9 +- build/win/BUILD.gn | 5 +- .../chrome/browser/prefs/browser_prefs.cc | 1 + chromium_src/chrome/elevation_service/DEPS | 3 +- .../chrome/elevation_service/elevator.cc | 9 +- chromium_src/chrome/installer/DEPS | 4 +- .../chrome/installer/setup/install_worker.cc | 19 ++-- .../chrome/installer/setup/sources.gni | 9 +- .../chrome/installer/setup/test/BUILD.gn | 3 +- .../setup/test/install_worker_vpn_unittest.cc | 29 +++--- .../chrome/installer/setup/uninstall.cc | 8 +- components/brave_vpn/browser/BUILD.gn | 9 +- components/brave_vpn/browser/api/BUILD.gn | 1 - .../brave_vpn/browser/brave_vpn_service.cc | 14 ++- .../brave_vpn/browser/brave_vpn_service.h | 9 ++ .../browser/brave_vpn_service_delegate.h | 27 ++++++ .../brave_vpn/browser/connection/BUILD.gn | 2 +- .../connection/brave_vpn_os_connection_api.cc | 34 +------ .../connection/brave_vpn_os_connection_api.h | 19 ++-- .../browser/connection/ikev2/BUILD.gn | 1 - .../brave_vpn_ras_connection_api_base.cc | 16 ++-- .../ikev2/brave_vpn_ras_connection_api_base.h | 6 +- .../ikev2/brave_vpn_ras_connection_api_sim.cc | 5 +- .../mac/brave_vpn_ras_connection_api_mac.h | 3 +- .../mac/brave_vpn_ras_connection_api_mac.mm | 8 +- .../browser/connection/ikev2/win/BUILD.gn | 2 - .../brave_vpn_helper_constants.h | 94 ------------------- .../win/brave_vpn_ras_connection_api_win.cc | 6 +- .../win/brave_vpn_ras_connection_api_win.h | 1 - .../connection/wireguard/credentials/BUILD.gn | 1 - .../brave_vpn_wireguard_connection_api_mac.mm | 4 +- .../browser/connection/wireguard/win/BUILD.gn | 33 ------- components/brave_vpn/common/BUILD.gn | 8 +- .../brave_vpn/common/brave_vpn_utils.cc | 11 +-- components/brave_vpn/common/brave_vpn_utils.h | 2 +- .../brave_vpn/common/buildflags/BUILD.gn | 40 -------- .../brave_vpn/common/wireguard/BUILD.gn | 1 - .../brave_vpn/common/wireguard/win/BUILD.gn | 38 -------- .../brave_vpn/common/wireguard/win/DEPS | 3 - elevation_service/sources.gni | 4 +- test/BUILD.gn | 1 + 97 files changed, 692 insertions(+), 565 deletions(-) create mode 100644 browser/brave_vpn/BUILD.gn rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/BUILD.gn (89%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/DEPS (100%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/brave_vpn_dns_delegate.h (54%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/brave_vpn_helper.ver (100%) create mode 100644 browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc (93%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h (85%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/brave_vpn_helper_utils.cc (60%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/brave_vpn_helper_utils.h (64%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/main.cc (83%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/service_main.cc (93%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/service_main.h (80%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/vpn_dns_handler.cc (91%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/vpn_dns_handler.h (89%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/vpn_dns_handler_unittest.cc (97%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/vpn_utils.cc (75%) rename {components/brave_vpn/browser/connection/ikev2 => browser/brave_vpn}/win/brave_vpn_helper/vpn_utils.h (77%) create mode 100644 browser/brave_vpn/win/brave_vpn_service_delegate_win.cc create mode 100644 browser/brave_vpn/win/brave_vpn_service_delegate_win.h rename components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc => browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.cc (72%) rename components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h => browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.h (69%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/service_commands.cc (92%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/service_commands.h (63%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/service_constants.h (84%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/service_details.cc (58%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/service_details.h (79%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/storage_utils.cc (95%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/storage_utils.h (81%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/storage_utils_unittest.cc (93%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/wireguard_utils_win.cc (96%) rename {components/brave_vpn/common/wireguard => browser/brave_vpn}/win/wireguard_utils_win.h (66%) create mode 100644 components/brave_vpn/browser/brave_vpn_service_delegate.h delete mode 100644 components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h delete mode 100644 components/brave_vpn/browser/connection/wireguard/win/BUILD.gn delete mode 100644 components/brave_vpn/common/wireguard/win/DEPS diff --git a/browser/brave_browser_process_impl.cc b/browser/brave_browser_process_impl.cc index 8f3b16303c85..aa2c7c50d7ef 100644 --- a/browser/brave_browser_process_impl.cc +++ b/browser/brave_browser_process_impl.cc @@ -96,7 +96,9 @@ #endif #if BUILDFLAG(ENABLE_BRAVE_VPN) +#include "brave/browser/brave_vpn/vpn_utils.h" #include "brave/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h" +#include "brave/components/brave_vpn/common/brave_vpn_utils.h" #if BUILDFLAG(IS_WIN) #include "brave/browser/brave_vpn/win/vpn_utils_win.h" #endif @@ -519,8 +521,11 @@ BraveBrowserProcessImpl::brave_vpn_os_connection_api() { #endif brave_vpn_os_connection_api_ = brave_vpn::CreateBraveVPNConnectionAPI( - shared_url_loader_factory(), local_state(), chrome::GetChannel(), - service_installer); + shared_url_loader_factory(), local_state(), service_installer); + if (brave_vpn_os_connection_api_) { + brave_vpn_os_connection_api_->set_target_vpn_entry_name( + brave_vpn::GetBraveVPNEntryName(chrome::GetChannel())); + } return brave_vpn_os_connection_api_.get(); } #endif diff --git a/browser/brave_vpn/BUILD.gn b/browser/brave_vpn/BUILD.gn new file mode 100644 index 000000000000..7cef7b4860d4 --- /dev/null +++ b/browser/brave_vpn/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2023 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at https://mozilla.org/MPL/2.0/. + +import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") + +assert(enable_brave_vpn) + +source_set("brave_vpn") { + sources = [ + "vpn_utils.cc", + "vpn_utils.h", + ] + + deps = [ + "//brave/browser/profiles", + "//brave/components/brave_vpn/browser/connection:api", + "//brave/components/brave_vpn/common", + "//brave/components/brave_vpn/common/buildflags", + "//components/prefs", + "//components/user_prefs", + "//services/network/public/cpp", + ] +} diff --git a/browser/brave_vpn/brave_vpn_service_factory.cc b/browser/brave_vpn/brave_vpn_service_factory.cc index 858c371c8920..360af70978d2 100644 --- a/browser/brave_vpn/brave_vpn_service_factory.cc +++ b/browser/brave_vpn/brave_vpn_service_factory.cc @@ -28,6 +28,7 @@ #if BUILDFLAG(IS_WIN) #include "brave/browser/brave_vpn/dns/brave_vpn_dns_observer_factory_win.h" #include "brave/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.h" +#include "brave/browser/brave_vpn/win/brave_vpn_service_delegate_win.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_factory_win.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.h" #endif @@ -65,6 +66,7 @@ std::unique_ptr BuildVpnService( shared_url_loader_factory, local_state, user_prefs::UserPrefs::Get(context), callback); #if BUILDFLAG(IS_WIN) + vpn_service->set_delegate(std::make_unique()); if (brave_vpn::IsBraveVPNWireguardEnabled(g_browser_process->local_state())) { auto* observer_service = brave_vpn::BraveVpnWireguardObserverFactory::GetInstance() diff --git a/browser/brave_vpn/dns/BUILD.gn b/browser/brave_vpn/dns/BUILD.gn index 591a4a93b956..19a3b6b68801 100644 --- a/browser/brave_vpn/dns/BUILD.gn +++ b/browser/brave_vpn/dns/BUILD.gn @@ -17,6 +17,5 @@ source_set("unit_tests") { "//chrome/test:test_support", "//net", "//testing/gtest", - "//third_party/abseil-cpp:absl", ] } diff --git a/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc b/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc index 986dce09f704..4f33bccdb625 100644 --- a/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc +++ b/browser/brave_vpn/dns/brave_vpn_dns_observer_service_win.cc @@ -8,8 +8,8 @@ #include #include "base/strings/string_util.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/browser/ui/views/brave_vpn/brave_vpn_dns_settings_notificiation_dialog_view.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #include "brave/components/brave_vpn/common/pref_names.h" #include "brave/components/brave_vpn/common/win/utils.h" diff --git a/browser/brave_vpn/sources.gni b/browser/brave_vpn/sources.gni index 259918afe00b..ca6c327b06bd 100644 --- a/browser/brave_vpn/sources.gni +++ b/browser/brave_vpn/sources.gni @@ -12,9 +12,8 @@ if (enable_brave_vpn) { brave_browser_brave_vpn_sources += [ "//brave/browser/brave_vpn/brave_vpn_service_factory.cc", "//brave/browser/brave_vpn/brave_vpn_service_factory.h", - "//brave/browser/brave_vpn/vpn_utils.cc", - "//brave/browser/brave_vpn/vpn_utils.h", ] + if (is_win) { brave_browser_brave_vpn_sources += [ "//brave/browser/brave_vpn/dns/brave_vpn_dns_observer_factory_win.cc", @@ -25,25 +24,24 @@ if (enable_brave_vpn) { "//brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_factory_win.h", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.cc", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.h", - "//brave/browser/brave_vpn/win/vpn_utils_win.cc", - "//brave/browser/brave_vpn/win/vpn_utils_win.h", ] + brave_browser_brave_vpn_deps += [ "//brave/app:brave_generated_resources_grit", "//brave/browser:browser_process", - "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", + "//brave/browser/brave_vpn/win", + "//brave/browser/brave_vpn/win:wireguard_utils", + "//brave/browser/brave_vpn/win/brave_vpn_helper:common", "//brave/components/brave_vpn/common/win", - "//brave/components/brave_vpn/common/wireguard/win", "//chrome/common:constants", - "//chrome/elevation_service:public_headers", - "//chrome/install_static:install_static_util", "//components/prefs", "//net", - "//third_party/abseil-cpp:absl", ] } + brave_browser_brave_vpn_deps += [ "//base", + "//brave/browser/brave_vpn", "//brave/components/brave_vpn/browser", "//chrome/browser/profiles:profile", "//components/keyed_service/content", diff --git a/browser/brave_vpn/vpn_utils.cc b/browser/brave_vpn/vpn_utils.cc index 43d0e90f0cc1..a23f05e8f379 100644 --- a/browser/brave_vpn/vpn_utils.cc +++ b/browser/brave_vpn/vpn_utils.cc @@ -6,12 +6,49 @@ #include "brave/browser/brave_vpn/vpn_utils.h" #include "brave/browser/profiles/profile_util.h" +#include "brave/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" +#include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "build/build_config.h" +#include "components/prefs/pref_service.h" #include "components/user_prefs/user_prefs.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" namespace brave_vpn { +// Defined in each platform's connection api. +std::unique_ptr CreateBraveVPNIKEv2ConnectionAPI( + scoped_refptr url_loader_factory, + PrefService* local_prefs, + base::RepeatingCallback service_installer); + +#if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) +// Defined in each platform's connection api. +std::unique_ptr CreateBraveVPNWireguardConnectionAPI( + scoped_refptr url_loader_factory, + PrefService* local_prefs, + base::RepeatingCallback service_installer); +#endif + +std::unique_ptr CreateBraveVPNConnectionAPI( + scoped_refptr url_loader_factory, + PrefService* local_prefs, + base::RepeatingCallback service_installer) { +#if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) + if (IsBraveVPNWireguardEnabled(local_prefs)) { + return CreateBraveVPNWireguardConnectionAPI(url_loader_factory, local_prefs, + service_installer); + } +#endif +#if BUILDFLAG(IS_ANDROID) + // Android doesn't use connection api. + return nullptr; +#else + return CreateBraveVPNIKEv2ConnectionAPI(url_loader_factory, local_prefs, + service_installer); +#endif +} + bool IsAllowedForContext(content::BrowserContext* context) { return brave::IsRegularProfile(context) && brave_vpn::IsBraveVPNFeatureEnabled(); diff --git a/browser/brave_vpn/vpn_utils.h b/browser/brave_vpn/vpn_utils.h index 4b783692aa89..a4a56aa5eac5 100644 --- a/browser/brave_vpn/vpn_utils.h +++ b/browser/brave_vpn/vpn_utils.h @@ -6,14 +6,31 @@ #ifndef BRAVE_BROWSER_BRAVE_VPN_VPN_UTILS_H_ #define BRAVE_BROWSER_BRAVE_VPN_VPN_UTILS_H_ +#include + +#include "base/functional/callback_forward.h" +#include "base/memory/scoped_refptr.h" + namespace content { class BrowserContext; } // namespace content +namespace network { +class SharedURLLoaderFactory; +} // namespace network + +class PrefService; + namespace brave_vpn { +class BraveVPNOSConnectionAPI; + bool IsBraveVPNEnabled(content::BrowserContext* context); bool IsAllowedForContext(content::BrowserContext* context); +std::unique_ptr CreateBraveVPNConnectionAPI( + scoped_refptr url_loader_factory, + PrefService* local_prefs, + base::RepeatingCallback service_installer); } // namespace brave_vpn diff --git a/browser/brave_vpn/win/BUILD.gn b/browser/brave_vpn/win/BUILD.gn index 37ad2a77845f..d701937dcdca 100644 --- a/browser/brave_vpn/win/BUILD.gn +++ b/browser/brave_vpn/win/BUILD.gn @@ -10,10 +10,63 @@ assert(enable_brave_vpn && is_win) source_set("unit_tests") { testonly = true - sources = [ "brave_vpn_wireguard_observer_service_win_unittest.cc" ] + sources = [ + "brave_vpn_wireguard_observer_service_win_unittest.cc", + "storage_utils_unittest.cc", + ] + deps = [ + ":wireguard_utils", + "//base", "//chrome/test:test_support", + "//components/version_info:channel", "//testing/gtest", - "//third_party/abseil-cpp:absl", + ] +} + +source_set("win") { + sources = [ + "brave_vpn_service_delegate_win.cc", + "brave_vpn_service_delegate_win.h", + "brave_vpn_wireguard_connection_api_win.cc", + "brave_vpn_wireguard_connection_api_win.h", + "vpn_utils_win.cc", + "vpn_utils_win.h", + ] + + deps = [ + ":wireguard_utils", + "//base", + "//brave/components/brave_vpn/browser", + "//brave/components/brave_vpn/browser/connection/wireguard", + "//brave/components/brave_vpn/browser/connection/wireguard/credentials", + "//brave/components/brave_vpn/common/win", + "//chrome/elevation_service:public_headers", + "//chrome/install_static:install_static_util", + "//components/keyed_service/core", + ] +} + +source_set("wireguard_utils") { + sources = [ + "service_commands.cc", + "service_commands.h", + "service_constants.h", + "service_details.cc", + "service_details.h", + "storage_utils.cc", + "storage_utils.h", + "wireguard_utils_win.cc", + "wireguard_utils_win.h", + ] + + deps = [ + "//base", + "//brave/components/brave_vpn/common/buildflags", + "//brave/components/brave_vpn/common/win", + "//brave/components/brave_vpn/common/wireguard", + "//brave/components/brave_vpn/common/wireguard/win:brave_wireguard_manager_idl", + "//chrome/common:channel_info", + "//components/version_info", ] } diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/BUILD.gn b/browser/brave_vpn/win/brave_vpn_helper/BUILD.gn similarity index 89% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/BUILD.gn rename to browser/brave_vpn/win/brave_vpn_helper/BUILD.gn index 476c98ada39a..4972f4c9e8d2 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_helper/BUILD.gn @@ -29,7 +29,7 @@ source_set("common") { "//brave/components/brave_vpn/common", "//brave/components/brave_vpn/common/buildflags", "//brave/components/brave_vpn/common/win", - "//brave/components/brave_vpn/common/wireguard/win:win", + "//chrome/common:channel_info", "//chrome/install_static:install_static_util", "//chrome/installer/util:with_no_strings", "//components/version_info", @@ -52,8 +52,10 @@ source_set("lib") { deps = [ ":common", "//base", + "//brave/browser/brave_vpn/win:wireguard_utils", "//brave/components/brave_vpn/browser/connection/ikev2/win:ras_utils", - "//brave/components/brave_vpn/common/wireguard/win", + "//chrome/common:channel_info", + "//components/version_info:channel", ] libs = [ @@ -73,11 +75,11 @@ executable("brave_vpn_helper") { ] deps = [ + ":common", ":lib", ":version_resources", "//base", "//base:base_static", - "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", "//brave/components/brave_vpn/common", "//build/win:default_exe_manifest", "//chrome/install_static:install_static_util", @@ -99,11 +101,11 @@ source_set("unit_tests") { sources = [ "vpn_dns_handler_unittest.cc" ] deps = [ + ":common", ":lib", "//base", "//base/test:test_support", "//brave/components/brave_vpn/browser/connection/ikev2/win:ras_utils", - "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", "//brave/components/brave_vpn/common", "//testing/gtest", ] diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/DEPS b/browser/brave_vpn/win/brave_vpn_helper/DEPS similarity index 100% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/DEPS rename to browser/brave_vpn/win/brave_vpn_helper/DEPS diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_dns_delegate.h b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_dns_delegate.h similarity index 54% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_dns_delegate.h rename to browser/brave_vpn/win/brave_vpn_helper/brave_vpn_dns_delegate.h index aa5af13bab00..2532b6828e78 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_dns_delegate.h +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_dns_delegate.h @@ -3,8 +3,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_DNS_DELEGATE_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_DNS_DELEGATE_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_DNS_DELEGATE_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_DNS_DELEGATE_H_ namespace brave_vpn { @@ -15,4 +15,4 @@ class BraveVpnDnsDelegate { } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_DNS_DELEGATE_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_DNS_DELEGATE_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper.ver b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper.ver similarity index 100% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper.ver rename to browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper.ver diff --git a/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h new file mode 100644 index 000000000000..8e502a4b12e5 --- /dev/null +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CONSTANTS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CONSTANTS_H_ + +namespace brave_vpn { + +inline constexpr char kBraveVpnHelperCrashMe[] = "crash-me"; +inline constexpr wchar_t kBraveVPNHelperExecutable[] = L"brave_vpn_helper.exe"; +inline constexpr wchar_t kBraveVpnHelperFiltersInstalledValue[] = L"filters"; +inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupValue[] = L"ran"; + +// Repeating interval to check the connection is live. +inline constexpr int kCheckConnectionIntervalInSeconds = 3; + +} // namespace brave_vpn + +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CONSTANTS_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc similarity index 93% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc rename to browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc index 510314568d9d..483e8600ba50 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.cc @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h" #include #include @@ -14,8 +14,8 @@ #include "base/notreached.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "chrome/install_static/install_util.h" #include "chrome/install_static/product_install_details.h" #include "chrome/install_static/user_data_dir.h" diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h similarity index 85% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h rename to browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h index 6ff518c5c4ba..cb925635b272 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CRASH_REPORTER_CLIENT_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CRASH_REPORTER_CLIENT_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CRASH_REPORTER_CLIENT_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CRASH_REPORTER_CLIENT_H_ #include @@ -51,4 +51,4 @@ class BraveVPNHelperCrashReporterClient bool EnableBreakpadForProcess(const std::string& process_type) override; }; -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CRASH_REPORTER_CLIENT_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CRASH_REPORTER_CLIENT_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.cc b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc similarity index 60% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.cc rename to browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc index 8917162903e0..c3cc779df93b 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.cc @@ -3,7 +3,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include #include @@ -15,16 +15,19 @@ #include "base/check.h" #include "base/logging.h" +#include "base/notreached.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "base/win/registry.h" #include "base/win/windows_types.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #include "brave/components/brave_vpn/common/win/scoped_sc_handle.h" #include "brave/components/brave_vpn/common/win/utils.h" #include "chrome/install_static/install_modes.h" #include "chrome/install_static/install_util.h" +#include "chrome/common/channel_info.h" +#include "components/version_info/channel.h" namespace brave_vpn { @@ -61,7 +64,7 @@ bool IsBraveVPNHelperServiceInstalled() { bool IsNetworkFiltersInstalled() { DCHECK(IsBraveVPNHelperServiceInstalled()); base::win::RegKey service_storage_key( - HKEY_LOCAL_MACHINE, brave_vpn::kBraveVpnHelperRegistryStoragePath, + HKEY_LOCAL_MACHINE, GetBraveVpnHelperRegistryStoragePath().c_str(), KEY_READ); if (!service_storage_key.Valid()) { return false; @@ -77,7 +80,7 @@ bool IsNetworkFiltersInstalled() { std::wstring GetBraveVPNConnectionName() { return base::UTF8ToWide( - brave_vpn::GetBraveVPNEntryName(install_static::GetChromeChannel())); + brave_vpn::GetBraveVPNEntryName(chrome::GetChannel())); } std::wstring GetBraveVpnHelperServiceDisplayName() { @@ -91,4 +94,40 @@ std::wstring GetBraveVpnHelperServiceName() { return name; } +std::wstring GetBraveVpnHelperRegistryStoragePath() { + switch (chrome::GetChannel()) { + case version_info::Channel::CANARY: + return L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceNightly"; + case version_info::Channel::DEV: + return L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceDev"; + case version_info::Channel::BETA: + return L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceBeta"; + case version_info::Channel::STABLE: + return L"Software\\BraveSoftware\\Brave\\Vpn\\HelperService"; + case version_info::Channel::UNKNOWN: + return L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceDevelopment"; + } + + NOTREACHED_NORETURN(); +} + +std::wstring GetBraveVpnOneTimeServiceCleanupStoragePath() { + switch (chrome::GetChannel()) { + case version_info::Channel::CANARY: + return L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupNightl" + L"y"; + case version_info::Channel::DEV: + return L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupDev"; + case version_info::Channel::BETA: + return L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupBeta"; + case version_info::Channel::STABLE: + return L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanup"; + case version_info::Channel::UNKNOWN: + return L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupDevelo" + L"pment"; + } + + NOTREACHED_NORETURN(); +} + } // namespace brave_vpn diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h similarity index 64% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h rename to browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h index afe0986c03a3..b9ed3f28b530 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h +++ b/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ #include @@ -18,7 +18,9 @@ bool IsNetworkFiltersInstalled(); std::wstring GetBraveVPNConnectionName(); std::wstring GetBraveVpnHelperServiceDisplayName(); std::wstring GetBraveVpnHelperServiceName(); +std::wstring GetBraveVpnHelperRegistryStoragePath(); +std::wstring GetBraveVpnOneTimeServiceCleanupStoragePath(); } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_UTILS_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/main.cc b/browser/brave_vpn/win/brave_vpn_helper/main.cc similarity index 83% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/main.cc rename to browser/brave_vpn/win/brave_vpn_helper/main.cc index b9368925dabc..6070637ef58a 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/main.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/main.cc @@ -12,11 +12,11 @@ #include "base/process/memory.h" #include "base/strings/utf_string_conversions.h" #include "base/win/process_startup_helper.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_crash_reporter_client.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/service_main.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "components/crash/core/app/crash_switches.h" #include "components/crash/core/app/crashpad.h" #include "components/crash/core/app/fallback_crash_handling_win.h" diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.cc b/browser/brave_vpn/win/brave_vpn_helper/service_main.cc similarity index 93% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.cc rename to browser/brave_vpn/win/brave_vpn_helper/service_main.cc index 7e7114ffe188..8a5cc8cb3c73 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/service_main.cc @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/service_main.h" #include @@ -14,8 +14,8 @@ #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool.h" #include "base/threading/thread_restrictions.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" namespace brave_vpn { namespace { diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.h b/browser/brave_vpn/win/brave_vpn_helper/service_main.h similarity index 80% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.h rename to browser/brave_vpn/win/brave_vpn_helper/service_main.h index ed7a6b72d9e2..023c742b93c1 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/service_main.h +++ b/browser/brave_vpn/win/brave_vpn_helper/service_main.h @@ -3,16 +3,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_SERVICE_MAIN_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_SERVICE_MAIN_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_SERVICE_MAIN_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_SERVICE_MAIN_H_ #include #include "base/functional/callback.h" #include "base/memory/scoped_refptr.h" #include "base/no_destructor.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_dns_delegate.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_dns_delegate.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.h" namespace base { class CommandLine; @@ -77,4 +77,4 @@ class ServiceMain : public brave_vpn::BraveVpnDnsDelegate { } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_SERVICE_MAIN_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_SERVICE_MAIN_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.cc b/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.cc similarity index 91% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.cc rename to browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.cc index 4be39ee1a323..c58eb6ffafb5 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.cc @@ -3,20 +3,20 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.h" #include #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_dns_delegate.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_dns_delegate.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.h" +#include "brave/browser/brave_vpn/win/service_commands.h" +#include "brave/browser/brave_vpn/win/service_constants.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/ras_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_commands.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" namespace brave_vpn { diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.h b/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.h similarity index 89% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.h rename to browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.h index ca2e9b5f644a..d0e524a83808 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.h +++ b/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.h @@ -3,8 +3,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_VPN_DNS_HANDLER_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_VPN_DNS_HANDLER_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_VPN_DNS_HANDLER_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_VPN_DNS_HANDLER_H_ #include @@ -79,4 +79,4 @@ class VpnDnsHandler : public base::win::ObjectWatcher::Delegate { } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_VPN_DNS_HANDLER_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_VPN_DNS_HANDLER_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler_unittest.cc b/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler_unittest.cc similarity index 97% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler_unittest.cc rename to browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler_unittest.cc index 88673706f2fc..74dfed60a88a 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler_unittest.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler_unittest.cc @@ -3,7 +3,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_dns_handler.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/vpn_dns_handler.h" #include @@ -12,8 +12,8 @@ #include "base/run_loop.h" #include "base/test/bind.h" #include "base/test/task_environment.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_dns_delegate.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_dns_delegate.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/ras_utils.h" #include "brave/components/brave_vpn/common/brave_vpn_constants.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.cc b/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.cc similarity index 75% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.cc rename to browser/brave_vpn/win/brave_vpn_helper/vpn_utils.cc index ef9ebe8263a3..ff6aad40222d 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.cc @@ -3,7 +3,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.h" #include #include @@ -16,21 +16,79 @@ #include #include "base/logging.h" +#include "base/notreached.h" #include "base/win/registry.h" #include "base/win/windows_types.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "chrome/common/channel_info.h" +#include "components/version_info/channel.h" namespace brave_vpn { namespace { +std::wstring GetBraveVpnServiceFilterName() { + switch (chrome::GetChannel()) { + case version_info::Channel::CANARY: + return L"Brave VPN Nightly Service DNS Filter"; + case version_info::Channel::DEV: + return L"Brave VPN Dev Service DNS Filter"; + case version_info::Channel::BETA: + return L"Brave VPN Beta Service DNS Filter"; + case version_info::Channel::STABLE: + return L"Brave VPN Service DNS Filter"; + case version_info::Channel::UNKNOWN: + return L"Brave VPN Development Service DNS Filter"; + } + + NOTREACHED_NORETURN(); +} + +GUID GetVpnDnsSublayerGUID() { + switch (chrome::GetChannel()) { + case version_info::Channel::CANARY: + // 23e10e29-eb83-4d2c-9d77-f6e9b547f39c + return {0x23e10e29, + 0xeb83, + 0x4d2c, + {0x9d, 0x77, 0xf6, 0xe9, 0xb5, 0x47, 0xf3, 0x9c}}; + case version_info::Channel::DEV: + // c448b198-729d-4a89-879b-1cf0cd2460c0 + return {0xc448b198, + 0x729d, + 0x4a89, + {0x87, 0x9b, 0x1c, 0xf0, 0xcd, 0x24, 0x60, 0xc0}}; + case version_info::Channel::BETA: + // fc5fb7bc-e313-4f5e-8052-fe8b150f7de0 + return {0xfc5fb7bc, + 0xe313, + 0x4f5e, + {0x80, 0x52, 0xfe, 0x8b, 0x15, 0x0f, 0x7d, 0xe0}}; + case version_info::Channel::STABLE: + // 754b7cbd-cad3-474e-8d2c-054413fd4509 + return {0x754b7cbd, + 0xcad3, + 0x474e, + {0x8d, 0x2c, 0x05, 0x44, 0x13, 0xfd, 0x45, 0x09}}; + case version_info::Channel::UNKNOWN: + // 9c14e1f7-692f-495b-95e8-008113d3c0d6 + return {0x9c14e1f7, + 0x692f, + 0x495b, + {0x95, 0xe8, 0x00, 0x81, 0x13, 0xd3, 0xc0, 0xd6}}; + } + + NOTREACHED_NORETURN(); +} + DWORD AddSublayer(GUID uuid) { FWPM_SESSION0 session = {}; HANDLE engine = nullptr; auto result = FwpmEngineOpen0(nullptr, RPC_C_AUTHN_WINNT, nullptr, &session, &engine); if (result == ERROR_SUCCESS) { - std::wstring name(kBraveVPNServiceFilter); + std::wstring name(GetBraveVpnServiceFilterName()); FWPM_SUBLAYER0 sublayer = {}; sublayer.subLayerKey = uuid; sublayer.displayData.name = name.data(); @@ -104,8 +162,8 @@ DWORD BlockIPv4Queries(HANDLE engine_handle) { {FWP_UINT16, {.uint16 = 53}}}}; FWPM_FILTER0 filter = {}; - filter.subLayerKey = kVpnDnsSublayerGUID; - std::wstring name(kBraveVPNServiceFilter); + filter.subLayerKey = GetVpnDnsSublayerGUID(); + std::wstring name = GetBraveVpnServiceFilterName(); filter.displayData.name = name.data(); filter.weight.type = FWP_UINT8; filter.weight.uint8 = 0xF; @@ -124,8 +182,8 @@ DWORD BlockIPv4Queries(HANDLE engine_handle) { // Block all IPv6 DNS queries DWORD BlockIPv6Queries(HANDLE engine_handle) { FWPM_FILTER0 Filter = {}; - Filter.subLayerKey = kVpnDnsSublayerGUID; - std::wstring name(kBraveVPNServiceFilter); + Filter.subLayerKey = GetVpnDnsSublayerGUID(); + std::wstring name = GetBraveVpnServiceFilterName(); Filter.displayData.name = name.data(); Filter.weight.type = FWP_EMPTY; Filter.layerKey = FWPM_LAYER_ALE_AUTH_CONNECT_V6; @@ -161,8 +219,8 @@ DWORD PermitQueriesFromTAP(HANDLE engine_handle, {FWP_UINT64, {.uint64 = &tapluid.Value}}}}; FWPM_FILTER0 Filter = {}; - Filter.subLayerKey = kVpnDnsSublayerGUID; - std::wstring name(kBraveVPNServiceFilter); + Filter.subLayerKey = GetVpnDnsSublayerGUID(); + std::wstring name = GetBraveVpnServiceFilterName(); Filter.displayData.name = name.data(); Filter.weight.type = FWP_UINT8; Filter.weight.uint8 = 0xE; @@ -197,7 +255,7 @@ bool AddWpmFilters(HANDLE engine_handle, const std::string& connection_name) { VLOG(1) << "Engine handle cannot be null"; return false; } - auto result = RegisterSublayer(engine_handle, kVpnDnsSublayerGUID); + auto result = RegisterSublayer(engine_handle, GetVpnDnsSublayerGUID()); if (result != ERROR_SUCCESS) { VLOG(1) << "Open FWP session failed, error code:" << std::hex << result; return false; @@ -269,7 +327,8 @@ bool SubscribeRasConnectionNotification(HANDLE event_handle) { } void SetFiltersInstalledFlag() { - base::win::RegKey key(HKEY_LOCAL_MACHINE, kBraveVpnHelperRegistryStoragePath, + base::win::RegKey key(HKEY_LOCAL_MACHINE, + GetBraveVpnHelperRegistryStoragePath().c_str(), KEY_ALL_ACCESS); if (!key.Valid()) { VLOG(1) << "Failed to open vpn service storage"; @@ -280,7 +339,8 @@ void SetFiltersInstalledFlag() { } void ResetFiltersInstalledFlag() { - base::win::RegKey key(HKEY_LOCAL_MACHINE, kBraveVpnHelperRegistryStoragePath, + base::win::RegKey key(HKEY_LOCAL_MACHINE, + GetBraveVpnHelperRegistryStoragePath().c_str(), KEY_ALL_ACCESS); if (!key.Valid()) { VLOG(1) << "Failed to open vpn service storage"; diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h b/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.h similarity index 77% rename from components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h rename to browser/brave_vpn/win/brave_vpn_helper/vpn_utils.h index d9dfd99c1099..780ebf7b4e21 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/vpn_utils.h +++ b/browser/brave_vpn/win/brave_vpn_helper/vpn_utils.h @@ -3,8 +3,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this file, // You can obtain one at https://mozilla.org/MPL/2.0/. -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_VPN_UTILS_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_VPN_UTILS_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_VPN_UTILS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_VPN_UTILS_H_ #include #include @@ -25,4 +25,4 @@ bool CloseWpmSession(HANDLE engine); bool SubscribeRasConnectionNotification(HANDLE event_handle); } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_VPN_UTILS_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_HELPER_VPN_UTILS_H_ diff --git a/browser/brave_vpn/win/brave_vpn_service_delegate_win.cc b/browser/brave_vpn/win/brave_vpn_service_delegate_win.cc new file mode 100644 index 000000000000..46f481c17cab --- /dev/null +++ b/browser/brave_vpn/win/brave_vpn_service_delegate_win.cc @@ -0,0 +1,26 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "brave/browser/brave_vpn/win/brave_vpn_service_delegate_win.h" + +#include "brave/browser/brave_vpn/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" + +namespace brave_vpn { + +BraveVPNServiceDelegateWin::BraveVPNServiceDelegateWin() = default; + +BraveVPNServiceDelegateWin::~BraveVPNServiceDelegateWin() = default; + +void BraveVPNServiceDelegateWin::WriteConnectionState( + mojom::ConnectionState state) { + ::brave_vpn::WriteConnectionState(static_cast(state)); +} + +void BraveVPNServiceDelegateWin::ShowBraveVpnStatusTrayIcon() { + wireguard::ShowBraveVpnStatusTrayIcon(); +} + +} // namespace brave_vpn diff --git a/browser/brave_vpn/win/brave_vpn_service_delegate_win.h b/browser/brave_vpn/win/brave_vpn_service_delegate_win.h new file mode 100644 index 000000000000..de6cc76c5021 --- /dev/null +++ b/browser/brave_vpn/win/brave_vpn_service_delegate_win.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_SERVICE_DELEGATE_WIN_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_SERVICE_DELEGATE_WIN_H_ + +#include "brave/components/brave_vpn/browser/brave_vpn_service_delegate.h" + +namespace brave_vpn { + +class BraveVPNServiceDelegateWin : public BraveVPNServiceDelegate { + public: + BraveVPNServiceDelegateWin(); + ~BraveVPNServiceDelegateWin() override; + + BraveVPNServiceDelegateWin(const BraveVPNServiceDelegateWin&) = delete; + BraveVPNServiceDelegateWin& operator=(const BraveVPNServiceDelegateWin&) = + delete; + + void WriteConnectionState(mojom::ConnectionState state) override; + void ShowBraveVpnStatusTrayIcon() override; +}; + +} // namespace brave_vpn + +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_SERVICE_DELEGATE_WIN_H_ diff --git a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc b/browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.cc similarity index 72% rename from components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc rename to browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.cc index 99b33b2e5e4e..611d7cb39476 100644 --- a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.cc @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h" +#include "brave/browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.h" #include #include @@ -11,8 +11,8 @@ #include "brave/components/brave_vpn/browser/connection/wireguard/brave_vpn_wireguard_connection_api_base.h" #include "brave/components/brave_vpn/common/win/utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" +#include "brave/browser/brave_vpn/win/service_details.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" namespace brave_vpn { @@ -26,13 +26,12 @@ using ConnectionState = mojom::ConnectionState; std::unique_ptr CreateBraveVPNWireguardConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel, base::RepeatingCallback service_installer) { - return std::make_unique( + return std::make_unique( url_loader_factory, local_prefs, service_installer); } -BraveVPNWireguardConnectionAPI::BraveVPNWireguardConnectionAPI( +BraveVPNWireguardConnectionAPIWin::BraveVPNWireguardConnectionAPIWin( scoped_refptr url_loader_factory, PrefService* local_prefs, base::RepeatingCallback service_installer) @@ -42,9 +41,9 @@ BraveVPNWireguardConnectionAPI::BraveVPNWireguardConnectionAPI( } } -BraveVPNWireguardConnectionAPI::~BraveVPNWireguardConnectionAPI() {} +BraveVPNWireguardConnectionAPIWin::~BraveVPNWireguardConnectionAPIWin() {} -void BraveVPNWireguardConnectionAPI::Disconnect() { +void BraveVPNWireguardConnectionAPIWin::Disconnect() { if (GetConnectionState() == ConnectionState::DISCONNECTED) { VLOG(2) << __func__ << " : already disconnected"; return; @@ -53,11 +52,11 @@ void BraveVPNWireguardConnectionAPI::Disconnect() { UpdateAndNotifyConnectionStateChange(ConnectionState::DISCONNECTING); brave_vpn::wireguard::DisableBraveVpnWireguardService( - base::BindOnce(&BraveVPNWireguardConnectionAPI::OnDisconnected, - weak_factory_.GetWeakPtr())); + base::BindOnce(&BraveVPNWireguardConnectionAPIWin::OnDisconnected, + weak_factory_.GetWeakPtr())); } -void BraveVPNWireguardConnectionAPI::CheckConnection() { +void BraveVPNWireguardConnectionAPIWin::CheckConnection() { auto state = IsWindowsServiceRunning( brave_vpn::GetBraveVpnWireguardTunnelServiceName()) ? ConnectionState::CONNECTED @@ -65,7 +64,7 @@ void BraveVPNWireguardConnectionAPI::CheckConnection() { UpdateAndNotifyConnectionStateChange(state); } -void BraveVPNWireguardConnectionAPI::PlatformConnectImpl( +void BraveVPNWireguardConnectionAPIWin::PlatformConnectImpl( const wireguard::WireguardProfileCredentials& credentials) { auto vpn_server_hostname = GetHostname(); auto config = brave_vpn::wireguard::CreateWireguardConfig( @@ -79,22 +78,22 @@ void BraveVPNWireguardConnectionAPI::PlatformConnectImpl( brave_vpn::wireguard::EnableBraveVpnWireguardService( config.value(), base::BindOnce( - &BraveVPNWireguardConnectionAPI::OnWireguardServiceLaunched, + &BraveVPNWireguardConnectionAPIWin::OnWireguardServiceLaunched, weak_factory_.GetWeakPtr())); } -void BraveVPNWireguardConnectionAPI::OnServiceStopped(int mask) { +void BraveVPNWireguardConnectionAPIWin::OnServiceStopped(int mask) { // Postpone check because the service can be restarted by the system due to // configured failure actions. base::SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask( FROM_HERE, - base::BindOnce(&BraveVPNWireguardConnectionAPI::CheckConnection, + base::BindOnce(&BraveVPNWireguardConnectionAPIWin::CheckConnection, weak_factory_.GetWeakPtr()), base::Seconds(kWireguardServiceRestartTimeoutSec)); ResetServiceWatcher(); } -void BraveVPNWireguardConnectionAPI::RunServiceWatcher() { +void BraveVPNWireguardConnectionAPIWin::RunServiceWatcher() { if (service_watcher_ && service_watcher_->IsWatching()) { return; } @@ -102,24 +101,26 @@ void BraveVPNWireguardConnectionAPI::RunServiceWatcher() { if (!service_watcher_->Subscribe( brave_vpn::GetBraveVpnWireguardTunnelServiceName(), SERVICE_NOTIFY_STOPPED, - base::BindRepeating(&BraveVPNWireguardConnectionAPI::OnServiceStopped, - weak_factory_.GetWeakPtr()))) { + base::BindRepeating( + &BraveVPNWireguardConnectionAPIWin::OnServiceStopped, + weak_factory_.GetWeakPtr()))) { VLOG(1) << "Unable to set service watcher"; } } -void BraveVPNWireguardConnectionAPI::ResetServiceWatcher() { +void BraveVPNWireguardConnectionAPIWin::ResetServiceWatcher() { if (service_watcher_) { service_watcher_.reset(); } } -void BraveVPNWireguardConnectionAPI::OnWireguardServiceLaunched(bool success) { +void BraveVPNWireguardConnectionAPIWin::OnWireguardServiceLaunched( + bool success) { UpdateAndNotifyConnectionStateChange( success ? ConnectionState::CONNECTED : ConnectionState::CONNECT_FAILED); } -void BraveVPNWireguardConnectionAPI::OnConnectionStateChanged( +void BraveVPNWireguardConnectionAPIWin::OnConnectionStateChanged( mojom::ConnectionState state) { BraveVPNWireguardConnectionAPIBase::OnConnectionStateChanged(state); if (state == ConnectionState::CONNECTED) { diff --git a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h b/browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.h similarity index 69% rename from components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h rename to browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.h index 9e4a00517995..638dddf92215 100644 --- a/components/brave_vpn/browser/connection/wireguard/win/brave_vpn_wireguard_connection_api.h +++ b/browser/brave_vpn/win/brave_vpn_wireguard_connection_api_win.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_WIREGUARD_WIN_BRAVE_VPN_WIREGUARD_CONNECTION_API_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_WIREGUARD_WIN_BRAVE_VPN_WIREGUARD_CONNECTION_API_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_CONNECTION_API_WIN_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_CONNECTION_API_WIN_H_ #include @@ -19,19 +19,20 @@ class PrefService; namespace brave_vpn { -class BraveVPNWireguardConnectionAPI +// Implemented in chrome layer as it needs channel specific apis. +class BraveVPNWireguardConnectionAPIWin : public BraveVPNWireguardConnectionAPIBase { public: - BraveVPNWireguardConnectionAPI( + BraveVPNWireguardConnectionAPIWin( scoped_refptr url_loader_factory, PrefService* local_prefs, base::RepeatingCallback service_installer); - BraveVPNWireguardConnectionAPI(const BraveVPNWireguardConnectionAPI&) = + BraveVPNWireguardConnectionAPIWin(const BraveVPNWireguardConnectionAPIWin&) = delete; - BraveVPNWireguardConnectionAPI& operator=( - const BraveVPNWireguardConnectionAPI&) = delete; - ~BraveVPNWireguardConnectionAPI() override; + BraveVPNWireguardConnectionAPIWin& operator=( + const BraveVPNWireguardConnectionAPIWin&) = delete; + ~BraveVPNWireguardConnectionAPIWin() override; // BraveVPNOSConnectionAPI void Disconnect() override; @@ -52,9 +53,9 @@ class BraveVPNWireguardConnectionAPI void ResetServiceWatcher(); std::unique_ptr service_watcher_; - base::WeakPtrFactory weak_factory_{this}; + base::WeakPtrFactory weak_factory_{this}; }; } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_WIREGUARD_WIN_BRAVE_VPN_WIREGUARD_CONNECTION_API_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_BRAVE_VPN_WIREGUARD_CONNECTION_API_WIN_H_ diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.cc b/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.cc index 6d6f82396525..12c1a96e59fa 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.cc @@ -5,8 +5,8 @@ #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_observer_service_win.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" #include "brave/browser/ui/browser_dialogs.h" -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" namespace brave_vpn { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn index 61a2d94f4b37..73162dfb1c04 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/BUILD.gn @@ -53,15 +53,15 @@ executable("brave_vpn_wireguard_service") { "status_tray", "//base", "//base:base_static", - "//brave/components/brave_vpn/common/wireguard/win", + "//brave/browser/brave_vpn/win:wireguard_utils", "//brave/components/resources:strings_grit", "//build/win:default_exe_manifest", + "//chrome/common:channel_info", "//chrome/install_static:install_static_util", "//components/crash/core/app", "//components/crash/core/app:crash_export_thunks", "//components/crash/core/app:run_as_crashpad_handler", "//components/version_info:channel", - "//third_party/abseil-cpp:absl", ] public_configs = [ "//build/config/win:windowed" ] @@ -81,12 +81,13 @@ source_set("install_utils") { public_deps = [ "//brave/components/brave_vpn/common/wireguard/win:brave_wireguard_manager_idl" ] deps = [ "//base", + "//brave/browser/brave_vpn/win:wireguard_utils", + "//brave/browser/brave_vpn/win/brave_vpn_helper:common", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon:utils", - "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", "//brave/components/brave_vpn/common/win", - "//brave/components/brave_vpn/common/wireguard/win", + "//chrome/common:channel_info", "//chrome/installer/util:work_item", ] } diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc index 20bd1f12d217..203c7ef0b802 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/brave_wireguard_service_crash_reporter_client.cc @@ -14,7 +14,7 @@ #include "base/notreached.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" +#include "brave/browser/brave_vpn/win/service_details.h" #include "chrome/install_static/install_modes.h" #include "chrome/install_static/install_util.h" #include "chrome/install_static/product_install_details.h" diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc index 03b8161fda0e..785fc14e0a6b 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.cc @@ -21,17 +21,17 @@ #include "base/path_service.h" #include "base/win/registry.h" #include "base/win/windows_types.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/brave_vpn_tray_command_ids.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/constants.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/icon_utils.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "brave/browser/brave_vpn/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_details.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" #include "brave/components/brave_vpn/common/win/scoped_sc_handle.h" #include "brave/components/brave_vpn/common/win/utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" #include "chrome/installer/util/install_service_work_item.h" namespace brave_vpn { @@ -238,7 +238,7 @@ bool InstallBraveVPNHelperService() { brave_vpn::GetBraveVpnHelperServiceName(), brave_vpn::GetBraveVpnHelperServiceDisplayName(), SERVICE_DEMAND_START, service_cmd, base::CommandLine(base::CommandLine::NO_PROGRAM), - brave_vpn::kBraveVpnHelperRegistryStoragePath, {}, {}); + GetBraveVpnHelperRegistryStoragePath(), {}, {}); install_service_work_item.set_best_effort(true); install_service_work_item.set_rollback_enabled(false); if (install_service_work_item.Do()) { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc index b8ae16c7f7d0..9b502d283f09 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/main.cc @@ -20,7 +20,7 @@ #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_service_runner.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_constants.h" #include "chrome/install_static/product_install_details.h" #include "components/crash/core/app/crash_switches.h" #include "components/crash/core/app/crashpad.h" diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn index 983dfc042f40..ad46d894f2dd 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/BUILD.gn @@ -20,9 +20,11 @@ source_set("service") { public_deps = [ "//brave/components/brave_vpn/common/wireguard/win:brave_wireguard_manager_idl" ] deps = [ "//base", + "//brave/browser/brave_vpn/win:wireguard_utils", "//brave/components/brave_vpn/common/win", - "//brave/components/brave_vpn/common/wireguard/win", + "//chrome/common:channel_info", "//chrome/installer/util:with_no_strings", + "//components/version_info:channel", ] libs = [ "runtimeobject.lib" ] } diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_service_runner.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_service_runner.cc index b479e7712d17..80a2a9372b62 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_service_runner.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_service_runner.cc @@ -26,8 +26,8 @@ #include "base/threading/thread_restrictions.h" #include "base/win/scoped_com_initializer.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/service/brave_wireguard_manager.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" +#include "brave/browser/brave_vpn/win/service_details.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" namespace brave_vpn { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.cc index 82ad5d0884cc..25b92a4da3e0 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_tunnel_service.cc @@ -24,12 +24,12 @@ #include "base/win/security_descriptor.h" #include "base/win/sid.h" #include "base/win/windows_types.h" +#include "brave/browser/brave_vpn/win/service_commands.h" +#include "brave/browser/brave_vpn/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_details.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" #include "brave/components/brave_vpn/common/win/scoped_sc_handle.h" #include "brave/components/brave_vpn/common/win/utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_commands.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" namespace brave_vpn { diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn index 0a97aa0ff324..c56eb6fa1466 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/BUILD.gn @@ -18,12 +18,14 @@ source_set("status_tray") { "status_icon:utils", "wireguard", "//base", + "//brave/browser/brave_vpn/win:wireguard_utils", "//brave/components/brave_vpn/common", "//brave/components/brave_vpn/common/mojom", "//brave/components/brave_vpn/common/win", "//brave/components/brave_vpn/common/win/ras", - "//brave/components/brave_vpn/common/wireguard/win", "//brave/components/resources:strings_grit", + "//chrome/common:channel_info", + "//components/version_info:channel", "//ui/base", "//ui/native_theme", "//ui/native_theme:native_theme_browser", @@ -40,7 +42,7 @@ source_set("unit_tests") { deps = [ ":status_tray", "//base/test:test_support", - "//brave/components/brave_vpn/common/wireguard/win", + "//brave/browser/brave_vpn/win:wireguard_utils", "//brave/components/constants", "//brave/components/resources:strings_grit", "//testing/gtest", diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/BUILD.gn b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/BUILD.gn index 27c0309d281d..8a8e417302e6 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/BUILD.gn +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/BUILD.gn @@ -9,6 +9,7 @@ source_set("ras") { "ras_utils.h", ] deps = [ + "//base", "//brave/components/brave_vpn/browser/connection/ikev2/win:ras_utils", "//brave/components/brave_vpn/common", "//chrome/common:channel_info", diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/ras_utils.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/ras_utils.cc index 46bc7ba48fb5..fea7835aead5 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/ras_utils.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/ras_utils.cc @@ -5,6 +5,8 @@ #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/ras/ras_utils.h" +#include + #include "base/strings/utf_string_conversions.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/ras_utils.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc index 42538fc15abc..d8d48b4c5e72 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc @@ -24,11 +24,11 @@ #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/icon_utils.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/status_icon.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/status_tray.h" +#include "brave/browser/brave_vpn/win/service_details.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" #include "brave/components/brave_vpn/common/brave_vpn_constants.h" #include "brave/components/brave_vpn/common/win/utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" #include "components/grit/brave_components_strings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/simple_menu_model.h" @@ -99,7 +99,7 @@ StatusTrayRunner* StatusTrayRunner::GetInstance() { return instance.get(); } -StatusTrayRunner::StatusTrayRunner() = default; +StatusTrayRunner::StatusTrayRunner() {} StatusTrayRunner::~StatusTrayRunner() = default; diff --git a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc index a717b28d0f06..ce1a5ffcc712 100644 --- a/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc +++ b/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner_unittest.cc @@ -12,7 +12,7 @@ #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/brave_vpn_tray_command_ids.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/resources/resource.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_icon/tray_menu_model.h" -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" #include "components/grit/brave_components_strings.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/models/simple_menu_model.h" diff --git a/components/brave_vpn/common/wireguard/win/service_commands.cc b/browser/brave_vpn/win/service_commands.cc similarity index 92% rename from components/brave_vpn/common/wireguard/win/service_commands.cc rename to browser/brave_vpn/win/service_commands.cc index 9c2736d8b106..bc47ab02de3f 100644 --- a/components/brave_vpn/common/wireguard/win/service_commands.cc +++ b/browser/brave_vpn/win/service_commands.cc @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/common/wireguard/win/service_commands.h" +#include "brave/browser/brave_vpn/win/service_commands.h" #include "base/command_line.h" #include "base/files/file_path.h" @@ -13,7 +13,7 @@ #include "base/process/process_handle.h" #include "base/process/process_iterator.h" #include "base/win/windows_types.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_constants.h" namespace brave_vpn { diff --git a/components/brave_vpn/common/wireguard/win/service_commands.h b/browser/brave_vpn/win/service_commands.h similarity index 63% rename from components/brave_vpn/common/wireguard/win/service_commands.h rename to browser/brave_vpn/win/service_commands.h index 40602b081847..0f264cc5e231 100644 --- a/components/brave_vpn/common/wireguard/win/service_commands.h +++ b/browser/brave_vpn/win/service_commands.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_COMMANDS_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_COMMANDS_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_COMMANDS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_COMMANDS_H_ #include @@ -12,4 +12,4 @@ namespace brave_vpn { void RunWireGuardCommandForUsers(const std::string& command); } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_COMMANDS_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_COMMANDS_H_ diff --git a/components/brave_vpn/common/wireguard/win/service_constants.h b/browser/brave_vpn/win/service_constants.h similarity index 84% rename from components/brave_vpn/common/wireguard/win/service_constants.h rename to browser/brave_vpn/win/service_constants.h index 5b9088dc2e44..93e7cb8b256a 100644 --- a/components/brave_vpn/common/wireguard/win/service_constants.h +++ b/browser/brave_vpn/win/service_constants.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_CONSTANTS_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_CONSTANTS_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_CONSTANTS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_CONSTANTS_H_ namespace brave_vpn { @@ -31,6 +31,7 @@ inline constexpr char kBraveVpnWireguardServiceNotifyConnectedSwitchName[] = // notifications. inline constexpr char kBraveVpnWireguardServiceNotifyDisconnectedSwitchName[] = "notify-disconnected"; + } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_CONSTANTS_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_CONSTANTS_H_ diff --git a/components/brave_vpn/common/wireguard/win/service_details.cc b/browser/brave_vpn/win/service_details.cc similarity index 58% rename from components/brave_vpn/common/wireguard/win/service_details.cc rename to browser/brave_vpn/win/service_details.cc index cd63a93ca078..3066503797e3 100644 --- a/components/brave_vpn/common/wireguard/win/service_details.cc +++ b/browser/brave_vpn/win/service_details.cc @@ -3,19 +3,21 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" +#include "brave/browser/brave_vpn/win/service_details.h" #include #include #include "base/containers/cxx20_erase.h" +#include "base/notreached.h" #include "base/path_service.h" -#include "brave/components/brave_vpn/common/buildflags/buildflags.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_constants.h" #include "build/build_config.h" -#include "chrome/install_static/install_util.h" -#include "components/version_info/version_info.h" +#include "chrome/common/channel_info.h" +#include "components/version_info/channel.h" + +using version_info::Channel; namespace brave_vpn { @@ -32,60 +34,70 @@ constexpr IID kBraveWireguardServiceIID = { 0x4e6c, {0xbb, 0xad, 0xf8, 0xda, 0x64, 0x36, 0xd9, 0x33}}; -#if BUILDFLAG(CHANNEL_NIGHTLY) -constexpr wchar_t kBraveWireguardTunnelServiceName[] = +constexpr wchar_t kBraveNightlyWireguardTunnelServiceName[] = L"BraveVpnNightlyWireguardTunnelService"; // A8D57D90-7A29-4405-91D7-A712F347E426 -constexpr CLSID kBraveWireguardServiceCLSID = { +constexpr CLSID kBraveNightlyWireguardServiceCLSID = { 0xa8d57d90, 0x7a29, 0x4405, {0x91, 0xd7, 0xa7, 0x12, 0xf3, 0x47, 0xe4, 0x26}}; -#elif BUILDFLAG(CHANNEL_BETA) -constexpr wchar_t kBraveWireguardTunnelServiceName[] = + +constexpr wchar_t kBraveBetaWireguardTunnelServiceName[] = L"BraveVpnBetaWireguardTunnelService"; // 93175676-5FAC-4D73-B1E1-5485003C9427 -constexpr CLSID kBraveWireguardServiceCLSID = { +constexpr CLSID kBraveBetaWireguardServiceCLSID = { 0x93175676, 0x5fac, 0x4d73, {0xb1, 0xe1, 0x54, 0x85, 0x00, 0x3c, 0x94, 0x27}}; -#elif BUILDFLAG(CHANNEL_DEV) -constexpr wchar_t kBraveWireguardTunnelServiceName[] = + +constexpr wchar_t kBraveDevWireguardTunnelServiceName[] = L"BraveVpnDevWireguardTunnelService"; // 52C95DE1-D7D9-4C03-A275-8A4517AFAE08 -constexpr CLSID kBraveWireguardServiceCLSID = { +constexpr CLSID kBraveDevWireguardServiceCLSID = { 0x52c95de1, 0xd7d9, 0x4c03, {0xa2, 0x75, 0x8a, 0x45, 0x17, 0xaf, 0xae, 0x08}}; -#elif BUILDFLAG(CHANNEL_DEVELOPMENT) -constexpr wchar_t kBraveWireguardTunnelServiceName[] = + +constexpr wchar_t kBraveDevelopmentWireguardTunnelServiceName[] = L"BraveVpnDevelopmentWireguardTunnelService"; // 57B73EDD-CBE4-46CA-8ACB-11D90840AF6E -constexpr CLSID kBraveWireguardServiceCLSID = { +constexpr CLSID kBraveDevelopmentWireguardServiceCLSID = { 0x57b73edd, 0xcbe4, 0x46ca, {0x8a, 0xcb, 0x11, 0xd9, 0x08, 0x40, 0xaf, 0x6e}}; -#else + constexpr wchar_t kBraveWireguardTunnelServiceName[] = L"BraveVpnWireguardTunnelService"; - // 088C5F6E-B213-4A8E-98AD-9D64D8913968 constexpr CLSID kBraveWireguardServiceCLSID = { 0x088c5f6e, 0xb213, 0x4a8e, {0x98, 0xad, 0x9d, 0x64, 0xd8, 0x91, 0x39, 0x68}}; -#endif } // namespace // Returns the Brave Vpn Service CLSID, IID, Name, and Display Name // respectively. const CLSID& GetBraveVpnWireguardServiceClsid() { - return kBraveWireguardServiceCLSID; + switch (chrome::GetChannel()) { + case Channel::CANARY: + return kBraveNightlyWireguardServiceCLSID; + case Channel::DEV: + return kBraveDevWireguardServiceCLSID; + case Channel::BETA: + return kBraveBetaWireguardServiceCLSID; + case Channel::STABLE: + return kBraveWireguardServiceCLSID; + case Channel::UNKNOWN: + return kBraveDevelopmentWireguardServiceCLSID; + } + + NOTREACHED_NORETURN(); } const IID& GetBraveVpnWireguardServiceIid() { @@ -93,9 +105,20 @@ const IID& GetBraveVpnWireguardServiceIid() { } std::wstring GetBraveVpnWireguardServiceDisplayName() { - static constexpr wchar_t kBraveWireguardServiceDisplayName[] = - L" Vpn Wireguard Service"; - return install_static::GetBaseAppName() + kBraveWireguardServiceDisplayName; + switch (chrome::GetChannel()) { + case Channel::CANARY: + return L"Brave Nightly Vpn Wireguard Service"; + case Channel::DEV: + return L"Brave Dev Vpn Wireguard Service"; + case Channel::BETA: + return L"Brave Beta Vpn Wireguard Service"; + case Channel::STABLE: + return L"Brave Vpn Wireguard Service"; + case Channel::UNKNOWN: + return L"Brave Development Vpn Wireguard Service"; + } + + NOTREACHED_NORETURN(); } std::wstring GetBraveVpnWireguardServiceName() { @@ -105,10 +128,22 @@ std::wstring GetBraveVpnWireguardServiceName() { } std::wstring GetBraveVpnWireguardTunnelServiceName() { - return kBraveWireguardTunnelServiceName; + switch (chrome::GetChannel()) { + case Channel::CANARY: + return kBraveNightlyWireguardTunnelServiceName; + case Channel::DEV: + return kBraveDevWireguardTunnelServiceName; + case Channel::BETA: + return kBraveBetaWireguardTunnelServiceName; + case Channel::STABLE: + return kBraveWireguardTunnelServiceName; + case Channel::UNKNOWN: + return kBraveDevelopmentWireguardTunnelServiceName; + } + + NOTREACHED_NORETURN(); } -// only used by `chromium_src/chrome/installer/setup/install_worker.cc` base::FilePath GetBraveVPNWireguardServiceInstallationPath( const base::FilePath& target_path, const base::Version& version) { diff --git a/components/brave_vpn/common/wireguard/win/service_details.h b/browser/brave_vpn/win/service_details.h similarity index 79% rename from components/brave_vpn/common/wireguard/win/service_details.h rename to browser/brave_vpn/win/service_details.h index 4f9478f94c27..1e3c4dfdd5c3 100644 --- a/components/brave_vpn/common/wireguard/win/service_details.h +++ b/browser/brave_vpn/win/service_details.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_DETAILS_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_DETAILS_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_DETAILS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_DETAILS_H_ #include #include @@ -24,4 +24,4 @@ base::FilePath GetBraveVPNWireguardServiceInstallationPath( base::FilePath GetBraveVPNWireguardServiceExecutablePath(); } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_SERVICE_DETAILS_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_SERVICE_DETAILS_H_ diff --git a/components/brave_vpn/common/wireguard/win/storage_utils.cc b/browser/brave_vpn/win/storage_utils.cc similarity index 95% rename from components/brave_vpn/common/wireguard/win/storage_utils.cc rename to browser/brave_vpn/win/storage_utils.cc index eabf6f910ea3..bd1b4b8a1248 100644 --- a/components/brave_vpn/common/wireguard/win/storage_utils.cc +++ b/browser/brave_vpn/win/storage_utils.cc @@ -3,15 +3,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" #include #include "base/logging.h" #include "base/win/registry.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" +#include "brave/browser/brave_vpn/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_details.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" namespace brave_vpn { diff --git a/components/brave_vpn/common/wireguard/win/storage_utils.h b/browser/brave_vpn/win/storage_utils.h similarity index 81% rename from components/brave_vpn/common/wireguard/win/storage_utils.h rename to browser/brave_vpn/win/storage_utils.h index b0750cd20bac..cd21623d1ef2 100644 --- a/components/brave_vpn/common/wireguard/win/storage_utils.h +++ b/browser/brave_vpn/win/storage_utils.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_STORAGE_UTILS_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_STORAGE_UTILS_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_STORAGE_UTILS_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_STORAGE_UTILS_H_ #include @@ -31,7 +31,6 @@ void ResetWireguardTunnelUsageFlag(); void WriteConnectionState(int state); std::optional GetConnectionState(); - } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_STORAGE_UTILS_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_STORAGE_UTILS_H_ diff --git a/components/brave_vpn/common/wireguard/win/storage_utils_unittest.cc b/browser/brave_vpn/win/storage_utils_unittest.cc similarity index 93% rename from components/brave_vpn/common/wireguard/win/storage_utils_unittest.cc rename to browser/brave_vpn/win/storage_utils_unittest.cc index ddbf10a4f78b..84311537dc3f 100644 --- a/components/brave_vpn/common/wireguard/win/storage_utils_unittest.cc +++ b/browser/brave_vpn/win/storage_utils_unittest.cc @@ -3,13 +3,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" #include "base/test/test_reg_util_win.h" #include "base/win/registry.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" -#include "testing/gmock/include/gmock/gmock.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" +#include "components/version_info/channel.h" #include "testing/gtest/include/gtest/gtest.h" +using version_info::Channel; + namespace brave_vpn { TEST(StorageUtilsUnitTest, IsVPNTrayIconEnabled) { diff --git a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.cc b/browser/brave_vpn/win/wireguard_utils_win.cc similarity index 96% rename from components/brave_vpn/common/wireguard/win/wireguard_utils_win.cc rename to browser/brave_vpn/win/wireguard_utils_win.cc index a2b7883fcecd..ffb9f6055e2c 100644 --- a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.cc +++ b/browser/brave_vpn/win/wireguard_utils_win.cc @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" #include #include @@ -24,8 +24,8 @@ #include "base/win/scoped_bstr.h" #include "brave/components/brave_vpn/common/win/utils.h" #include "brave/components/brave_vpn/common/wireguard/win/brave_wireguard_manager_idl.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" +#include "brave/browser/brave_vpn/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_details.h" namespace brave_vpn { diff --git a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h b/browser/brave_vpn/win/wireguard_utils_win.h similarity index 66% rename from components/brave_vpn/common/wireguard/win/wireguard_utils_win.h rename to browser/brave_vpn/win/wireguard_utils_win.h index ce78cf236387..9ee1c07ce850 100644 --- a/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h +++ b/browser/brave_vpn/win/wireguard_utils_win.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at https://mozilla.org/MPL/2.0/. */ -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_WIREGUARD_UTILS_WIN_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_WIREGUARD_UTILS_WIN_H_ +#ifndef BRAVE_BROWSER_BRAVE_VPN_WIN_WIREGUARD_UTILS_WIN_H_ +#define BRAVE_BROWSER_BRAVE_VPN_WIN_WIREGUARD_UTILS_WIN_H_ #include #include @@ -20,12 +20,6 @@ namespace wireguard { bool IsBraveVPNWireguardTunnelServiceRunning(); bool IsWireguardServiceInstalled(); void WireguardGenerateKeypair(WireguardGenerateKeypairCallback callback); -std::optional CreateWireguardConfig( - const std::string& client_private_key, - const std::string& server_public_key, - const std::string& vpn_server_hostname, - const std::string& mapped_ipv4_address, - const std::string& dns_servers); void EnableBraveVpnWireguardService(const std::string& config, BooleanCallback callback); void DisableBraveVpnWireguardService(BooleanCallback callback); @@ -37,4 +31,4 @@ void ShowBraveVpnStatusTrayIcon(); } // namespace brave_vpn -#endif // BRAVE_COMPONENTS_BRAVE_VPN_COMMON_WIREGUARD_WIN_WIREGUARD_UTILS_WIN_H_ +#endif // BRAVE_BROWSER_BRAVE_VPN_WIN_WIREGUARD_UTILS_WIN_H_ diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index 892555d320c8..231ab598d2d9 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -417,6 +417,8 @@ source_set("ui") { "webui/settings/brave_vpn/brave_vpn_handler.cc", "webui/settings/brave_vpn/brave_vpn_handler.h", ] + + deps += [ "//brave/browser/brave_vpn/win:wireguard_utils" ] } } if (enable_ai_chat) { @@ -633,6 +635,7 @@ source_set("ui") { if (enable_brave_vpn) { deps += [ + "//brave/browser/brave_vpn", "//brave/components/brave_vpn/browser", "//brave/components/brave_vpn/browser/connection:api", "//brave/components/brave_vpn/common", @@ -641,7 +644,6 @@ source_set("ui") { deps += [ "//brave/components/brave_vpn/common/win", "//brave/components/brave_vpn/common/wireguard", - "//brave/components/brave_vpn/common/wireguard/win", ] } } diff --git a/browser/ui/browser_commands.cc b/browser/ui/browser_commands.cc index 8d4023b9bdcd..bd62aa0102e6 100644 --- a/browser/ui/browser_commands.cc +++ b/browser/ui/browser_commands.cc @@ -39,6 +39,7 @@ #include "chrome/browser/ui/tabs/tab_group_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_utils.h" +#include "chrome/common/channel_info.h" #include "chrome/common/pref_names.h" #include "components/tab_groups/tab_group_visual_data.h" #include "content/public/browser/browser_thread.h" @@ -71,15 +72,14 @@ #include "brave/components/brave_vpn/common/pref_names.h" #if BUILDFLAG(IS_WIN) -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" #endif // BUILDFLAG(ENABLE_BRAVE_VPN) #endif // BUILDFLAG(ENABLE_BRAVE_VPN) #if BUILDFLAG(ENABLE_IPFS_LOCAL_NODE) #include "brave/components/ipfs/ipfs_utils.h" -#include "chrome/common/channel_info.h" #endif using content::WebContents; diff --git a/browser/ui/toolbar/brave_vpn_menu_model.cc b/browser/ui/toolbar/brave_vpn_menu_model.cc index ff5de50d6b8c..9eadc49cd504 100644 --- a/browser/ui/toolbar/brave_vpn_menu_model.cc +++ b/browser/ui/toolbar/brave_vpn_menu_model.cc @@ -17,7 +17,7 @@ #include "components/prefs/pref_service.h" #if BUILDFLAG(IS_WIN) -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" #endif BraveVPNMenuModel::BraveVPNMenuModel(Browser* browser, diff --git a/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc b/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc index 945959394cd7..efe6a0cb85e7 100644 --- a/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc +++ b/browser/ui/webui/settings/brave_vpn/brave_vpn_handler.cc @@ -13,16 +13,15 @@ #include "base/process/launch.h" #include "base/task/thread_pool.h" #include "brave/browser/brave_vpn/brave_vpn_service_factory.h" +#include "brave/browser/brave_vpn/win/service_constants.h" +#include "brave/browser/brave_vpn/win/service_details.h" +#include "brave/browser/brave_vpn/win/storage_utils.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" #include "brave/components/brave_vpn/browser/brave_vpn_service.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #include "brave/components/brave_vpn/common/pref_names.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_constants.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" #include "chrome/browser/browser_process.h" #include "components/prefs/pref_service.h" -#include "components/version_info/version_info.h" BraveVpnHandler::BraveVpnHandler(Profile* profile) : profile_(profile) { auto* service = brave_vpn::BraveVpnServiceFactory::GetForProfile(profile); diff --git a/build/win/BUILD.gn b/build/win/BUILD.gn index 6b5d66f35f60..39af76bc57de 100644 --- a/build/win/BUILD.gn +++ b/build/win/BUILD.gn @@ -12,7 +12,10 @@ group("brave") { ":copy_pdb", ] if (enable_brave_vpn) { - deps = [ "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:wireguard_service" ] + deps = [ + "//brave/browser/brave_vpn/win/brave_vpn_helper", + "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:wireguard_service", + ] } } diff --git a/chromium_src/chrome/browser/prefs/browser_prefs.cc b/chromium_src/chrome/browser/prefs/browser_prefs.cc index cfdff6f68de9..2ad12c6445c6 100644 --- a/chromium_src/chrome/browser/prefs/browser_prefs.cc +++ b/chromium_src/chrome/browser/prefs/browser_prefs.cc @@ -25,6 +25,7 @@ #include "brave/components/p3a/star_randomness_meta.h" #include "brave/components/tor/buildflags/buildflags.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/channel_info.h" #include "chrome/common/pref_names.h" #include "components/gcm_driver/gcm_buildflags.h" #include "components/translate/core/browser/translate_prefs.h" diff --git a/chromium_src/chrome/elevation_service/DEPS b/chromium_src/chrome/elevation_service/DEPS index 34c4b3361625..dacb8bd41b3e 100644 --- a/chromium_src/chrome/elevation_service/DEPS +++ b/chromium_src/chrome/elevation_service/DEPS @@ -1,8 +1,9 @@ include_rules = [ + "+brave/browser/brave_vpn/win/brave_vpn_helper", "+brave/browser/brave_vpn/win/brave_vpn_wireguard_service", + "+brave/browser/brave_vpn/win/wireguard_utils_win.h", "+brave/components/brave_vpn/browser/connection/ikev2/win", "+brave/components/brave_vpn/common/buildflags", - "+brave/components/brave_vpn/common/wireguard/win", "+brave/elevation_service", "+brave/installer/setup/brave_vpn", "+chrome/installer/util", diff --git a/chromium_src/chrome/elevation_service/elevator.cc b/chromium_src/chrome/elevation_service/elevator.cc index 3acafcab3683..b40255c281eb 100644 --- a/chromium_src/chrome/elevation_service/elevator.cc +++ b/chromium_src/chrome/elevation_service/elevator.cc @@ -14,9 +14,12 @@ #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #if BUILDFLAG(ENABLE_BRAVE_VPN) +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" + +#if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" +#include "brave/browser/brave_vpn/win/wireguard_utils_win.h" +#endif #endif #include "src/chrome/elevation_service/elevator.cc" @@ -32,12 +35,14 @@ HRESULT Elevator::InstallVPNServices() { } } +#if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) if (!brave_vpn::wireguard::IsWireguardServiceInstalled()) { auto success = brave_vpn::InstallBraveWireguardService(); if (!success) { return E_FAIL; } } +#endif #endif return S_OK; } diff --git a/chromium_src/chrome/installer/DEPS b/chromium_src/chrome/installer/DEPS index 74e1d93cea49..69a45ebcb543 100644 --- a/chromium_src/chrome/installer/DEPS +++ b/chromium_src/chrome/installer/DEPS @@ -1,9 +1,9 @@ include_rules = [ + "+brave/browser/brave_vpn/win/brave_vpn_helper", "+brave/browser/brave_vpn/win/brave_vpn_wireguard_service", + "+brave/browser/brave_vpn/win/service_details.h", "+brave/components/brave_vpn/browser/connection/ikev2/win", - "+brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper", "+brave/components/brave_vpn/common/buildflags", - "+brave/components/brave_vpn/common/wireguard/win", "+brave/installer", "+chrome/common", "+chrome/install_static", diff --git a/chromium_src/chrome/installer/setup/install_worker.cc b/chromium_src/chrome/installer/setup/install_worker.cc index bbcacbb4687e..6c2beafdd0ac 100644 --- a/chromium_src/chrome/installer/setup/install_worker.cc +++ b/chromium_src/chrome/installer/setup/install_worker.cc @@ -36,9 +36,9 @@ #endif #if BUILDFLAG(ENABLE_BRAVE_VPN) +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" namespace { @@ -60,7 +60,7 @@ void AddUninstallVpnServiceWorkItems() { // delete `BraveVpnService` from services if (!installer::InstallServiceWorkItem::DeleteService( brave_vpn::GetBraveVpnHelperServiceName(), - brave_vpn::kBraveVpnHelperRegistryStoragePath, {}, {})) { + brave_vpn::GetBraveVpnHelperRegistryStoragePath(), {}, {})) { VLOG(1) << "Failed to delete " << brave_vpn::GetBraveVpnHelperServiceName(); } } @@ -95,19 +95,20 @@ bool OneTimeVpnServiceCleanup(const base::FilePath& target_path, // Check registry for `ran` value. // Only run the clean up logic if this hasn't ran yet. base::win::RegKey key; - LONG rv = key.Create(HKEY_LOCAL_MACHINE, - brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, - KEY_ALL_ACCESS); + LONG rv = key.Create( + HKEY_LOCAL_MACHINE, + brave_vpn::GetBraveVpnOneTimeServiceCleanupStoragePath().c_str(), + KEY_ALL_ACCESS); if (rv != ERROR_SUCCESS) { VLOG(1) << "Failed to open registry key:" - << brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath << "\n" + << brave_vpn::GetBraveVpnOneTimeServiceCleanupStoragePath() << "\n" << logging::SystemErrorCodeToString(rv); return false; } if (!key.Valid()) { VLOG(1) << "Registry key not valid:" - << brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath; + << brave_vpn::GetBraveVpnOneTimeServiceCleanupStoragePath(); return false; } @@ -133,7 +134,7 @@ bool OneTimeVpnServiceCleanup(const base::FilePath& target_path, &cleanup_ran, REG_DWORD, sizeof(DWORD)); if (rv != ERROR_SUCCESS) { VLOG(1) << "Failed to write registry key value: " - << brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath << ":" + << brave_vpn::GetBraveVpnOneTimeServiceCleanupStoragePath() << ":" << brave_vpn::kBraveVpnOneTimeServiceCleanupValue << "\n" << logging::SystemErrorCodeToString(rv); } diff --git a/chromium_src/chrome/installer/setup/sources.gni b/chromium_src/chrome/installer/setup/sources.gni index d8918673b4c1..62a7aaee6003 100644 --- a/chromium_src/chrome/installer/setup/sources.gni +++ b/chromium_src/chrome/installer/setup/sources.gni @@ -10,17 +10,20 @@ brave_chromium_src_chrome_installer_setup_deps = [] if (is_win) { brave_chromium_src_chrome_installer_setup_deps += [ - "//brave/components/brave_vpn/common", + "//brave/components/brave_vpn/common/buildflags", "//brave/installer/util", + "//chrome/installer/util:work_item", ] + if (enable_brave_vpn) { brave_chromium_src_chrome_installer_setup_deps += [ + "//brave/browser/brave_vpn/win:wireguard_utils", + "//brave/browser/brave_vpn/win/brave_vpn_helper:common", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:install_utils", "//brave/components/brave_vpn/browser/connection/ikev2/win:ras_utils", - "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", - "//brave/components/brave_vpn/common/wireguard/win", ] } + if (is_official_build) { # These should be added to the lib target, but don't want to add another # patch. diff --git a/chromium_src/chrome/installer/setup/test/BUILD.gn b/chromium_src/chrome/installer/setup/test/BUILD.gn index a16d18e4605a..9fc8a96662f6 100644 --- a/chromium_src/chrome/installer/setup/test/BUILD.gn +++ b/chromium_src/chrome/installer/setup/test/BUILD.gn @@ -13,9 +13,10 @@ if (enable_brave_vpn && is_win) { deps = [ "//base", "//base/test:test_support", - "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", + "//brave/browser/brave_vpn/win/brave_vpn_helper:common", "//brave/components/brave_vpn/common/buildflags:buildflags", "//chrome/chrome_elf:nt_registry", + "//chrome/install_static:install_static_util", "//chrome/installer/setup:lib", "//chrome/installer/util:with_no_strings", "//testing/gmock", diff --git a/chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc b/chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc index c3ef6377ddf7..1f08b3a211da 100644 --- a/chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc +++ b/chromium_src/chrome/installer/setup/test/install_worker_vpn_unittest.cc @@ -9,9 +9,11 @@ #include "base/test/test_reg_util_win.h" #include "base/version.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "chrome/chrome_elf/nt_registry/nt_registry.h" +#include "chrome/install_static/product_install_details.h" #include "chrome/installer/util/set_reg_value_work_item.h" #include "chrome/installer/util/work_item_list.h" #include "testing/gmock/include/gmock/gmock.h" @@ -25,7 +27,9 @@ class BraveSetupInstallWorkerTest : public testing::Test { public: BraveSetupInstallWorkerTest() : example_version_(base::Version("1.0.0.0")), - example_path_(FILE_PATH_LITERAL("elevation_service.exe")) {} + example_path_(FILE_PATH_LITERAL("elevation_service.exe")) { + install_static::InitializeProductDetailsForPrimaryModule(); + } protected: base::Version example_version_; @@ -110,9 +114,10 @@ TEST_F(BraveSetupInstallWorkerTest, CleanupAlreadyRan) { ScopedNTRegistryTestingOverride nt_override(nt::HKLM, temp); // Write out a value `1` (simulating already ran) - base::win::RegKey key(HKEY_LOCAL_MACHINE, - brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, - KEY_ALL_ACCESS); + base::win::RegKey key( + HKEY_LOCAL_MACHINE, + brave_vpn::GetBraveVpnOneTimeServiceCleanupStoragePath().c_str(), + KEY_ALL_ACCESS); DWORD cleanup_ran = 1; key.WriteValue(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, cleanup_ran); @@ -134,9 +139,10 @@ TEST_F(BraveSetupInstallWorkerTest, CleanupNotRanYetNoKey) { example_path_, example_version_, &work_item_list, true)); // Ensure it set `ran` to `1` - base::win::RegKey key(HKEY_LOCAL_MACHINE, - brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, - KEY_ALL_ACCESS); + base::win::RegKey key( + HKEY_LOCAL_MACHINE, + brave_vpn::GetBraveVpnOneTimeServiceCleanupStoragePath().c_str(), + KEY_ALL_ACCESS); DWORD cleanup_ran = 0; LONG rv = key.ReadValueDW(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, &cleanup_ran); @@ -153,9 +159,10 @@ TEST_F(BraveSetupInstallWorkerTest, CleanupNotRanKeyExists) { ScopedNTRegistryTestingOverride nt_override(nt::HKLM, temp); // Write out a value `0` (ex: not `1`) - base::win::RegKey key(HKEY_LOCAL_MACHINE, - brave_vpn::kBraveVpnOneTimeServiceCleanupStoragePath, - KEY_ALL_ACCESS); + base::win::RegKey key( + HKEY_LOCAL_MACHINE, + brave_vpn::GetBraveVpnOneTimeServiceCleanupStoragePath().c_str(), + KEY_ALL_ACCESS); DWORD cleanup_ran = 0; key.WriteValue(brave_vpn::kBraveVpnOneTimeServiceCleanupValue, cleanup_ran); diff --git a/chromium_src/chrome/installer/setup/uninstall.cc b/chromium_src/chrome/installer/setup/uninstall.cc index bfac0213fec0..6afde77ed316 100644 --- a/chromium_src/chrome/installer/setup/uninstall.cc +++ b/chromium_src/chrome/installer/setup/uninstall.cc @@ -17,11 +17,11 @@ #include "chrome/installer/util/work_item.h" #if BUILDFLAG(ENABLE_BRAVE_VPN) +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_constants.h" +#include "brave/browser/brave_vpn/win/brave_vpn_helper/brave_vpn_helper_utils.h" #include "brave/browser/brave_vpn/win/brave_vpn_wireguard_service/install_utils.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h" -#include "brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_utils.h" +#include "brave/browser/brave_vpn/win/service_details.h" #include "brave/components/brave_vpn/browser/connection/ikev2/win/ras_utils.h" -#include "brave/components/brave_vpn/common/wireguard/win/service_details.h" #endif #define UninstallProduct UninstallProduct_ChromiumImpl @@ -90,7 +90,7 @@ InstallStatus UninstallProduct(const ModifyParams& modify_params, // TODO(bsclifton): move this to a method if (!InstallServiceWorkItem::DeleteService( brave_vpn::GetBraveVpnHelperServiceName(), - brave_vpn::kBraveVpnHelperRegistryStoragePath, {}, {})) { + brave_vpn::GetBraveVpnHelperRegistryStoragePath(), {}, {})) { LOG(WARNING) << "Failed to delete " << brave_vpn::GetBraveVpnHelperServiceName(); } diff --git a/components/brave_vpn/browser/BUILD.gn b/components/brave_vpn/browser/BUILD.gn index c813df758f3d..e257e34d8fc6 100644 --- a/components/brave_vpn/browser/BUILD.gn +++ b/components/brave_vpn/browser/BUILD.gn @@ -11,6 +11,7 @@ static_library("browser") { sources = [ "brave_vpn_service.cc", "brave_vpn_service.h", + "brave_vpn_service_delegate.h", "brave_vpn_service_helper.cc", "brave_vpn_service_helper.h", "brave_vpn_service_observer.cc", @@ -36,13 +37,9 @@ static_library("browser") { "//components/prefs", "//components/version_info", "//services/network/public/cpp", - "//third_party/abseil-cpp:absl", "//ui/base", "//url", ] - if (is_win) { - deps += [ "//brave/components/brave_vpn/common/wireguard/win" ] - } } source_set("unit_tests") { @@ -70,7 +67,6 @@ source_set("unit_tests") { "//services/network:test_support", "//testing/gmock", "//testing/gtest", - "//third_party/abseil-cpp:absl", ] if (!is_android) { deps += [ @@ -78,7 +74,4 @@ source_set("unit_tests") { "//brave/components/brave_vpn/browser/connection/ikev2:sim", ] } - if (is_win) { - deps += [ "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:unit_tests" ] - } } diff --git a/components/brave_vpn/browser/api/BUILD.gn b/components/brave_vpn/browser/api/BUILD.gn index b010f5378f0b..8871a61e49d5 100644 --- a/components/brave_vpn/browser/api/BUILD.gn +++ b/components/brave_vpn/browser/api/BUILD.gn @@ -44,6 +44,5 @@ source_set("unit_tests") { "//base", "//brave/components/brave_vpn/common", "//testing/gtest", - "//third_party/abseil-cpp:absl", ] } diff --git a/components/brave_vpn/browser/brave_vpn_service.cc b/components/brave_vpn/browser/brave_vpn_service.cc index d1874bf2b163..1296f7c6f84c 100644 --- a/components/brave_vpn/browser/brave_vpn_service.cc +++ b/components/brave_vpn/browser/brave_vpn_service.cc @@ -7,7 +7,6 @@ #include #include -#include #include "base/base64.h" #include "base/check_is_test.h" @@ -24,7 +23,6 @@ #include "brave/components/brave_vpn/common/brave_vpn_constants.h" #include "brave/components/brave_vpn/common/brave_vpn_utils.h" #include "brave/components/brave_vpn/common/pref_names.h" -#include "brave/components/brave_vpn/common/wireguard/win/storage_utils.h" #include "brave/components/p3a_utils/feature_usage.h" #include "brave/components/skus/browser/skus_utils.h" #include "brave/components/version_info/version_info.h" @@ -37,10 +35,6 @@ #include "ui/base/l10n/l10n_util.h" #include "url/url_util.h" -#if BUILDFLAG(IS_WIN) -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" -#endif - namespace brave_vpn { using ConnectionState = mojom::ConnectionState; @@ -137,7 +131,9 @@ void BraveVpnService::OnConnectionStateChanged(mojom::ConnectionState state) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); VLOG(2) << __func__ << " " << state; #if BUILDFLAG(IS_WIN) - WriteConnectionState(static_cast(state)); + if (delegate_) { + delegate_->WriteConnectionState(state); + } #endif // Ignore connection state change request for non purchased user. // This can be happened when user controls vpn via os settings. @@ -154,7 +150,9 @@ void BraveVpnService::OnConnectionStateChanged(mojom::ConnectionState state) { #if BUILDFLAG(IS_WIN) // Run tray process each time we establish connection. System tray icon // manages self state to be visible/hidden due to settings. - wireguard::ShowBraveVpnStatusTrayIcon(); + if (delegate_) { + delegate_->ShowBraveVpnStatusTrayIcon(); + } #endif RecordP3A(true); } diff --git a/components/brave_vpn/browser/brave_vpn_service.h b/components/brave_vpn/browser/brave_vpn_service.h index 768f08ce9521..1e29784f3776 100644 --- a/components/brave_vpn/browser/brave_vpn_service.h +++ b/components/brave_vpn/browser/brave_vpn_service.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "base/functional/callback_forward.h" @@ -19,6 +20,7 @@ #include "base/timer/timer.h" #include "base/values.h" #include "brave/components/brave_vpn/browser/api/brave_vpn_api_request.h" +#include "brave/components/brave_vpn/browser/brave_vpn_service_delegate.h" #include "brave/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h" #include "brave/components/brave_vpn/common/brave_vpn_data_types.h" #include "brave/components/brave_vpn/common/mojom/brave_vpn.mojom.h" @@ -47,6 +49,8 @@ class BraveBrowserCommandControllerTest; namespace brave_vpn { +class BraveVPNServiceDelegate; + inline constexpr char kNewUserReturningHistogramName[] = "Brave.VPN.NewUserReturning"; inline constexpr char kDaysInMonthUsedHistogramName[] = @@ -149,6 +153,10 @@ class BraveVpnService : const std::string& bundle_id); void GetSubscriberCredentialV12(ResponseCallback callback); + void set_delegate(std::unique_ptr delegate) { + delegate_ = std::move(delegate); + } + // new_usage should be set to true if a new VPN connection was just // established. void RecordP3A(bool new_usage); @@ -230,6 +238,7 @@ class BraveVpnService : std::optional purchased_state_; mojo::RemoteSet observers_; std::unique_ptr api_request_; + std::unique_ptr delegate_; base::RepeatingTimer p3a_timer_; base::OneShotTimer subs_cred_refresh_timer_; base::WeakPtrFactory weak_ptr_factory_{this}; diff --git a/components/brave_vpn/browser/brave_vpn_service_delegate.h b/components/brave_vpn/browser/brave_vpn_service_delegate.h new file mode 100644 index 000000000000..7d492ad6e78f --- /dev/null +++ b/components/brave_vpn/browser/brave_vpn_service_delegate.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2024 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_BRAVE_VPN_SERVICE_DELEGATE_H_ +#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_BRAVE_VPN_SERVICE_DELEGATE_H_ + +#include "brave/components/brave_vpn/common/mojom/brave_vpn.mojom.h" + +namespace brave_vpn { + +class BraveVPNServiceDelegate { + public: + BraveVPNServiceDelegate() = default; + virtual ~BraveVPNServiceDelegate() = default; + + BraveVPNServiceDelegate(const BraveVPNServiceDelegate&) = delete; + BraveVPNServiceDelegate& operator=(const BraveVPNServiceDelegate&) = delete; + + virtual void WriteConnectionState(mojom::ConnectionState state) = 0; + virtual void ShowBraveVpnStatusTrayIcon() = 0; +}; + +} // namespace brave_vpn + +#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_BRAVE_VPN_SERVICE_DELEGATE_H_ diff --git a/components/brave_vpn/browser/connection/BUILD.gn b/components/brave_vpn/browser/connection/BUILD.gn index 26264ff19384..7b0419ca6b08 100644 --- a/components/brave_vpn/browser/connection/BUILD.gn +++ b/components/brave_vpn/browser/connection/BUILD.gn @@ -21,6 +21,7 @@ source_set("api") { "//brave/components/brave_vpn/common/buildflags", "//brave/components/brave_vpn/common/mojom", "//components/prefs", + "//components/version_info:channel", "//net", "//services/network/public/cpp", ] @@ -33,7 +34,6 @@ group("connection") { ] if (is_win) { deps += [ "ikev2/win" ] - deps += [ "wireguard/win" ] } if (is_mac) { diff --git a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc index 7e70f76b99ab..28be5ab4e26c 100644 --- a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc +++ b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.cc @@ -27,38 +27,6 @@ namespace brave_vpn { -std::unique_ptr CreateBraveVPNIKEv2ConnectionAPI( - scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel, - base::RepeatingCallback service_installer); - -std::unique_ptr CreateBraveVPNWireguardConnectionAPI( - scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel, - base::RepeatingCallback service_installer); - -std::unique_ptr CreateBraveVPNConnectionAPI( - scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel, - base::RepeatingCallback service_installer) { -#if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) - if (IsBraveVPNWireguardEnabled(local_prefs)) { - return CreateBraveVPNWireguardConnectionAPI(url_loader_factory, local_prefs, - channel, service_installer); - } -#endif -#if BUILDFLAG(IS_ANDROID) - // Android doesn't use connection api. - return nullptr; -#else - return CreateBraveVPNIKEv2ConnectionAPI(url_loader_factory, local_prefs, - channel, service_installer); -#endif -} - BraveVPNOSConnectionAPI::BraveVPNOSConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs) @@ -312,7 +280,7 @@ void BraveVPNOSConnectionAPI::OnInstallSystemServicesCompleted(bool success) { #if BUILDFLAG(IS_WIN) // Update prefs first before signaling the event because the event could // check the prefs. - UpdateWireguardEnabledPrefsIfNeeded(local_prefs_); + EnableWireguardIfPossible(local_prefs_); #endif system_service_installed_event_.Signal(); } diff --git a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h index 7c5226f479d1..af0da44ec16a 100644 --- a/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h +++ b/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h @@ -24,10 +24,6 @@ namespace network { class SharedURLLoaderFactory; } // namespace network -namespace version_info { -enum class Channel; -} // namespace version_info - class PrefService; namespace brave_vpn { @@ -65,6 +61,11 @@ class BraveVPNOSConnectionAPI std::string GetLastConnectionError() const; void ToggleConnection(); + std::string target_vpn_entry_name() const { return target_vpn_entry_name_; } + void set_target_vpn_entry_name(const std::string& name) { + target_vpn_entry_name_ = name; + } + // Connection dependent APIs. virtual void Connect() = 0; virtual void Disconnect() = 0; @@ -157,18 +158,10 @@ class BraveVPNOSConnectionAPI // AND they did a system level install, we should call // install_system_service_callback_ once per browser open. base::OneShotEvent system_service_installed_event_; + std::string target_vpn_entry_name_; base::WeakPtrFactory weak_factory_; }; -// Create platform specific api instance. -// NOTE: Don't call this method directly. -// Only BraveBrowserProcess need to use this method. -std::unique_ptr CreateBraveVPNConnectionAPI( - scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel, - base::RepeatingCallback service_installer); - } // namespace brave_vpn #endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_BRAVE_VPN_OS_CONNECTION_API_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/BUILD.gn b/components/brave_vpn/browser/connection/ikev2/BUILD.gn index ef93f10bfcb1..870c6e06de4b 100644 --- a/components/brave_vpn/browser/connection/ikev2/BUILD.gn +++ b/components/brave_vpn/browser/connection/ikev2/BUILD.gn @@ -60,6 +60,5 @@ source_set("unit_tests") { "//content/test:test_support", "//services/network:test_support", "//testing/gtest", - "//third_party/abseil-cpp:absl", ] } diff --git a/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.cc b/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.cc index 2757f44964ad..fc356450ebe1 100644 --- a/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.cc +++ b/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.cc @@ -21,10 +21,8 @@ using ConnectionState = mojom::ConnectionState; BraveVPNOSConnectionAPIBase::BraveVPNOSConnectionAPIBase( scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel) - : BraveVPNOSConnectionAPI(url_loader_factory, local_prefs), - target_vpn_entry_name_(GetBraveVPNEntryName(channel)) {} + PrefService* local_prefs) + : BraveVPNOSConnectionAPI(url_loader_factory, local_prefs) {} BraveVPNOSConnectionAPIBase::~BraveVPNOSConnectionAPIBase() = default; @@ -131,7 +129,7 @@ void BraveVPNOSConnectionAPIBase::Disconnect() { if (GetConnectionState() != ConnectionState::CONNECTING) { VLOG(2) << __func__ << " : start disconnecting!"; UpdateAndNotifyConnectionStateChange(ConnectionState::DISCONNECTING); - DisconnectImpl(target_vpn_entry_name_); + DisconnectImpl(target_vpn_entry_name()); return; } @@ -147,7 +145,7 @@ void BraveVPNOSConnectionAPIBase::Disconnect() { } void BraveVPNOSConnectionAPIBase::CheckConnection() { - CheckConnectionImpl(target_vpn_entry_name_); + CheckConnectionImpl(target_vpn_entry_name()); } void BraveVPNOSConnectionAPIBase::ResetConnectionInfo() { @@ -165,7 +163,7 @@ void BraveVPNOSConnectionAPIBase::OnCreated() { } // It's time to ask connecting to os after vpn entry is created. - ConnectImpl(target_vpn_entry_name_); + ConnectImpl(target_vpn_entry_name()); } void BraveVPNOSConnectionAPIBase::OnCreateFailed() { @@ -186,7 +184,7 @@ void BraveVPNOSConnectionAPIBase::OnConnected() { // As connect is done, we don't need more for cancelling. // Just start normal Disconenct() process. cancel_connecting_ = false; - DisconnectImpl(target_vpn_entry_name_); + DisconnectImpl(target_vpn_entry_name()); return; } @@ -321,7 +319,7 @@ void BraveVPNOSConnectionAPIBase::OnGetProfileCredentials( return; } - connection_info_.SetConnectionInfo(target_vpn_entry_name_, GetHostname(), + connection_info_.SetConnectionInfo(target_vpn_entry_name(), GetHostname(), *username, *password); // Let's create os vpn entry with |connection_info_|. CreateVPNConnection(); diff --git a/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.h b/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.h index c141164f68f1..d28522acd5a3 100644 --- a/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.h +++ b/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_base.h @@ -52,8 +52,7 @@ class BraveVPNOSConnectionAPIBase : public BraveVPNOSConnectionAPI { protected: BraveVPNOSConnectionAPIBase( scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel); + PrefService* local_prefs); ~BraveVPNOSConnectionAPIBase() override; // Subclass should add platform dependent impls. @@ -73,8 +72,6 @@ class BraveVPNOSConnectionAPIBase : public BraveVPNOSConnectionAPI { void OnIsDisconnecting(); bool MaybeReconnect(); - std::string target_vpn_entry_name() const { return target_vpn_entry_name_; } - private: friend class BraveVPNRegionDataManager; friend class BraveVPNOSConnectionAPISim; @@ -108,7 +105,6 @@ class BraveVPNOSConnectionAPIBase : public BraveVPNOSConnectionAPI { bool cancel_connecting_ = false; bool needs_connect_ = false; bool prevent_creation_ = false; - std::string target_vpn_entry_name_; BraveVPNConnectionInfo connection_info_; }; diff --git a/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_sim.cc b/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_sim.cc index bc78856edd03..fa57a7f8e931 100644 --- a/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_sim.cc +++ b/components/brave_vpn/browser/connection/ikev2/brave_vpn_ras_connection_api_sim.cc @@ -13,16 +13,13 @@ #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" #include "brave/components/brave_vpn/browser/connection/brave_vpn_os_connection_api.h" -#include "components/version_info/channel.h" namespace brave_vpn { BraveVPNOSConnectionAPISim::BraveVPNOSConnectionAPISim( scoped_refptr url_loader_factory, PrefService* local_prefs) - : BraveVPNOSConnectionAPIBase(url_loader_factory, - local_prefs, - version_info::Channel::DEFAULT) {} + : BraveVPNOSConnectionAPIBase(url_loader_factory, local_prefs) {} BraveVPNOSConnectionAPISim::~BraveVPNOSConnectionAPISim() = default; diff --git a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.h b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.h index fceba502f777..f5be077efbc5 100644 --- a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.h +++ b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.h @@ -16,8 +16,7 @@ class BraveVPNOSConnectionAPIMac : public BraveVPNOSConnectionAPIBase { public: BraveVPNOSConnectionAPIMac( scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel); + PrefService* local_prefs); BraveVPNOSConnectionAPIMac(const BraveVPNOSConnectionAPIMac&) = delete; BraveVPNOSConnectionAPIMac& operator=(const BraveVPNOSConnectionAPIMac&) = delete; diff --git a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm index 4726528b444d..8c996598364d 100644 --- a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm +++ b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm @@ -151,18 +151,16 @@ OSStatus StorePassword(const NSString* password, std::string* error_str) { std::unique_ptr CreateBraveVPNIKEv2ConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel, base::RepeatingCallback service_installer) { // service_installer not currently used on macOS. return std::make_unique(url_loader_factory, - local_prefs, channel); + local_prefs); } BraveVPNOSConnectionAPIMac::BraveVPNOSConnectionAPIMac( scoped_refptr url_loader_factory, - PrefService* local_prefs, - version_info::Channel channel) - : BraveVPNOSConnectionAPIBase(url_loader_factory, local_prefs, channel) { + PrefService* local_prefs) + : BraveVPNOSConnectionAPIBase(url_loader_factory, local_prefs) { ObserveVPNConnectionChange(); } diff --git a/components/brave_vpn/browser/connection/ikev2/win/BUILD.gn b/components/brave_vpn/browser/connection/ikev2/win/BUILD.gn index 47c4534b5227..61b923793a71 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/BUILD.gn +++ b/components/brave_vpn/browser/connection/ikev2/win/BUILD.gn @@ -32,7 +32,6 @@ source_set("win") { deps = [ ":ras_utils", - "brave_vpn_helper", "//base", "//brave/components/brave_vpn/browser/api", "//brave/components/brave_vpn/browser/connection:common", @@ -56,6 +55,5 @@ executable("vpntool") { ":win", "//base", "//brave/components/brave_vpn/browser/connection:common", - "//brave/components/brave_vpn/browser/connection/wireguard/win", ] } diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h deleted file mode 100644 index 2a9971dea165..000000000000 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper/brave_vpn_helper_constants.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (c) 2023 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CONSTANTS_H_ -#define BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CONSTANTS_H_ - -#include - -#include "brave/components/brave_vpn/common/buildflags/buildflags.h" - -namespace brave_vpn { - -inline constexpr char kBraveVpnHelperCrashMe[] = "crash-me"; -inline constexpr wchar_t kBraveVPNHelperExecutable[] = L"brave_vpn_helper.exe"; -inline constexpr wchar_t kBraveVpnHelperFiltersInstalledValue[] = L"filters"; -inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupValue[] = L"ran"; - -// Repeating interval to check the connection is live. -inline constexpr int kCheckConnectionIntervalInSeconds = 3; - -/* UUID of WFP sublayer used by all instances */ -#if BUILDFLAG(CHANNEL_NIGHTLY) -inline constexpr wchar_t kBraveVPNServiceFilter[] = - L"Brave VPN Nightly Service DNS Filter"; -inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceNightly"; -inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupNightly"; - -// 23e10e29-eb83-4d2c-9d77-f6e9b547f39c -inline constexpr GUID kVpnDnsSublayerGUID = { - 0x23e10e29, - 0xeb83, - 0x4d2c, - {0x9d, 0x77, 0xf6, 0xe9, 0xb5, 0x47, 0xf3, 0x9c}}; -#elif BUILDFLAG(CHANNEL_BETA) -inline constexpr wchar_t kBraveVPNServiceFilter[] = - L"Brave VPN Beta Service DNS Filter"; -inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceBeta"; -inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupBeta"; - -// fc5fb7bc-e313-4f5e-8052-fe8b150f7de0 -inline constexpr GUID kVpnDnsSublayerGUID = { - 0xfc5fb7bc, - 0xe313, - 0x4f5e, - {0x80, 0x52, 0xfe, 0x8b, 0x15, 0x0f, 0x7d, 0xe0}}; -#elif BUILDFLAG(CHANNEL_DEV) -inline constexpr wchar_t kBraveVPNServiceFilter[] = - L"Brave VPN Dev Service DNS Filter"; -inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceDev"; -inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupDev"; -// c448b198-729d-4a89-879b-1cf0cd2460c0 -inline constexpr GUID kVpnDnsSublayerGUID = { - 0xc448b198, - 0x729d, - 0x4a89, - {0x87, 0x9b, 0x1c, 0xf0, 0xcd, 0x24, 0x60, 0xc0}}; -#elif BUILDFLAG(CHANNEL_DEVELOPMENT) -inline constexpr wchar_t kBraveVPNServiceFilter[] = - L"Brave VPN Development Service DNS Filter"; -inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\HelperServiceDevelopment"; -inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanupDevelopment"; -// 9c14e1f7-692f-495b-95e8-008113d3c0d6 -inline constexpr GUID kVpnDnsSublayerGUID = { - 0x9c14e1f7, - 0x692f, - 0x495b, - {0x95, 0xe8, 0x00, 0x81, 0x13, 0xd3, 0xc0, 0xd6}}; -#else -inline constexpr wchar_t kBraveVPNServiceFilter[] = - L"Brave VPN Service DNS Filter"; -inline constexpr wchar_t kBraveVpnHelperRegistryStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\HelperService"; -inline constexpr wchar_t kBraveVpnOneTimeServiceCleanupStoragePath[] = - L"Software\\BraveSoftware\\Brave\\Vpn\\OneTimeServiceCleanup"; -// 754b7cbd-cad3-474e-8d2c-054413fd4509 -inline constexpr GUID kVpnDnsSublayerGUID = { - 0x754b7cbd, - 0xcad3, - 0x474e, - {0x8d, 0x2c, 0x05, 0x44, 0x13, 0xfd, 0x45, 0x09}}; -#endif -} // namespace brave_vpn - -#endif // BRAVE_COMPONENTS_BRAVE_VPN_BROWSER_CONNECTION_IKEV2_WIN_BRAVE_VPN_HELPER_BRAVE_VPN_HELPER_CONSTANTS_H_ diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc index 3ad9aefb0d3e..ebeba67251fa 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.cc @@ -44,18 +44,16 @@ RasOperationResult DisconnectEntry(const std::wstring& name) { std::unique_ptr CreateBraveVPNIKEv2ConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel, base::RepeatingCallback service_installer) { return std::make_unique( - url_loader_factory, local_prefs, channel, service_installer); + url_loader_factory, local_prefs, service_installer); } BraveVPNOSConnectionAPIWin::BraveVPNOSConnectionAPIWin( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel, base::RepeatingCallback service_installer) - : BraveVPNOSConnectionAPIBase(url_loader_factory, local_prefs, channel) { + : BraveVPNOSConnectionAPIBase(url_loader_factory, local_prefs) { if (service_installer) { install_system_service_callback_ = std::move(service_installer); } diff --git a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h index bea88a6a7422..414ee97d7f82 100644 --- a/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h +++ b/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_ras_connection_api_win.h @@ -25,7 +25,6 @@ class BraveVPNOSConnectionAPIWin : public BraveVPNOSConnectionAPIBase, BraveVPNOSConnectionAPIWin( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel, base::RepeatingCallback service_installer); BraveVPNOSConnectionAPIWin(const BraveVPNOSConnectionAPIWin&) = delete; BraveVPNOSConnectionAPIWin& operator=(const BraveVPNOSConnectionAPIWin&) = diff --git a/components/brave_vpn/browser/connection/wireguard/credentials/BUILD.gn b/components/brave_vpn/browser/connection/wireguard/credentials/BUILD.gn index 2f611339b27e..b7c9aa4a1961 100644 --- a/components/brave_vpn/browser/connection/wireguard/credentials/BUILD.gn +++ b/components/brave_vpn/browser/connection/wireguard/credentials/BUILD.gn @@ -24,6 +24,5 @@ source_set("unit_tests") { ":credentials", "//base", "//testing/gtest", - "//third_party/abseil-cpp:absl", ] } diff --git a/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm b/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm index a27c2eb7a01d..2314a871691a 100644 --- a/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm +++ b/components/brave_vpn/browser/connection/wireguard/mac/brave_vpn_wireguard_connection_api_mac.mm @@ -12,11 +12,9 @@ namespace brave_vpn { -std::unique_ptr -CreateBraveVPNWireguardConnectionAPI( +std::unique_ptr CreateBraveVPNWireguardConnectionAPI( scoped_refptr url_loader_factory, PrefService* local_prefs, - version_info::Channel channel, base::RepeatingCallback service_installer) { // service_installer not currently used on macOS. return std::make_unique(url_loader_factory, diff --git a/components/brave_vpn/browser/connection/wireguard/win/BUILD.gn b/components/brave_vpn/browser/connection/wireguard/win/BUILD.gn deleted file mode 100644 index b1e1887936c7..000000000000 --- a/components/brave_vpn/browser/connection/wireguard/win/BUILD.gn +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2022 The Brave Authors. All rights reserved. -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at https://mozilla.org/MPL/2.0/. - -import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") - -assert(enable_brave_vpn) -assert(is_win) - -source_set("win") { - visibility = [ "//brave/components/brave_vpn/browser/connection/*" ] - - sources = [ - "brave_vpn_wireguard_connection_api.cc", - "brave_vpn_wireguard_connection_api.h", - ] - - deps = [ - "//base", - "//brave/components/brave_vpn/browser/api", - "//brave/components/brave_vpn/browser/connection:api", - "//brave/components/brave_vpn/browser/connection:common", - "//brave/components/brave_vpn/browser/connection/wireguard", - "//brave/components/brave_vpn/browser/connection/wireguard/credentials", - "//brave/components/brave_vpn/common", - "//brave/components/brave_vpn/common/buildflags", - "//brave/components/brave_vpn/common/win", - "//brave/components/brave_vpn/common/wireguard/win", - "//net", - "//services/network/public/cpp", - ] -} diff --git a/components/brave_vpn/common/BUILD.gn b/components/brave_vpn/common/BUILD.gn index e4c72f93a711..dc2749388691 100644 --- a/components/brave_vpn/common/BUILD.gn +++ b/components/brave_vpn/common/BUILD.gn @@ -17,6 +17,7 @@ source_set("common") { "features.h", "pref_names.h", ] + deps = [ "//brave/components/brave_vpn/common/buildflags", "//brave/components/p3a_utils", @@ -28,9 +29,6 @@ source_set("common") { "//components/version_info", "//net", ] - if (is_win) { - deps += [ "//brave/components/brave_vpn/common/wireguard/win" ] - } } source_set("unit_tests") { @@ -49,9 +47,5 @@ source_set("unit_tests") { "//components/sync_preferences:test_support", "//testing/gmock", "//testing/gtest", - "//third_party/abseil-cpp:absl", ] - if (is_win) { - deps += [ "wireguard/win:unittests" ] - } } diff --git a/components/brave_vpn/common/brave_vpn_utils.cc b/components/brave_vpn/common/brave_vpn_utils.cc index 69a9f53cba74..9b2a9def6759 100644 --- a/components/brave_vpn/common/brave_vpn_utils.cc +++ b/components/brave_vpn/common/brave_vpn_utils.cc @@ -24,10 +24,6 @@ #include "components/prefs/pref_service.h" #include "components/version_info/channel.h" -#if BUILDFLAG(IS_WIN) -#include "brave/components/brave_vpn/common/wireguard/win/wireguard_utils_win.h" -#endif - namespace brave_vpn { namespace { @@ -65,17 +61,18 @@ bool IsBraveVPNWireguardEnabled(PrefService* local_state) { return false; #endif } + #if BUILDFLAG(IS_WIN) -void UpdateWireguardEnabledPrefsIfNeeded(PrefService* local_prefs) { +void EnableWireguardIfPossible(PrefService* local_prefs) { auto* wireguard_enabled_pref = local_prefs->FindPreference(prefs::kBraveVPNWireguardEnabled); if (wireguard_enabled_pref && wireguard_enabled_pref->IsDefaultValue()) { local_prefs->SetBoolean( prefs::kBraveVPNWireguardEnabled, - base::FeatureList::IsEnabled(features::kBraveVPNUseWireguardService) && - brave_vpn::wireguard::IsWireguardServiceInstalled()); + base::FeatureList::IsEnabled(features::kBraveVPNUseWireguardService)); } } + #endif // BUILDFLAG(IS_WIN) void MigrateVPNSettings(PrefService* profile_prefs, PrefService* local_prefs) { if (local_prefs->GetBoolean(prefs::kBraveVPNLocalStateMigrated)) { diff --git a/components/brave_vpn/common/brave_vpn_utils.h b/components/brave_vpn/common/brave_vpn_utils.h index 4b8d511e7bca..bb7f2562c6fa 100644 --- a/components/brave_vpn/common/brave_vpn_utils.h +++ b/components/brave_vpn/common/brave_vpn_utils.h @@ -38,7 +38,7 @@ bool HasValidSkusCredential(PrefService* local_prefs); std::string GetSkusCredential(PrefService* local_prefs); bool IsBraveVPNWireguardEnabled(PrefService* local_state); #if BUILDFLAG(IS_WIN) -void UpdateWireguardEnabledPrefsIfNeeded(PrefService* local_prefs); +void EnableWireguardIfPossible(PrefService* local_prefs); #endif // BUILDFLAG(IS_WIN) } // namespace brave_vpn diff --git a/components/brave_vpn/common/buildflags/BUILD.gn b/components/brave_vpn/common/buildflags/BUILD.gn index f517be7ebafa..185906573935 100644 --- a/components/brave_vpn/common/buildflags/BUILD.gn +++ b/components/brave_vpn/common/buildflags/BUILD.gn @@ -3,7 +3,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at https://mozilla.org/MPL/2.0/. -import("//brave/build/config.gni") import("//build/buildflag_header.gni") import("buildflags.gni") @@ -13,43 +12,4 @@ buildflag_header("buildflags") { "ENABLE_BRAVE_VPN=$enable_brave_vpn", "ENABLE_BRAVE_VPN_WIREGUARD=$enable_brave_vpn_wireguard", ] - - if (is_win) { - if (brave_channel == "development") { - flags += [ - "CHANNEL_NIGHTLY=0", - "CHANNEL_BETA=0", - "CHANNEL_DEV=0", - "CHANNEL_DEVELOPMENT=1", - ] - } else if (brave_channel == "nightly") { - flags += [ - "CHANNEL_NIGHTLY=1", - "CHANNEL_BETA=0", - "CHANNEL_DEV=0", - "CHANNEL_DEVELOPMENT=0", - ] - } else if (brave_channel == "dev") { - flags += [ - "CHANNEL_NIGHTLY=0", - "CHANNEL_BETA=0", - "CHANNEL_DEV=1", - "CHANNEL_DEVELOPMENT=0", - ] - } else if (brave_channel == "beta") { - flags += [ - "CHANNEL_NIGHTLY=0", - "CHANNEL_BETA=1", - "CHANNEL_DEV=0", - "CHANNEL_DEVELOPMENT=0", - ] - } else { # stable - flags += [ - "CHANNEL_NIGHTLY=0", - "CHANNEL_BETA=0", - "CHANNEL_DEV=0", - "CHANNEL_DEVELOPMENT=0", - ] - } - } } diff --git a/components/brave_vpn/common/wireguard/BUILD.gn b/components/brave_vpn/common/wireguard/BUILD.gn index e23084c920e3..1e2dad0ce232 100644 --- a/components/brave_vpn/common/wireguard/BUILD.gn +++ b/components/brave_vpn/common/wireguard/BUILD.gn @@ -15,7 +15,6 @@ source_set("wireguard") { deps = [ "//base", "//crypto", - "//third_party/abseil-cpp:absl", "//third_party/boringssl", ] } diff --git a/components/brave_vpn/common/wireguard/win/BUILD.gn b/components/brave_vpn/common/wireguard/win/BUILD.gn index 38c8884fbb20..ffadb0401d54 100644 --- a/components/brave_vpn/common/wireguard/win/BUILD.gn +++ b/components/brave_vpn/common/wireguard/win/BUILD.gn @@ -4,7 +4,6 @@ # You can obtain one at https://mozilla.org/MPL/2.0/. import("//brave/build/config.gni") -import("//brave/components/brave_vpn/common/buildflags/buildflags.gni") import("//build/toolchain/win/midl.gni") assert(is_win) @@ -15,40 +14,3 @@ midl("brave_wireguard_manager_idl") { writes_tlb = true } - -source_set("win") { - sources = [ - "service_commands.cc", - "service_commands.h", - "service_constants.h", - "service_details.cc", - "service_details.h", - "storage_utils.cc", - "storage_utils.h", - "wireguard_utils_win.cc", - "wireguard_utils_win.h", - ] - deps = [ - ":brave_wireguard_manager_idl", - "//base", - "//brave/components/brave_vpn/common/buildflags", - "//brave/components/brave_vpn/common/win", - "//brave/components/brave_vpn/common/wireguard", - "//chrome/install_static:install_static_util", - "//components/version_info", - "//third_party/abseil-cpp:absl", - ] -} - -source_set("unittests") { - testonly = true - sources = [ "storage_utils_unittest.cc" ] - deps = [ - ":win", - "//base", - "//base/test:test_support", - "//testing/gmock", - "//testing/gtest", - "//third_party/abseil-cpp:absl", - ] -} diff --git a/components/brave_vpn/common/wireguard/win/DEPS b/components/brave_vpn/common/wireguard/win/DEPS deleted file mode 100644 index b16931fa2441..000000000000 --- a/components/brave_vpn/common/wireguard/win/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+chrome/install_static", - ] \ No newline at end of file diff --git a/elevation_service/sources.gni b/elevation_service/sources.gni index ad48b5b8e503..14ff3e47c52d 100644 --- a/elevation_service/sources.gni +++ b/elevation_service/sources.gni @@ -10,8 +10,8 @@ brave_elevation_service_lib_deps = if (is_win && enable_brave_vpn) { brave_elevation_service_lib_deps += [ + "//brave/browser/brave_vpn/win:wireguard_utils", + "//brave/browser/brave_vpn/win/brave_vpn_helper:common", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:install_utils", - "//brave/components/brave_vpn/browser/connection/ikev2/win/brave_vpn_helper:common", - "//brave/components/brave_vpn/common/wireguard/win", ] } diff --git a/test/BUILD.gn b/test/BUILD.gn index bcef3f0d093b..c20dae8fdfdd 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -342,6 +342,7 @@ test("brave_unit_tests") { deps += [ "//brave/browser/brave_vpn/dns:unit_tests", "//brave/browser/brave_vpn/win:unit_tests", + "//brave/browser/brave_vpn/win/brave_vpn_helper:unit_tests", "//brave/browser/brave_vpn/win/brave_vpn_wireguard_service:unit_tests", ] }