mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-12-24 02:00:55 +08:00
Fix #102: unfortunately QL does not run on Windows 10 S
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user