diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2019-11-25 15:22:32 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2019-11-25 18:06:33 +1000 |
commit | c41ab103681b6bfdfc4c51333bca133482207abb (patch) | |
tree | 51bd3c98973155f94baf5451b7656a900b7e1b3a /src | |
parent | 6cef9ded3d5e246285abc993950ef9964072d9e2 (diff) | |
download | wix-c41ab103681b6bfdfc4c51333bca133482207abb.tar.gz wix-c41ab103681b6bfdfc4c51333bca133482207abb.tar.bz2 wix-c41ab103681b6bfdfc4c51333bca133482207abb.zip |
Fix decompiling non-advertised shortcuts.
Diffstat (limited to 'src')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | 62 | ||||
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs | 2 |
2 files changed, 36 insertions, 28 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index ba515d69..9ecad783 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | |||
@@ -783,6 +783,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
783 | this.FinalizePropertyTable(tables); | 783 | this.FinalizePropertyTable(tables); |
784 | this.FinalizeRemoveFileTable(tables); | 784 | this.FinalizeRemoveFileTable(tables); |
785 | this.FinalizeSearchTables(tables); | 785 | this.FinalizeSearchTables(tables); |
786 | this.FinalizeShortcutTable(tables); | ||
786 | this.FinalizeUpgradeTable(tables); | 787 | this.FinalizeUpgradeTable(tables); |
787 | this.FinalizeSequenceTables(tables); | 788 | this.FinalizeSequenceTables(tables); |
788 | this.FinalizeVerbTable(tables); | 789 | this.FinalizeVerbTable(tables); |
@@ -1360,7 +1361,6 @@ namespace WixToolset.Core.WindowsInstaller | |||
1360 | var extensionTable = tables["Extension"]; | 1361 | var extensionTable = tables["Extension"]; |
1361 | var msiAssemblyTable = tables["MsiAssembly"]; | 1362 | var msiAssemblyTable = tables["MsiAssembly"]; |
1362 | var publishComponentTable = tables["PublishComponent"]; | 1363 | var publishComponentTable = tables["PublishComponent"]; |
1363 | var shortcutTable = tables["Shortcut"]; | ||
1364 | var typeLibTable = tables["TypeLib"]; | 1364 | var typeLibTable = tables["TypeLib"]; |
1365 | 1365 | ||
1366 | if (null != classTable) | 1366 | if (null != classTable) |
@@ -1395,19 +1395,6 @@ namespace WixToolset.Core.WindowsInstaller | |||
1395 | } | 1395 | } |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | if (null != shortcutTable) | ||
1399 | { | ||
1400 | foreach (var row in shortcutTable.Rows) | ||
1401 | { | ||
1402 | var target = Convert.ToString(row[4]); | ||
1403 | |||
1404 | if (!target.StartsWith("[", StringComparison.Ordinal) && !target.EndsWith("]", StringComparison.Ordinal)) | ||
1405 | { | ||
1406 | this.SetPrimaryFeature(row, 4, 3); | ||
1407 | } | ||
1408 | } | ||
1409 | } | ||
1410 | |||
1411 | if (null != typeLibTable) | 1398 | if (null != typeLibTable) |
1412 | { | 1399 | { |
1413 | foreach (var row in typeLibTable.Rows) | 1400 | foreach (var row in typeLibTable.Rows) |
@@ -2435,6 +2422,40 @@ namespace WixToolset.Core.WindowsInstaller | |||
2435 | } | 2422 | } |
2436 | 2423 | ||
2437 | /// <summary> | 2424 | /// <summary> |
2425 | /// Finalize the Shortcut table. | ||
2426 | /// </summary> | ||
2427 | /// <param name="tables">The collection of all tables.</param> | ||
2428 | /// <remarks> | ||
2429 | /// Sets Advertise to yes if Target points to a Feature. | ||
2430 | /// Occurs during finalization because it has to check against every feature row. | ||
2431 | /// </remarks> | ||
2432 | private void FinalizeShortcutTable(TableIndexedCollection tables) | ||
2433 | { | ||
2434 | var shortcutTable = tables["Shortcut"]; | ||
2435 | if (null == shortcutTable) | ||
2436 | { | ||
2437 | return; | ||
2438 | } | ||
2439 | |||
2440 | foreach (var row in shortcutTable.Rows) | ||
2441 | { | ||
2442 | var shortcut = (Wix.Shortcut)this.core.GetIndexedElement(row); | ||
2443 | var target = Convert.ToString(row[4]); | ||
2444 | var feature = this.core.GetIndexedElement("Feature", target); | ||
2445 | if (feature == null) | ||
2446 | { | ||
2447 | // TODO: use this value to do a "more-correct" nesting under the indicated File or CreateDirectory element | ||
2448 | shortcut.Target = target; | ||
2449 | } | ||
2450 | else | ||
2451 | { | ||
2452 | shortcut.Advertise = Wix.YesNoType.yes; | ||
2453 | this.SetPrimaryFeature(row, 4, 3); | ||
2454 | } | ||
2455 | } | ||
2456 | } | ||
2457 | |||
2458 | /// <summary> | ||
2438 | /// Finalize the sequence tables. | 2459 | /// Finalize the sequence tables. |
2439 | /// </summary> | 2460 | /// </summary> |
2440 | /// <param name="tables">The collection of all tables.</param> | 2461 | /// <param name="tables">The collection of all tables.</param> |
@@ -8441,19 +8462,6 @@ namespace WixToolset.Core.WindowsInstaller | |||
8441 | shortcut.Name = names[0]; | 8462 | shortcut.Name = names[0]; |
8442 | } | 8463 | } |
8443 | 8464 | ||
8444 | var target = Convert.ToString(row[4]); | ||
8445 | if (target.StartsWith("[", StringComparison.Ordinal) && target.EndsWith("]", StringComparison.Ordinal)) | ||
8446 | { | ||
8447 | // TODO: use this value to do a "more-correct" nesting under the indicated File or CreateDirectory element | ||
8448 | shortcut.Target = target; | ||
8449 | } | ||
8450 | else | ||
8451 | { | ||
8452 | shortcut.Advertise = Wix.YesNoType.yes; | ||
8453 | |||
8454 | // primary feature is set in FinalizeFeatureComponentsTable | ||
8455 | } | ||
8456 | |||
8457 | if (null != row[5]) | 8465 | if (null != row[5]) |
8458 | { | 8466 | { |
8459 | shortcut.Arguments = Convert.ToString(row[5]); | 8467 | shortcut.Arguments = Convert.ToString(row[5]); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index c44393cf..71ddef8f 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs | |||
@@ -153,7 +153,7 @@ namespace WixToolsetTest.CoreIntegration | |||
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | [Fact(Skip = "Test demonstrates failure")] | 156 | [Fact] |
157 | public void CanDecompileShortcuts() | 157 | public void CanDecompileShortcuts() |
158 | { | 158 | { |
159 | var folder = TestData.Get(@"TestData\Shortcut"); | 159 | var folder = TestData.Get(@"TestData\Shortcut"); |