@joebigelow / wix-1 / commits / aa267890

Drop CA path validation in WixUI by default.

Add `WixUI/ExtendedPathValidation="yes"` to opt-in. Removed the WIXUI_DONTVALIDATEPATH runtime opt-out. Fixes https://github.com/wixtoolset/issues/issues/8718 Relies on https://github.com/wixtoolset/wix/pull/563

Bob Arnson committed Sep 27, 2024 at 22:09 UTC aa2678906191e0535fad5634467f074aae049c09
12 files changed +126 -96
src/ext/UI/ca/DriveCheck.cpp
+21 -21
@@ -12,21 +12,21 @@ static HRESULT PathIsRemovable(__in LPCWSTR pTargetFolder, __inout BOOL* fPathRe
12 UINT __stdcall ValidatePath(MSIHANDLE hInstall)
13 {
14 HRESULT hr = S_OK;
15 -
15 +
16 LPWSTR pwszWixUIDir = NULL;
17 LPWSTR pwszInstallPath = NULL;
18 BOOL fInstallPathIsRemote = TRUE;
19 BOOL fInstallPathIsRemoveable = TRUE;
20 -
20 +
21 hr = WcaInitialize(hInstall, "ValidatePath");
22 ExitOnFailure(hr, "failed to initialize");
23
24 hr = WcaGetProperty(L"WIXUI_INSTALLDIR", &pwszWixUIDir);
25 ExitOnFailure(hr, "failed to get WixUI Installation Directory");
26 -
26 +
27 hr = WcaGetProperty(pwszWixUIDir, &pwszInstallPath);
28 ExitOnFailure(hr, "failed to get Installation Directory");
29 -
29 +
30 hr = PathIsRemote(pwszInstallPath, &fInstallPathIsRemote);
31 if (FAILED(hr))
32 {
@@ -34,7 +34,7 @@ UINT __stdcall ValidatePath(MSIHANDLE hInstall)
34 //reset HR, as we need to continue and find out if is a UNC path
35 hr = S_OK;
36 }
37 -
37 +
38 hr = PathIsRemovable(pwszInstallPath, &fInstallPathIsRemoveable);
39 if (FAILED(hr))
40 {
@@ -45,7 +45,7 @@ UINT __stdcall ValidatePath(MSIHANDLE hInstall)
45
46 // If the path does not point to a network drive, mapped drive, or removable drive,
47 // then set WIXUI_INSTALLDIR_VALID to "1" otherwise set it to 0
48 - BOOL fInstallPathIsUnc = PathIsUNCW(pwszInstallPath);
48 + BOOL fInstallPathIsUnc = ::PathIsUNCW(pwszInstallPath);
49 if (!fInstallPathIsUnc && !fInstallPathIsRemote && !fInstallPathIsRemoveable)
50 {
51 // path is valid
@@ -61,7 +61,7 @@ UINT __stdcall ValidatePath(MSIHANDLE hInstall)
61 hr = WcaSetProperty(L"WIXUI_INSTALLDIR_VALID", L"0");
62 ExitOnFailure(hr, "failed to set WIXUI_INSTALLDIR_VALID");
63 }
64 -
64 +
65 LExit:
66 ReleaseStr(pwszInstallPath);
67 ReleaseStr(pwszWixUIDir);
@@ -79,22 +79,22 @@ static HRESULT PathIsRemote(__in LPCWSTR pTargetFolder, __inout BOOL* fPathRemot
79 LPWSTR pStrippedTargetFolder = NULL;
80
81 hr = StrAllocString(&pStrippedTargetFolder, pTargetFolder, 0);
82 -
82 +
83 // Terminate the path at the root
84 - if(!::PathStripToRootW(pStrippedTargetFolder))
84 + if (!::PathStripToRootW(pStrippedTargetFolder))
85 {
86 hr = HRESULT_FROM_WIN32(ERROR_INVALID_DRIVE);
87 - ExitOnFailure(hr, "failed to parse target folder");
87 + ExitOnFailure(hr, "failed to parse target folder");
88 }
89 -
90 - UINT uResult = GetDriveTypeW(pStrippedTargetFolder);
91 -
92 - *fPathRemote = (DRIVE_REMOTE == uResult) ;
89 +
90 + UINT uResult = ::GetDriveTypeW(pStrippedTargetFolder);
91 +
92 + *fPathRemote = (DRIVE_REMOTE == uResult);
93
94 LExit:
95 ReleaseStr(pStrippedTargetFolder);
96
97 - return hr;
97 + return hr;
98 }
99
100 /********************************************************************
@@ -107,16 +107,16 @@ static HRESULT PathIsRemovable(__in LPCWSTR pTargetFolder, __inout BOOL* fPathRe
107 LPWSTR pStrippedTargetFolder = NULL;
108
109 hr = StrAllocString(&pStrippedTargetFolder, pTargetFolder, 0);
110 -
110 +
111 // Terminate the path at the root
112 - if(!::PathStripToRootW(pStrippedTargetFolder))
112 + if (!::PathStripToRootW(pStrippedTargetFolder))
113 {
114 hr = HRESULT_FROM_WIN32(ERROR_INVALID_DRIVE);
115 - ExitOnFailure(hr, "failed to parse target folder");
115 + ExitOnFailure(hr, "failed to parse target folder");
116 }
117 -
118 - UINT uResult = GetDriveTypeW(pStrippedTargetFolder);
119 -
117 +
118 + UINT uResult = ::GetDriveTypeW(pStrippedTargetFolder);
119 +
120 *fPathRemovable = ((DRIVE_CDROM == uResult) || (DRIVE_REMOVABLE == uResult) || (DRIVE_RAMDISK == uResult) || (DRIVE_UNKNOWN == uResult));
121
122 LExit:
src/ext/UI/test/WixToolsetTest.UI/TestData/InstallDir_NoLicense/Package.wxs
+8 -7
@@ -24,8 +24,8 @@
24 <?foreach WIXUIARCH in X86;X64;A64 ?>
25 <Fragment>
26 <UI Id="InstallDir_NoLicense_$(WIXUIARCH)">
27 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
28 - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
27 + <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" />
28 + <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" />
29 </UI>
30
31 <UIRef Id="InstallDir_NoLicense" />
@@ -50,8 +50,6 @@
50 <DialogRef Id="ProgressDlg" />
51 <DialogRef Id="ResumeDlg" />
52 <DialogRef Id="UserExit" />
53 -
54 - <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
53
54 <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
55
@@ -59,11 +57,14 @@
57 <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="Installed AND PATCH" />
58
59 <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" />
62 - <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
63 - <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
64 - <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" Condition="WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
60 + <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="3" />
61 + <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" />
62 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1" />
63 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2" />
64 +
65 + <Publish Dialog="BrowseDlg" Control="OK" Event="SetTargetPath" Value="[_BrowseProperty]" Order="3" />
66 + <Publish Dialog="BrowseDlg" Control="OK" Event="EndDialog" Value="Return" Order="4" />
67 +
68 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1" Condition="NOT Installed" />
69 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2" Condition="Installed AND NOT PATCH" />
70 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" Condition="Installed AND PATCH" />
src/ext/UI/test/WixToolsetTest.UI/TestData/InstallDir_SpecialDlg/Package.wxs
+4 -7
@@ -42,10 +42,7 @@
42
43 <?foreach WIXUIARCH in X86;X64;A64 ?>
44 <Fragment>
45 - <UI Id="InstallDir_SpecialDlg_$(WIXUIARCH)">
46 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
47 - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
48 - </UI>
45 + <UI Id="InstallDir_SpecialDlg_$(WIXUIARCH)" />
46
47 <UIRef Id="InstallDir_SpecialDlg" />
48 </Fragment>
@@ -70,7 +67,7 @@
67 <DialogRef Id="ResumeDlg" />
68 <DialogRef Id="UserExit" />
69
73 - <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
70 + <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
71
72 <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
73
@@ -85,8 +82,8 @@
82
83 <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" />
84 <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
88 - <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
89 - <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" Condition="WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
85 + <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
86 + <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" Condition="WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
87 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1" />
88 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2" />
89 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1" Condition="NOT Installed" />
src/ext/UI/test/WixToolsetTest.UI/TestData/WixUI_Advanced/Package.wxs
+2 -2
@@ -1,12 +1,12 @@
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
2 - <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
2 + <Package Name="WixUI_Advanced" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
4
5 <Feature Id="ProductFeature" Title="MsiPackage">
6 <ComponentGroupRef Id="ProductComponents" />
7 </Feature>
8
9 - <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
9 + <ComponentGroup Id="ProductComponents" Directory="APPLICATIONFOLDER">
10 <Component>
11 <File Source="example.txt" />
12 </Component>
src/ext/UI/test/WixToolsetTest.UI/TestData/WixUI_InstallDir/Package.wxs
+2 -2
@@ -1,5 +1,5 @@
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
2 - <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" InstallerVersion="200">
2 + <Package Name="WixUI_InstallDir" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" InstallerVersion="200">
3 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
4
5 <Feature Id="ProductFeature" Title="MsiPackage">
@@ -12,7 +12,7 @@
12 </Component>
13 </ComponentGroup>
14
15 - <ui:WixUI Id="WixUI_InstallDir" InstallDirectory="INSTALLFOLDER" />
15 + <ui:WixUI Id="WixUI_InstallDir" InstallDirectory="INSTALLFOLDER" ExtendedPathValidation="yes" />
16 </Package>
17
18 <Fragment>
src/ext/UI/test/WixToolsetTest.UI/TestData/WixUI_Mondo/Package.wxs
+3 -3
@@ -1,8 +1,8 @@
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
2 - <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" InstallerVersion="200">
2 + <Package Name="WixUI_Mondo" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" InstallerVersion="200">
3 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
4
5 - <Feature Id="ProductFeature" Title="MsiPackage">
5 + <Feature Id="ProductFeature" Title="MsiPackage" ConfigurableDirectory="INSTALLFOLDER">
6 <ComponentGroupRef Id="ProductComponents" />
7 </Feature>
8
@@ -12,7 +12,7 @@
12 </Component>
13 </ComponentGroup>
14
15 - <ui:WixUI Id="WixUI_Mondo" />
15 + <ui:WixUI Id="WixUI_Mondo" ExtendedPathValidation="yes" />
16 <WixVariable Id="WixUILicenseRtf" Value="bpl.rtf" />
17 </Package>
18
src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs
+10 -36
@@ -29,7 +29,6 @@ namespace WixToolsetTest.UI
29 "Binary:WixUI_Bmp_Up\t[Binary data]",
30 "Binary:WixUI_Ico_Exclam\t[Binary data]",
31 "Binary:WixUI_Ico_Info\t[Binary data]",
32 - "Binary:WixUiCa_X86\t[Binary data]",
32 }, results.Where(r => r.StartsWith("Binary:")).ToArray());
33 WixAssert.CompareLineByLine(new[]
34 {
@@ -37,13 +36,8 @@ namespace WixToolsetTest.UI
36 "CustomAction:WixSetDefaultPerUserFolder\t51\tWixPerUserFolder\t[LocalAppDataFolder]Apps\\[ApplicationFolderName]\t",
37 "CustomAction:WixSetPerMachineFolder\t51\tAPPLICATIONFOLDER\t[WixPerMachineFolder]\t",
38 "CustomAction:WixSetPerUserFolder\t51\tAPPLICATIONFOLDER\t[WixPerUserFolder]\t",
40 - "CustomAction:WixUIValidatePath_X86\t65\tWixUiCa_X86\tValidatePath\t",
39 }, results.Where(r => r.StartsWith("CustomAction:")).ToArray());
42 - WixAssert.CompareLineByLine(new[]
43 - {
44 - "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t1",
45 - "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t2",
46 - }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
40 + Assert.Empty(results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
41 WixAssert.CompareLineByLine(new[]
42 {
43 "InstallUISequence:AdvancedWelcomeEulaDlg\tNOT Installed\t1297",
@@ -68,7 +62,6 @@ namespace WixToolsetTest.UI
62 "Binary:WixUI_Bmp_Up\t[Binary data]",
63 "Binary:WixUI_Ico_Exclam\t[Binary data]",
64 "Binary:WixUI_Ico_Info\t[Binary data]",
71 - "Binary:WixUiCa_X64\t[Binary data]",
65 }, results.Where(r => r.StartsWith("Binary:")).ToArray());
66 WixAssert.CompareLineByLine(new[]
67 {
@@ -76,13 +69,8 @@ namespace WixToolsetTest.UI
69 "CustomAction:WixSetDefaultPerUserFolder\t51\tWixPerUserFolder\t[LocalAppDataFolder]Apps\\[ApplicationFolderName]\t",
70 "CustomAction:WixSetPerMachineFolder\t51\tAPPLICATIONFOLDER\t[WixPerMachineFolder]\t",
71 "CustomAction:WixSetPerUserFolder\t51\tAPPLICATIONFOLDER\t[WixPerUserFolder]\t",
79 - "CustomAction:WixUIValidatePath_X64\t65\tWixUiCa_X64\tValidatePath\t",
72 }, results.Where(r => r.StartsWith("CustomAction:")).ToArray());
81 - WixAssert.CompareLineByLine(new[]
82 - {
83 - "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X64\tNOT WIXUI_DONTVALIDATEPATH\t1",
84 - "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X64\tNOT WIXUI_DONTVALIDATEPATH\t2",
85 - }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
73 + Assert.Empty(results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
74 }
75
76 [Fact]
@@ -102,7 +90,6 @@ namespace WixToolsetTest.UI
90 "Binary:WixUI_Bmp_Up\t[Binary data]",
91 "Binary:WixUI_Ico_Exclam\t[Binary data]",
92 "Binary:WixUI_Ico_Info\t[Binary data]",
105 - "Binary:WixUiCa_A64\t[Binary data]",
93 }, results.Where(r => r.StartsWith("Binary:")).ToArray());
94 WixAssert.CompareLineByLine(new[]
95 {
@@ -110,13 +97,8 @@ namespace WixToolsetTest.UI
97 "CustomAction:WixSetDefaultPerUserFolder\t51\tWixPerUserFolder\t[LocalAppDataFolder]Apps\\[ApplicationFolderName]\t",
98 "CustomAction:WixSetPerMachineFolder\t51\tAPPLICATIONFOLDER\t[WixPerMachineFolder]\t",
99 "CustomAction:WixSetPerUserFolder\t51\tAPPLICATIONFOLDER\t[WixPerUserFolder]\t",
113 - "CustomAction:WixUIValidatePath_A64\t65\tWixUiCa_A64\tValidatePath\t",
100 }, results.Where(r => r.StartsWith("CustomAction:")).ToArray());
115 - WixAssert.CompareLineByLine(new[]
116 - {
117 - "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_A64\tNOT WIXUI_DONTVALIDATEPATH\t1",
118 - "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_A64\tNOT WIXUI_DONTVALIDATEPATH\t2",
119 - }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
101 + Assert.Empty(results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
102 }
103
104 [Fact]
@@ -180,8 +162,8 @@ namespace WixToolsetTest.UI
162 }, results.Where(r => r.StartsWith("Property:WIXUI")).ToArray());
163 WixAssert.CompareLineByLine(new[]
164 {
183 - "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t3",
184 - "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t2",
165 + "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\t1\t1",
166 + "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\t1\t1",
167 }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());
168 WixAssert.CompareLineByLine(new[]
169 {
@@ -281,7 +263,7 @@ namespace WixToolsetTest.UI
263 }, results.Where(r => r.StartsWith("CustomAction:")).ToArray());
264 WixAssert.CompareLineByLine(new[]
265 {
284 - "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t3",
266 + "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\t1\t1",
267 }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
268 WixAssert.CompareLineByLine(new[]
269 {
@@ -332,8 +314,8 @@ namespace WixToolsetTest.UI
314 }, results.Where(r => r.StartsWith("Property:WIXUI")).ToArray());
315 WixAssert.CompareLineByLine(new[]
316 {
335 - "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t3",
336 - "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t2",
317 + "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\t1\t3",
318 + "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\t1\t2",
319 }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());
320
321 Assert.Empty(results.Where(result => result.Contains("LicenseAgreementDlg")).ToArray());
@@ -361,21 +343,13 @@ namespace WixToolsetTest.UI
343 "Binary:WixUI_Bmp_Up\t[Binary data]",
344 "Binary:WixUI_Ico_Exclam\t[Binary data]",
345 "Binary:WixUI_Ico_Info\t[Binary data]",
364 - "Binary:WixUiCa_X64\t[Binary data]",
346 }, results.Where(r => r.StartsWith("Binary:")).ToArray());
366 - WixAssert.CompareLineByLine(new[]
367 - {
368 - "CustomAction:WixUIValidatePath_X64\t65\tWixUiCa_X64\tValidatePath\t",
369 - }, results.Where(r => r.StartsWith("CustomAction:")).ToArray());
347 + Assert.Empty(results.Where(r => r.StartsWith("CustomAction:")).ToArray());
348 WixAssert.CompareLineByLine(new[]
349 {
350 "Property:WIXUI_INSTALLDIR\tINSTALLFOLDER",
351 }, results.Where(r => r.StartsWith("Property:WIXUI")).ToArray());
374 - WixAssert.CompareLineByLine(new[]
375 - {
376 - "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X64\tNOT WIXUI_DONTVALIDATEPATH\t3",
377 - "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X64\tNOT WIXUI_DONTVALIDATEPATH\t2",
378 - }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());
352 + Assert.Empty(results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());
353 WixAssert.CompareLineByLine(new[]
354 {
355 "InstallUISequence:WelcomeDlg\tNOT Installed OR PATCH\t1297",
src/ext/UI/wixext/UICompiler.cs
+13 -1
@@ -56,6 +56,7 @@ namespace WixToolset.UI
56 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
57 string id = null;
58 string installDirectory = null;
59 + YesNoType extendedPathValidation = YesNoType.No;
60
61 foreach (var attrib in element.Attributes())
62 {
@@ -69,6 +70,9 @@ namespace WixToolset.UI
70 case "InstallDirectory":
71 installDirectory = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
72 break;
73 + case "ExtendedPathValidation":
74 + extendedPathValidation = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib);
75 + break;
76 default:
77 this.ParseHelper.UnexpectedAttribute(element, attrib);
78 break;
@@ -87,7 +91,15 @@ namespace WixToolset.UI
91 else
92 {
93 var platform = this.Context.Platform == Platform.ARM64 ? "A64" : this.Context.Platform.ToString();
90 - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixUI, $"{id}_{platform}");
94 +
95 + if (extendedPathValidation == YesNoType.No)
96 + {
97 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixUI, $"{id}_{platform}");
98 + }
99 + else
100 + {
101 + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.WixUI, $"{id}_ExtendedPathValidation_{platform}");
102 + }
103
104 if (installDirectory != null)
105 {
src/ext/UI/wixlib/BrowseDlg.wxs
+1 -4
@@ -6,10 +6,7 @@
6 <UI>
7 <Dialog Id="BrowseDlg" Width="370" Height="270" Title="!(loc.BrowseDlg_Title)">
8 <Control Id="PathEdit" Type="PathEdit" X="25" Y="202" Width="320" Height="18" Property="_BrowseProperty" Indirect="yes" />
9 - <Control Id="OK" Type="PushButton" X="240" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUIOK)">
10 - <Publish Event="SetTargetPath" Value="[_BrowseProperty]" />
11 - <Publish Event="EndDialog" Value="Return" />
12 - </Control>
9 + <Control Id="OK" Type="PushButton" X="240" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUIOK)" />
10 <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
11 <Publish Event="Reset" Value="0" />
12 <Publish Event="EndDialog" Value="Return" />
src/ext/UI/wixlib/WixUI_Advanced.wxs
+23 -6
@@ -23,8 +23,25 @@ Todo:
23 <?foreach WIXUIARCH in X86;X64;A64 ?>
24 <Fragment>
25 <UI Id="WixUI_Advanced_$(WIXUIARCH)">
26 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" Condition="NOT WIXUI_DONTVALIDATEPATH" />
27 - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
26 + <Publish Dialog="BrowseDlg" Control="OK" Event="CheckTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
27 +
28 + <Publish Dialog="InstallDirDlg" Control="Next" Event="CheckTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
29 + <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="FeaturesDlg" Order="4" />
30 + </UI>
31 +
32 + <UIRef Id="WixUI_Advanced" />
33 + </Fragment>
34 + <?endforeach?>
35 +
36 + <?foreach WIXUIARCH in X86;X64;A64 ?>
37 + <Fragment>
38 + <UI Id="WixUI_Advanced_ExtendedPathValidation_$(WIXUIARCH)">
39 + <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" />
40 + <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="2" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
41 +
42 + <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" />
43 + <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="2" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
44 + <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="FeaturesDlg" Order="4" Condition="WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
45 </UI>
46
47 <UIRef Id="WixUI_Advanced" />
@@ -76,7 +93,6 @@ Todo:
93 <DialogRef Id="WelcomeDlg" />
94
95 <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
79 - <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="2" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
96
97 <Publish Dialog="AdvancedWelcomeEulaDlg" Control="Advanced" Event="NewDialog" Value="InstallScopeDlg" Order="1" Condition="!(wix.WixUISupportPerMachine) AND !(wix.WixUISupportPerUser)" />
98 <Publish Dialog="AdvancedWelcomeEulaDlg" Control="Advanced" Event="NewDialog" Value="FeaturesDlg" Order="2" Condition="NOT !(wix.WixUISupportPerMachine)" />
@@ -94,12 +110,13 @@ Todo:
110
111 <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlg" Condition="!(wix.WixUISupportPerUser)" />
112 <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="AdvancedWelcomeEulaDlg" Condition="NOT !(wix.WixUISupportPerUser)" />
97 - <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
98 - <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
99 - <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="FeaturesDlg" Order="4" Condition="WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
113 + <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="3" />
114 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1" />
115 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2" />
116
117 + <Publish Dialog="BrowseDlg" Control="OK" Event="SetTargetPath" Value="[_BrowseProperty]" Order="3" />
118 + <Publish Dialog="BrowseDlg" Control="OK" Event="EndDialog" Value="Return" Order="4" />
119 +
120 <Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlg" Condition="NOT Installed AND WixAppFolder = &quot;WixPerUserFolder&quot;" />
121 <Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Condition="NOT Installed AND WixAppFolder = &quot;WixPerMachineFolder&quot;" />
122 <Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Condition="Installed" />
src/ext/UI/wixlib/WixUI_InstallDir.wxs
+24 -6
@@ -24,8 +24,25 @@ Patch dialog sequence:
24 <?foreach WIXUIARCH in X86;X64;A64 ?>
25 <Fragment>
26 <UI Id="WixUI_InstallDir_$(WIXUIARCH)">
27 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
28 - <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="2" Condition="NOT WIXUI_DONTVALIDATEPATH" />
27 + <Publish Dialog="BrowseDlg" Control="OK" Event="CheckTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
28 +
29 + <Publish Dialog="InstallDirDlg" Control="Next" Event="CheckTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
30 + <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" />
31 + </UI>
32 +
33 + <UIRef Id="WixUI_InstallDir" />
34 + </Fragment>
35 + <?endforeach?>
36 +
37 + <?foreach WIXUIARCH in X86;X64;A64 ?>
38 + <Fragment>
39 + <UI Id="WixUI_InstallDir_ExtendedPathValidation_$(WIXUIARCH)">
40 + <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" />
41 + <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="2" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
42 +
43 + <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" />
44 + <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="2" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
45 + <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" Condition="WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
46 </UI>
47
48 <UIRef Id="WixUI_InstallDir" />
@@ -50,7 +67,6 @@ Patch dialog sequence:
67 <DialogRef Id="ProgressDlg" />
68 <DialogRef Id="ResumeDlg" />
69 <DialogRef Id="UserExit" />
53 - <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
70
71 <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999" />
72
@@ -61,11 +77,13 @@ Patch dialog sequence:
77 <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Condition="LicenseAccepted = &quot;1&quot;" />
78
79 <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" />
64 - <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
65 - <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
66 - <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4" Condition="WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
80 + <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="3" />
81 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1" />
82 <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2" />
83 +
84 + <Publish Dialog="BrowseDlg" Control="OK" Event="SetTargetPath" Value="[_BrowseProperty]" Order="3" />
85 + <Publish Dialog="BrowseDlg" Control="OK" Event="EndDialog" Value="Return" Order="4" />
86 +
87 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1" Condition="NOT Installed" />
88 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2" Condition="Installed AND NOT PATCH" />
89 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" Condition="Installed AND PATCH" />
src/ext/UI/wixlib/WixUI_Mondo.wxs
+15 -1
@@ -25,7 +25,18 @@ Patch dialog sequence:
25 <?foreach WIXUIARCH in X86;X64;A64 ?>
26 <Fragment>
27 <UI Id="WixUI_Mondo_$(WIXUIARCH)">
28 - <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="3" Condition="NOT WIXUI_DONTVALIDATEPATH" />
28 + <Publish Dialog="BrowseDlg" Control="OK" Event="CheckTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
29 + </UI>
30 +
31 + <UIRef Id="WixUI_Mondo" />
32 + </Fragment>
33 + <?endforeach?>
34 +
35 + <?foreach WIXUIARCH in X86;X64;A64 ?>
36 + <Fragment>
37 + <UI Id="WixUI_Mondo_ExtendedPathValidation_$(WIXUIARCH)">
38 + <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(WIXUIARCH)" Order="1" />
39 + <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="2" Condition="WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
40 </UI>
41
42 <UIRef Id="WixUI_Mondo" />
@@ -66,6 +77,9 @@ Patch dialog sequence:
77 <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2" Condition="WixUI_InstallMode = &quot;InstallCustom&quot;" />
78 <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" />
79
80 + <Publish Dialog="BrowseDlg" Control="OK" Event="SetTargetPath" Value="[_BrowseProperty]" Order="3" />
81 + <Publish Dialog="BrowseDlg" Control="OK" Event="EndDialog" Value="Return" Order="4" />
82 +
83 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1" Condition="WixUI_InstallMode = &quot;InstallCustom&quot;" />
84 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2" Condition="WixUI_InstallMode = &quot;InstallTypical&quot; OR WixUI_InstallMode = &quot;InstallComplete&quot;" />
85 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3" Condition="WixUI_InstallMode = &quot;Change&quot;" />