From 400e732f4f9924494b7952d2f36be2824e25f5ee Mon Sep 17 00:00:00 2001 From: Starkku Date: Fri, 14 Jul 2023 16:13:33 +0300 Subject: [PATCH] Disable W^X on Win7 --- Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Program.cs b/Program.cs index b00bcb5..97396ec 100644 --- a/Program.cs +++ b/Program.cs @@ -208,6 +208,12 @@ private static void StartProcess(string relativePath, bool run32Bit = false, boo Environment.Exit(3); } + OperatingSystem os = Environment.OSVersion; + + // Required on Win7 due to W^X causing issues there. + if (os.Platform == PlatformID.Win32NT && os.Version.Major == 6 && os.Version.Minor == 1) + Environment.SetEnvironmentVariable("DOTNET_EnableWriteXorExecute", "0"); + using var _ = Process.Start(new ProcessStartInfo { FileName = dotnetHost.FullName,