diff --git a/premake5.lua b/premake5.lua index dc08828e..e82e0d02 100644 --- a/premake5.lua +++ b/premake5.lua @@ -245,7 +245,7 @@ workspace "iw4x" configurations { "Debug", "Release" } architecture "x86" platforms "x86" - exceptionhandling ("SEH") + --exceptionhandling ("SEH") flags { "StaticRuntime" } diff --git a/src/Utils/Utils.cpp b/src/Utils/Utils.cpp index 1000679d..b2e9e35e 100644 --- a/src/Utils/Utils.cpp +++ b/src/Utils/Utils.cpp @@ -121,13 +121,18 @@ namespace Utils return GetModuleHandleA(Utils::String::XOR(std::string(reinterpret_cast(ntdll), sizeof ntdll), -1).data()); } + void SafeShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd) + { + __try + { + ShellExecuteA(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd); + } + __finally {} + } + void OpenUrl(std::string url) { - try - { - ShellExecuteA(nullptr, "open", url.data(), nullptr, nullptr, SW_SHOWNORMAL); - } - catch (...) {} + SafeShellExecute(nullptr, "open", url.data(), nullptr, nullptr, SW_SHOWNORMAL); } bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2)