[PATCH] Prevent installation on unsupported Windows versions

Denis Kovalchuk via TortoiseSVN-dev <[email protected]> Mon, 5 Aug 2024 06:42:08 -0700 (PDT)
Newsgroups gmane.comp.version-control.subversion.tortoisesvn.devel
Message-ID <[email protected]>
------=_Part_637870_1038428242.1722865328205
Content-Type: multipart/alternative; 
	boundary="----=_Part_637871_1907981576.1722865328205"

------=_Part_637871_1907981576.1722865328205
Content-Type: text/plain; charset="UTF-8"

Hello!

Starting from TortoiseSVN 1.14, the minimum supported platform is
Windows 10 [1]:

[[[
TortoiseSVN 1.14 requires Windows 10 or later. It won't run on Windows 8.1
anymore.
]]]

So I would like to suggest updating the related check in the TortoiseSVN
installer.

In more detail, TortoiseSVN requires support for the
SetThreadDpiAwarenessContext() [2] function that was introduced in Windows 
10
version 1607. For detecting this version, I used the existing approach of
searching for a system dll with the appropriate build number.

Here is a patch in attachments.

[1] https://tortoisesvn.net/tsvn_1.14_releasenotes.html
[2] 
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setthreaddpiawarenesscontext

Best Regards,
Denis Kovalchuk

-- 
You received this message because you are subscribed to the Google Groups "TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/tortoisesvn-dev/ed99572a-bda3-4e65-b97e-627485634780n%40googlegroups.com.

------=_Part_637871_1907981576.1722865328205
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello!<br /><br />Starting from TortoiseSVN 1.14, the minimum supported pla=
tform is<br />Windows 10 [1]:<br /><br />[[[<br />TortoiseSVN 1.14 requires=
 Windows 10 or later. It won't run on Windows 8.1<br />anymore.<br />]]]<br=
 /><br />So I would like to suggest updating the related check in the Torto=
iseSVN<br />installer.<br /><br />In more detail, TortoiseSVN requires supp=
ort for the<br />SetThreadDpiAwarenessContext() [2] function that was intro=
duced in Windows 10<br />version 1607. For detecting this version, I used t=
he existing approach of<br />searching for a system dll with the appropriat=
e build number.<br /><br />Here is a patch in attachments.<br /><br />[1] h=
ttps://tortoisesvn.net/tsvn_1.14_releasenotes.html<br />[2] https://learn.m=
icrosoft.com/en-us/windows/win32/api/winuser/nf-winuser-setthreaddpiawarene=
sscontext<br /><br />Best Regards,<br />Denis Kovalchuk<br />

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;TortoiseSVN-dev&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">tor=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/tortoisesvn-dev/ed99572a-bda3-4e65-b97e-627485634780n%40googlegr=
oups.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/=
d/msgid/tortoisesvn-dev/ed99572a-bda3-4e65-b97e-627485634780n%40googlegroup=
s.com</a>.<br />

------=_Part_637871_1907981576.1722865328205--

------=_Part_637870_1038428242.1722865328205
Content-Type: text/plain; charset=US-ASCII; 
	name=prevent-installation-unsupported-windows-versions-v1.patch.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; 
	filename=prevent-installation-unsupported-windows-versions-v1.patch.txt
X-Attachment-Id: 99fd2acc-1533-447d-a2b7-543eeb9ca298
Content-ID: <99fd2acc-1533-447d-a2b7-543eeb9ca298>

Prevent installation on unsupported Windows versions. Starting from TortoiseSVN
1.14, the minimum supported platform is Windows 10 [1]:

[[[
TortoiseSVN 1.14 requires Windows 10 or later. It won't run on Windows 8.1
anymore.
]]]

TortoiseSVN requires support for the SetThreadDpiAwarenessContext() [2]
function that was introduced in Windows 10 version 1607. Detect this version by
checking the build number of user32.dll that contains this function.

[1] https://tortoisesvn.net/tsvn_1.14_releasenotes.html
[2] https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setthreaddpiawarenesscontext

Index: src/TortoiseSVNSetup/TortoiseSVN.wxs
===================================================================
--- src/TortoiseSVNSetup/TortoiseSVN.wxs	(revision 29698)
+++ src/TortoiseSVNSetup/TortoiseSVN.wxs	(working copy)
@@ -31,7 +31,35 @@
         <!-- Launch Condition related properties ................................................................................. -->
         <Property Id="ALLUSERS" Secure="yes">1</Property>
 
-        <Condition Message="[ProductName] requires Windows 8.1 or later."><![CDATA[(VersionNT >= 603)]]></Condition>
+        <!-- msiexec does not have a manifest, so it always reports the version of system dlls as
+             for Win7 (6.3.x.x). So we check for 6.3 but use the build number to actually check
+             the Windows version.
+
+             See https://github.com/wixtoolset/issues/issues/5824 -->
+
+        <!-- Windows 10 version 1607 or greater found.
+
+             TortoiseSVN requires support for SetThreadDpiAwarenessContext() [1] function that
+             was introduced in Windows 10 version 1607 with the build number 14393. So check
+             the build number of user32.dll that contains this function.
+
+             [1] https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setthreaddpiawarenesscontext -->
+        <Property Id="WIN10_1607_FOUND" Secure="yes">
+            <!-- Search in [SystemFolder] to support the 32-bit version of Windows 10. -->
+            <DirectorySearch Id="searchSystemWin10" Path="[SystemFolder]" AssignToProperty="yes">
+                <FileSearch Id="searchFileWin10" Name="user32.dll" MinVersion="6.3.14392.0"/>
+            </DirectorySearch>
+        </Property>
+
+        <!-- Windows 11 or greater found. The first Windows 11 build number is 22000. -->
+        <Property Id="WIN11FOUND" Secure="yes">
+            <DirectorySearch Id="searchSystemWin11" Path="[System64Folder]" AssignToProperty="yes">
+                <FileSearch Id="searchFileWin11" Name="shell32.dll" MinVersion="6.3.21999.0"/>
+            </DirectorySearch>
+        </Property>
+
+        <Condition Message="[ProductName] requires Windows 10 version 1607 or later.">WIN10_1607_FOUND</Condition>
+
         <?if $(env.Platform) = "win32" ?>
           <Condition Message="You are attempting to run the 32-bit installer on a 64-bit version of Windows. Please install the 64-bit version of TortoiseSVN instead.">NOT Msix64</Condition>
         <?endif ?>
@@ -94,15 +122,6 @@
             <RegistrySearch Key="SOFTWARE\[Manufacturer]" Root="HKLM" Type="raw" Id="LANGUAGEFOLDER_REGSEARCH" Name="LanguageFolderPath" Win64="$(var.Win64YesNo)"/>
         </Property>
 
-        <!-- msiexec does not have a manifest, so it always reports the version of system dlls as
-         for Win7 (6.3.x.x). So we check for 6.3 but use the build number to actually check
-         for Win11 -->
-        <Property Id="WIN11FOUND" Secure="yes">
-            <DirectorySearch Id="searchSystem" Path="[System64Folder]" AssignToProperty="yes">
-                <FileSearch Id="searchFile" Name="shell32.dll" MinVersion="6.3.21999.0"/>
-            </DirectorySearch>
-        </Property>
-
         <!-- properties for the custom actions to (un)register the sparse package -->
         <Property Id="SPARSEPACKAGEFILE" Value="package.msix"  Secure="yes"/>
         <Property Id="SPARSEPACKAGENAME" Value="3A48D7FC-AEE2-4CBC-91D1-0007951B8006"  Secure="yes"/>

------=_Part_637870_1038428242.1722865328205--