diff options
| author | Bob Arnson <bob@firegiant.com> | 2020-09-27 22:01:36 -0400 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2020-09-27 22:05:14 -0400 |
| commit | c1f7e431ba09005bcc173bc251882d5761069376 (patch) | |
| tree | 90608e80ae338df2ddbc1531eddb685d245eadd3 | |
| parent | efd56dab431aea59eadb120bb72277b7336f23f8 (diff) | |
| download | wix-c1f7e431ba09005bcc173bc251882d5761069376.tar.gz wix-c1f7e431ba09005bcc173bc251882d5761069376.tar.bz2 wix-c1f7e431ba09005bcc173bc251882d5761069376.zip | |
Modularize IconFile
| -rw-r--r-- | src/ca/netshortcuts.cpp | 5 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Util/TestData/InternetShortcut/Package.ico | bin | 0 -> 83899 bytes | |||
| -rw-r--r-- | src/test/WixToolsetTest.Util/TestData/InternetShortcut/PackageComponents.wxs | 7 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.en-us.wxl | 11 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.ico | bin | 0 -> 83899 bytes | |||
| -rw-r--r-- | src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.wxs | 15 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/PackageComponents.wxs | 11 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | 28 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj | 6 | ||||
| -rw-r--r-- | src/wixext/UtilTableDefinitions.cs | 2 |
10 files changed, 76 insertions, 9 deletions
diff --git a/src/ca/netshortcuts.cpp b/src/ca/netshortcuts.cpp index 6ff129db..06826264 100644 --- a/src/ca/netshortcuts.cpp +++ b/src/ca/netshortcuts.cpp | |||
| @@ -219,6 +219,8 @@ static HRESULT CreateUrl( | |||
| 219 | 219 | ||
| 220 | if (wzIconPath) | 220 | if (wzIconPath) |
| 221 | { | 221 | { |
| 222 | WcaLog(LOGMSG_STANDARD, "Adding icon '%ls' index '%d'", wzIconPath, iconIndex); | ||
| 223 | |||
| 222 | hr = piURL->QueryInterface(IID_IPropertySetStorage, (void **)&piProperties); | 224 | hr = piURL->QueryInterface(IID_IPropertySetStorage, (void **)&piProperties); |
| 223 | ExitOnFailure(hr, "failed to get IPropertySetStorage for shortcut '%ls'", wzShortcutPath); | 225 | ExitOnFailure(hr, "failed to get IPropertySetStorage for shortcut '%ls'", wzShortcutPath); |
| 224 | 226 | ||
| @@ -234,7 +236,7 @@ static HRESULT CreateUrl( | |||
| 234 | ppvar[0].vt = VT_I4; | 236 | ppvar[0].vt = VT_I4; |
| 235 | ppvar[0].lVal = iconIndex; | 237 | ppvar[0].lVal = iconIndex; |
| 236 | ppvar[1].vt = VT_LPWSTR; | 238 | ppvar[1].vt = VT_LPWSTR; |
| 237 | ppvar[1].pwszVal = (LPWSTR)wzIconPath; | 239 | ppvar[1].pwszVal = const_cast<LPWSTR>(wzIconPath); |
| 238 | 240 | ||
| 239 | hr = piStorage->WriteMultiple(2, ppids, ppvar, 0); | 241 | hr = piStorage->WriteMultiple(2, ppids, ppvar, 0); |
| 240 | ExitOnFailure(hr, "failed to write icon storage for shortcut '%ls'", wzShortcutPath); | 242 | ExitOnFailure(hr, "failed to write icon storage for shortcut '%ls'", wzShortcutPath); |
| @@ -285,6 +287,7 @@ static HRESULT CreateLink( | |||
| 285 | 287 | ||
| 286 | if (wzIconPath) | 288 | if (wzIconPath) |
| 287 | { | 289 | { |
| 290 | WcaLog(LOGMSG_STANDARD, "Adding icon '%ls' index '%d'", wzIconPath, iconIndex); | ||
| 288 | hr = piShellLink->SetIconLocation(wzIconPath, iconIndex); | 291 | hr = piShellLink->SetIconLocation(wzIconPath, iconIndex); |
| 289 | ExitOnFailure(hr, "failed to set icon for shortcut '%ls'", wzShortcutPath); | 292 | ExitOnFailure(hr, "failed to set icon for shortcut '%ls'", wzShortcutPath); |
| 290 | } | 293 | } |
diff --git a/src/test/WixToolsetTest.Util/TestData/InternetShortcut/Package.ico b/src/test/WixToolsetTest.Util/TestData/InternetShortcut/Package.ico new file mode 100644 index 00000000..53134de7 --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/InternetShortcut/Package.ico | |||
| Binary files differ | |||
diff --git a/src/test/WixToolsetTest.Util/TestData/InternetShortcut/PackageComponents.wxs b/src/test/WixToolsetTest.Util/TestData/InternetShortcut/PackageComponents.wxs index 5319d2f7..2a1b4347 100644 --- a/src/test/WixToolsetTest.Util/TestData/InternetShortcut/PackageComponents.wxs +++ b/src/test/WixToolsetTest.Util/TestData/InternetShortcut/PackageComponents.wxs | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> |
| 2 | <Fragment> | 2 | <Fragment> |
| 3 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | 3 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> |
| 4 | <Component> | 4 | <Component> |
| 5 | <File Source="example.txt" /> | 5 | <File Id="Package.ico" Source="Package.ico" /> |
| 6 | <util:InternetShortcut Id="wixshortcut" Name="WiX Toolset" Target="https://wixtoolset.org" /> | 6 | <util:InternetShortcut Type="link" Name="WiX Toolset (link)" Target="https://wixtoolset.org" IconFile="[#Package.ico]" /> |
| 7 | <util:InternetShortcut Type="url" Name="WiX Toolset (url)" Target="https://wixtoolset.org" IconFile="[#Package.ico]" /> | ||
| 7 | </Component> | 8 | </Component> |
| 8 | </ComponentGroup> | 9 | </ComponentGroup> |
| 9 | </Fragment> | 10 | </Fragment> |
diff --git a/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.en-us.wxl b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.en-us.wxl | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | |||
| 3 | <!-- | ||
| 4 | This file contains the declaration of all the localizable strings. | ||
| 5 | --> | ||
| 6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
| 7 | |||
| 8 | <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String> | ||
| 9 | <String Id="FeatureTitle">MsiPackage</String> | ||
| 10 | |||
| 11 | </WixLocalization> | ||
diff --git a/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.ico b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.ico new file mode 100644 index 00000000..53134de7 --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.ico | |||
| Binary files differ | |||
diff --git a/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.wxs b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.wxs new file mode 100644 index 00000000..f38295e7 --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/Package.wxs | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
| 2 | <Module Language="1033" Version="1.0.0.0" Id="InternetShortcutModule"> | ||
| 3 | <Package Id="047730a5-30fe-4a62-a520-da9381b8226a" Manufacturer="Example Corporation" /> | ||
| 4 | |||
| 5 | <ComponentGroupRef Id="ProductComponents" /> | ||
| 6 | </Module> | ||
| 7 | |||
| 8 | <Fragment> | ||
| 9 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
| 10 | <Directory Id="ProgramFilesFolder"> | ||
| 11 | <Directory Id="INSTALLFOLDER" Name="MergeModule" /> | ||
| 12 | </Directory> | ||
| 13 | </Directory> | ||
| 14 | </Fragment> | ||
| 15 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/PackageComponents.wxs b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/PackageComponents.wxs new file mode 100644 index 00000000..2a1b4347 --- /dev/null +++ b/src/test/WixToolsetTest.Util/TestData/InternetShortcutModule/PackageComponents.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
| 2 | <Fragment> | ||
| 3 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
| 4 | <Component> | ||
| 5 | <File Id="Package.ico" Source="Package.ico" /> | ||
| 6 | <util:InternetShortcut Type="link" Name="WiX Toolset (link)" Target="https://wixtoolset.org" IconFile="[#Package.ico]" /> | ||
| 7 | <util:InternetShortcut Type="url" Name="WiX Toolset (url)" Target="https://wixtoolset.org" IconFile="[#Package.ico]" /> | ||
| 8 | </Component> | ||
| 9 | </ComponentGroup> | ||
| 10 | </Fragment> | ||
| 11 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs index 101d71e8..a32a7d62 100644 --- a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
| @@ -73,7 +73,7 @@ namespace WixToolsetTest.Util | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | [Fact] | 75 | [Fact] |
| 76 | public void CanBuildInternetShortcut() | 76 | public void CanBuildInternetShortcutInProduct() |
| 77 | { | 77 | { |
| 78 | var folder = TestData.Get(@"TestData\InternetShortcut"); | 78 | var folder = TestData.Get(@"TestData\InternetShortcut"); |
| 79 | var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }); | 79 | var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }); |
| @@ -85,8 +85,30 @@ namespace WixToolsetTest.Util | |||
| 85 | "CustomAction:Wix4CreateInternetShortcuts_X64\t3073\tWix4UtilCA_X64\tWixCreateInternetShortcuts\t", | 85 | "CustomAction:Wix4CreateInternetShortcuts_X64\t3073\tWix4UtilCA_X64\tWixCreateInternetShortcuts\t", |
| 86 | "CustomAction:Wix4RollbackInternetShortcuts_X64\t3329\tWix4UtilCA_X64\tWixRollbackInternetShortcuts\t", | 86 | "CustomAction:Wix4RollbackInternetShortcuts_X64\t3329\tWix4UtilCA_X64\tWixRollbackInternetShortcuts\t", |
| 87 | "CustomAction:Wix4SchedInternetShortcuts_X64\t1\tWix4UtilCA_X64\tWixSchedInternetShortcuts\t", | 87 | "CustomAction:Wix4SchedInternetShortcuts_X64\t1\tWix4UtilCA_X64\tWixSchedInternetShortcuts\t", |
| 88 | "RemoveFile:wixshortcut\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tzf9nskwi.lnk|WiX Toolset.lnk\tINSTALLFOLDER\t2", | 88 | "RemoveFile:uisdCsU32.1i4Hebrg1N7E194zJQ8Y\tPackage.ico\thoiptxrr.url|WiX Toolset (url).url\tINSTALLFOLDER\t2", |
| 89 | "Wix4InternetShortcut:wixshortcut\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tINSTALLFOLDER\tWiX Toolset.lnk\thttps://wixtoolset.org\t0\t\t0", | 89 | "RemoveFile:uisjV.q0ROZZYR3h_lkpbkZtLtPH0A\tPackage.ico\tjcxd1dwf.lnk|WiX Toolset (link).lnk\tINSTALLFOLDER\t2", |
| 90 | "Wix4InternetShortcut:uisdCsU32.1i4Hebrg1N7E194zJQ8Y\tPackage.ico\tINSTALLFOLDER\tWiX Toolset (url).url\thttps://wixtoolset.org\t1\t[#Package.ico]\t0", | ||
| 91 | "Wix4InternetShortcut:uisjV.q0ROZZYR3h_lkpbkZtLtPH0A\tPackage.ico\tINSTALLFOLDER\tWiX Toolset (link).lnk\thttps://wixtoolset.org\t0\t[#Package.ico]\t0", | ||
| 92 | }, results.OrderBy(s => s).ToArray()); | ||
| 93 | } | ||
| 94 | |||
| 95 | [Fact] | ||
| 96 | public void CanBuildInternetShortcutInMergeModule() | ||
| 97 | { | ||
| 98 | var folder = TestData.Get(@"TestData\InternetShortcutModule"); | ||
| 99 | var build = new Builder(folder, typeof(UtilExtensionFactory), new[] { folder }); | ||
| 100 | |||
| 101 | var results = build.BuildAndQuery(BuildX64, "Binary", "CustomAction", "RemoveFile", "Wix4InternetShortcut"); | ||
| 102 | WixAssert.CompareLineByLine(new[] | ||
| 103 | { | ||
| 104 | "Binary:Wix4UtilCA_X64.047730A5_30FE_4A62_A520_DA9381B8226A\t[Binary data]", | ||
| 105 | "CustomAction:Wix4CreateInternetShortcuts_X64\t3073\tWix4UtilCA_X64.047730A5_30FE_4A62_A520_DA9381B8226A\tWixCreateInternetShortcuts\t", | ||
| 106 | "CustomAction:Wix4RollbackInternetShortcuts_X64\t3329\tWix4UtilCA_X64.047730A5_30FE_4A62_A520_DA9381B8226A\tWixRollbackInternetShortcuts\t", | ||
| 107 | "CustomAction:Wix4SchedInternetShortcuts_X64\t1\tWix4UtilCA_X64.047730A5_30FE_4A62_A520_DA9381B8226A\tWixSchedInternetShortcuts\t", | ||
| 108 | "RemoveFile:uisdCsU32.1i4Hebrg1N7E194zJQ8Y.047730A5_30FE_4A62_A520_DA9381B8226A\tPackage.ico.047730A5_30FE_4A62_A520_DA9381B8226A\thoiptxrr.url|WiX Toolset (url).url\tINSTALLFOLDER.047730A5_30FE_4A62_A520_DA9381B8226A\t2", | ||
| 109 | "RemoveFile:uisjV.q0ROZZYR3h_lkpbkZtLtPH0A.047730A5_30FE_4A62_A520_DA9381B8226A\tPackage.ico.047730A5_30FE_4A62_A520_DA9381B8226A\tjcxd1dwf.lnk|WiX Toolset (link).lnk\tINSTALLFOLDER.047730A5_30FE_4A62_A520_DA9381B8226A\t2", | ||
| 110 | "Wix4InternetShortcut:uisdCsU32.1i4Hebrg1N7E194zJQ8Y.047730A5_30FE_4A62_A520_DA9381B8226A\tPackage.ico.047730A5_30FE_4A62_A520_DA9381B8226A\tINSTALLFOLDER.047730A5_30FE_4A62_A520_DA9381B8226A\tWiX Toolset (url).url\thttps://wixtoolset.org\t1\t[#Package.ico.047730A5_30FE_4A62_A520_DA9381B8226A]\t0", | ||
| 111 | "Wix4InternetShortcut:uisjV.q0ROZZYR3h_lkpbkZtLtPH0A.047730A5_30FE_4A62_A520_DA9381B8226A\tPackage.ico.047730A5_30FE_4A62_A520_DA9381B8226A\tINSTALLFOLDER.047730A5_30FE_4A62_A520_DA9381B8226A\tWiX Toolset (link).lnk\thttps://wixtoolset.org\t0\t[#Package.ico.047730A5_30FE_4A62_A520_DA9381B8226A]\t0", | ||
| 90 | }, results.OrderBy(s => s).ToArray()); | 112 | }, results.OrderBy(s => s).ToArray()); |
| 91 | } | 113 | } |
| 92 | 114 | ||
diff --git a/src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj b/src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj index f2d5c486..50776c2c 100644 --- a/src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj +++ b/src/test/WixToolsetTest.Util/WixToolsetTest.Util.csproj | |||
| @@ -27,10 +27,14 @@ | |||
| 27 | <Content Include="TestData\CloseApplication\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 27 | <Content Include="TestData\CloseApplication\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
| 28 | <Content Include="TestData\CloseApplication\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 28 | <Content Include="TestData\CloseApplication\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
| 29 | <Content Include="TestData\CloseApplication\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | 29 | <Content Include="TestData\CloseApplication\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> |
| 30 | <Content Include="TestData\InternetShortcut\example.txt" CopyToOutputDirectory="PreserveNewest" /> | 30 | <Content Include="TestData\InternetShortcut\Package.ico" CopyToOutputDirectory="PreserveNewest" /> |
| 31 | <Content Include="TestData\InternetShortcut\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 31 | <Content Include="TestData\InternetShortcut\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
| 32 | <Content Include="TestData\InternetShortcut\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 32 | <Content Include="TestData\InternetShortcut\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
| 33 | <Content Include="TestData\InternetShortcut\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | 33 | <Content Include="TestData\InternetShortcut\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> |
| 34 | <Content Include="TestData\InternetShortcutModule\Package.ico" CopyToOutputDirectory="PreserveNewest" /> | ||
| 35 | <Content Include="TestData\InternetShortcutModule\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
| 36 | <Content Include="TestData\InternetShortcutModule\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 37 | <Content Include="TestData\InternetShortcutModule\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
| 34 | <Content Include="TestData\PermissionEx\example.txt" CopyToOutputDirectory="PreserveNewest" /> | 38 | <Content Include="TestData\PermissionEx\example.txt" CopyToOutputDirectory="PreserveNewest" /> |
| 35 | <Content Include="TestData\PermissionEx\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 39 | <Content Include="TestData\PermissionEx\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
| 36 | <Content Include="TestData\PermissionEx\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 40 | <Content Include="TestData\PermissionEx\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
diff --git a/src/wixext/UtilTableDefinitions.cs b/src/wixext/UtilTableDefinitions.cs index ef5bfeec..e5d0850f 100644 --- a/src/wixext/UtilTableDefinitions.cs +++ b/src/wixext/UtilTableDefinitions.cs | |||
| @@ -100,7 +100,7 @@ namespace WixToolset.Util | |||
| 100 | new ColumnDefinition("Name", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Text, description: "Name used for shortcut.", modularizeType: ColumnModularizeType.Property), | 100 | new ColumnDefinition("Name", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Text, description: "Name used for shortcut.", modularizeType: ColumnModularizeType.Property), |
| 101 | new ColumnDefinition("Target", ColumnType.Localized, 0, primaryKey: false, nullable: false, ColumnCategory.Text, description: "URL target."), | 101 | new ColumnDefinition("Target", ColumnType.Localized, 0, primaryKey: false, nullable: false, ColumnCategory.Text, description: "URL target."), |
| 102 | new ColumnDefinition("Attributes", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, description: "Attribute flags that control how the shortcut is created."), | 102 | new ColumnDefinition("Attributes", ColumnType.Number, 2, primaryKey: false, nullable: false, ColumnCategory.Unknown, description: "Attribute flags that control how the shortcut is created."), |
| 103 | new ColumnDefinition("IconFile", ColumnType.Localized, 0, primaryKey: false, nullable: true, ColumnCategory.Text, description: "Icon file for shortcut"), | 103 | new ColumnDefinition("IconFile", ColumnType.Localized, 0, primaryKey: false, nullable: true, ColumnCategory.Formatted, description: "Icon file for shortcut", modularizeType: ColumnModularizeType.Property), |
| 104 | new ColumnDefinition("IconIndex", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, description: "Index of the icon being referenced."), | 104 | new ColumnDefinition("IconIndex", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, description: "Index of the icon being referenced."), |
| 105 | }, | 105 | }, |
| 106 | symbolIdIsPrimaryKey: true | 106 | symbolIdIsPrimaryKey: true |
