From bddc1e136536640145140a192e982b848cfd5e9f Mon Sep 17 00:00:00 2001 From: pohky Date: Mon, 1 Nov 2021 20:19:35 +0100 Subject: [PATCH] disable veh and symbolhandler for linux --- Dalamud.Boot/dllmain.cpp | 25 ++++++++++++++++++++++--- Dalamud/EntryPoint.cs | 6 ++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Dalamud.Boot/dllmain.cpp b/Dalamud.Boot/dllmain.cpp index b20381001..608e7b84b 100644 --- a/Dalamud.Boot/dllmain.cpp +++ b/Dalamud.Boot/dllmain.cpp @@ -9,6 +9,18 @@ HMODULE g_hModule; +bool is_running_on_linux() +{ + HMODULE hntdll = GetModuleHandleW(L"ntdll.dll"); + if (!hntdll) // not running on NT + return true; + + FARPROC pwine_get_version = GetProcAddress(hntdll, "wine_get_version"); + FARPROC pwine_get_host_version = GetProcAddress(hntdll, "wine_get_host_version"); + + return pwine_get_version != nullptr || pwine_get_host_version != nullptr; +} + DllExport DWORD WINAPI Initialize(LPVOID lpParam) { #ifndef NDEBUG @@ -48,9 +60,16 @@ DllExport DWORD WINAPI Initialize(LPVOID lpParam) // ============================== VEH ======================================== // printf("Initializing VEH... "); - if (veh::add_handler()) - printf("Done!\n"); - else printf("Failed!\n"); + if(is_running_on_linux()) + { + printf("Failed! [Disabled for Wine]\n"); + } + else + { + if (veh::add_handler()) + printf("Done!\n"); + else printf("Failed!\n"); + } // =========================================================================== // diff --git a/Dalamud/EntryPoint.cs b/Dalamud/EntryPoint.cs index 58114309a..5caccb3a3 100644 --- a/Dalamud/EntryPoint.cs +++ b/Dalamud/EntryPoint.cs @@ -12,6 +12,7 @@ using Dalamud.Configuration.Internal; using Dalamud.Game; using Dalamud.Logging.Internal; using Dalamud.Support; +using Dalamud.Utility; using Newtonsoft.Json; using PInvoke; using Serilog; @@ -75,8 +76,9 @@ namespace Dalamud // This is due to GitHub not supporting TLS 1.0, so we enable all TLS versions globally ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls; - - InitSymbolHandler(info); + + if (!Util.IsLinux()) + InitSymbolHandler(info); var dalamud = new Dalamud(info, levelSwitch, finishSignal, configuration); Log.Information("Starting a session..");