Fix #102: unfortunately QL does not run on Windows 10 S

This commit is contained in:
Paddy Xu
2017-11-04 13:33:01 +02:00
parent 59d957f06c
commit de07befb88
3 changed files with 25 additions and 0 deletions

View File

@@ -59,6 +59,14 @@ namespace QuickLook
private void Application_Startup(object sender, StartupEventArgs e)
{
if (ProcessHelper.IsOnWindows10S())
{
MessageBox.Show("This application does not run on Windows 10 S.");
Shutdown();
return;
}
EnsureFirstInstance();
if (!_isFirstInstance)

View File

@@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using QuickLook.NativeMethods;
@@ -46,5 +47,17 @@ namespace QuickLook.Helpers
return false;
}
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public static bool IsOnWindows10S()
{
const uint PRODUCT_CLOUD = 0x000000B2; // Windows 10 S
const uint PRODUCT_CLOUDN = 0x000000B3; // Windows 10 S N
Kernel32.GetProductInfo(Environment.OSVersion.Version.Major,
Environment.OSVersion.Version.Minor, 0, 0, out var osType);
return osType == PRODUCT_CLOUD || osType == PRODUCT_CLOUDN;
}
}
}

View File

@@ -32,5 +32,9 @@ namespace QuickLook.NativeMethods
[DllImport("kernel32.dll")]
internal static extern IntPtr GetCurrentThreadId();
[DllImport("kernel32.dll")]
internal static extern bool GetProductInfo(int dwOSMajorVersion, int dwOSMinorVersion, int dwSpMajorVersion,
int dwSpMinorVersion, out uint pdwReturnedProductType);
}
}