OSDN Git Service

Ensure that NVDA is only run on systems that support MSVCRT 10 (compiled with MSVC...
authorMichael Curran <mick@nvaccess.org>
Tue, 17 Dec 2013 23:12:32 +0000 (09:12 +1000)
committerMichael Curran <mick@nvaccess.org>
Tue, 17 Dec 2013 23:38:46 +0000 (09:38 +1000)
Minimum is XP SP2, or Server 2003 SP1, or XP X64.

source/nvda.pyw
source/winUser.py
source/winVersion.py [new file with mode: 0644]

index ad5e8e4..cf2d155 100755 (executable)
@@ -59,6 +59,12 @@ try:
 except:\r
        gettext.install('nvda',unicode=True)\r
 \r
+# Check OS version requirements\r
+import winVersion\r
+if not winVersion.canRunVc2010Builds():\r
+       winUser.MessageBox(0, unicode(ctypes.FormatError(winUser.ERROR_OLD_WIN_VERSION)), None, winUser.MB_ICONERROR)\r
+       sys.exit(1)\r
+\r
 #Process option arguments\r
 parser=NoConsoleOptionParser()\r
 parser.add_option('-q','--quit',action="store_true",dest='quit',default=False,help="Quit already running copy of NVDA")\r
index d67d3ae..d63ae7a 100644 (file)
@@ -56,6 +56,7 @@ class GUITHREADINFO(Structure):
        ]\r
 \r
 #constants\r
+ERROR_OLD_WIN_VERSION=1150\r
 MOUSEEVENTF_LEFTDOWN=0x0002 \r
 MOUSEEVENTF_LEFTUP=0x0004 \r
 MOUSEEVENTF_RIGHTDOWN=0x0008\r
diff --git a/source/winVersion.py b/source/winVersion.py
new file mode 100644 (file)
index 0000000..69a6b27
--- /dev/null
@@ -0,0 +1,24 @@
+#winVersion.py\r
+#A part of NonVisual Desktop Access (NVDA)\r
+#Copyright (C) 2006-2013 NV Access Limited\r
+#This file is covered by the GNU General Public License.\r
+#See the file COPYING for more details.\r
+\r
+import sys\r
+import winUser\r
+\r
+def canRunVc2010Builds():\r
+       OSVersion=sys.getwindowsversion()\r
+       if (OSVersion.major, OSVersion.minor) < (5, 1):\r
+               # Earlier than Windows XP.\r
+               return False\r
+       if OSVersion.major == 5:\r
+               if OSVersion.minor == 1:\r
+                       # Windows XP for x86.\r
+                       return OSVersion.service_pack_major >= 2\r
+               if OSVersion.minor == 2 and OSVersion.product_type!=1: \r
+                       # Windows Server 2003.\r
+                       # (5.2 x64 is Windows XP x64. Its RTM is based on Server 2003 sp1,\r
+                       # so all versions should be fine.)\r
+                       return OSVersion.service_pack_major >= 1\r
+       return True\r