From f56c949305ec9a0e41578932dbbdf1dd5a0f4caf Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Wed, 12 Nov 2025 21:12:10 +0100 Subject: [PATCH 1/3] Skip antivirus warning when running under Wine --- Client/loader/Main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Client/loader/Main.cpp b/Client/loader/Main.cpp index 5badcebb16..f24b3f9fb4 100644 --- a/Client/loader/Main.cpp +++ b/Client/loader/Main.cpp @@ -259,8 +259,17 @@ MTAEXPORT int DoWinMain(HINSTANCE hLauncherInstance, MAYBE_UNUSED HINSTANCE hPre // Make sure GTA is not running HandleIfGTAIsAlreadyRunning(); - // Maybe warn user if no anti-virus running - CheckAntiVirusStatus(); + // Maybe warn user if no anti-virus running (skip under Wine) + HKEY hKey = nullptr; + if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Wine", 0, KEY_READ, &hKey) != ERROR_SUCCESS && + RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, KEY_READ, &hKey) != ERROR_SUCCESS) + { + CheckAntiVirusStatus(); + } + else + { + RegCloseKey(hKey); + } // Ensure logo is showing ShowSplash(hInstanceToUse); From 2aca385af18ec0d92ccce35100aadde0806e25e7 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Wed, 12 Nov 2025 23:38:53 +0100 Subject: [PATCH 2/3] Better code & detection --- Client/loader/Main.cpp | 13 ++----------- Client/loader/MainFunctions.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Client/loader/Main.cpp b/Client/loader/Main.cpp index f24b3f9fb4..5badcebb16 100644 --- a/Client/loader/Main.cpp +++ b/Client/loader/Main.cpp @@ -259,17 +259,8 @@ MTAEXPORT int DoWinMain(HINSTANCE hLauncherInstance, MAYBE_UNUSED HINSTANCE hPre // Make sure GTA is not running HandleIfGTAIsAlreadyRunning(); - // Maybe warn user if no anti-virus running (skip under Wine) - HKEY hKey = nullptr; - if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Wine", 0, KEY_READ, &hKey) != ERROR_SUCCESS && - RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine", 0, KEY_READ, &hKey) != ERROR_SUCCESS) - { - CheckAntiVirusStatus(); - } - else - { - RegCloseKey(hKey); - } + // Maybe warn user if no anti-virus running + CheckAntiVirusStatus(); // Ensure logo is showing ShowSplash(hInstanceToUse); diff --git a/Client/loader/MainFunctions.cpp b/Client/loader/MainFunctions.cpp index abd523dfc6..8ddb9cf692 100644 --- a/Client/loader/MainFunctions.cpp +++ b/Client/loader/MainFunctions.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include // Function must be at the start to fix odd compile error (Didn't happen locally but does in build server) namespace @@ -938,6 +940,22 @@ void ValidateGTAPath() } } +int isUsingWine() +{ + HMODULE ntdll = GetModuleHandleA("ntdll.dll"); + if (!ntdll) + return 0; // Not ntdll? Not Wine. + + // Check for Wine-specific function + FARPROC wineVersion = GetProcAddress(ntdll, "wine_get_version"); + if (wineVersion) + { + return 1; // Is Wine. + } + + return 0; // Not Wine. +} + ////////////////////////////////////////////////////////// // // CheckAntiVirusStatus @@ -947,6 +965,12 @@ void ValidateGTAPath() ////////////////////////////////////////////////////////// void CheckAntiVirusStatus() { + if (isUsingWine()) + { + WriteDebugEvent("Skipping AV check under Wine"); + return; + } + std::vector enabledList, disabledList; GetWMIAntiVirusStatus(enabledList, disabledList); From 55bbaac1f14bb6a86bc95dc63614a116de4e8c16 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Wed, 12 Nov 2025 23:40:06 +0100 Subject: [PATCH 3/3] Add comment --- Client/loader/MainFunctions.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Client/loader/MainFunctions.cpp b/Client/loader/MainFunctions.cpp index 8ddb9cf692..1262e2ba5b 100644 --- a/Client/loader/MainFunctions.cpp +++ b/Client/loader/MainFunctions.cpp @@ -940,6 +940,13 @@ void ValidateGTAPath() } } +////////////////////////////////////////////////////////// +// +// isUsingWine +// +// Detect if we are running under Wine +// +////////////////////////////////////////////////////////// int isUsingWine() { HMODULE ntdll = GetModuleHandleA("ntdll.dll");