aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Decompile
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2019-11-26 08:24:48 +1000
committerSean Hall <r.sean.hall@gmail.com>2019-11-26 08:30:11 +1000
commitdda4a326407eb8a0fb5d094ee1e2b5b85d419042 (patch)
tree2e29c663282ed3cd93bbbe7636e4cca662c56777 /src/WixToolset.Core.WindowsInstaller/Decompile
parent2c73e671599f4d05bb98b38dbc79750a1cf04b45 (diff)
downloadwix-dda4a326407eb8a0fb5d094ee1e2b5b85d419042.tar.gz
wix-dda4a326407eb8a0fb5d094ee1e2b5b85d419042.tar.bz2
wix-dda4a326407eb8a0fb5d094ee1e2b5b85d419042.zip
Fix decompiling multiple AppSearches with nested searches.
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Decompile')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
index 961e1a13..b1222d3d 100644
--- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
@@ -2000,7 +2000,7 @@ namespace WixToolset.Core.WindowsInstaller
2000 var drLocators = new Hashtable(); 2000 var drLocators = new Hashtable();
2001 var locators = new Hashtable(); 2001 var locators = new Hashtable();
2002 var usedSearchElements = new Hashtable(); 2002 var usedSearchElements = new Hashtable();
2003 var unusedSearchElements = new ArrayList(); 2003 var unusedSearchElements = new Dictionary<string, Wix.IParentElement>();
2004 2004
2005 Wix.ComplianceCheck complianceCheck = null; 2005 Wix.ComplianceCheck complianceCheck = null;
2006 2006
@@ -2131,6 +2131,7 @@ namespace WixToolset.Core.WindowsInstaller
2131 } 2131 }
2132 else if ("DrLocator" == locatorRow.TableDefinition.Name && null != locatorRow[1]) 2132 else if ("DrLocator" == locatorRow.TableDefinition.Name && null != locatorRow[1])
2133 { 2133 {
2134 var drSearchElement = (Wix.DirectorySearch)searchElement;
2134 var parentSignature = Convert.ToString(locatorRow[1]); 2135 var parentSignature = Convert.ToString(locatorRow[1]);
2135 2136
2136 if ("CCP_DRIVE" == parentSignature) 2137 if ("CCP_DRIVE" == parentSignature)
@@ -2266,7 +2267,7 @@ namespace WixToolset.Core.WindowsInstaller
2266 } 2267 }
2267 2268
2268 parentSearchElement = directorySeachRef; 2269 parentSearchElement = directorySeachRef;
2269 unusedSearchElements.Add(directorySeachRef); 2270 unusedSearchElements.Add(directorySeachRef.Id, directorySeachRef);
2270 } 2271 }
2271 2272
2272 if (!usedSearchElements.Contains(searchElement)) 2273 if (!usedSearchElements.Contains(searchElement))
@@ -2305,7 +2306,7 @@ namespace WixToolset.Core.WindowsInstaller
2305 // keep track of unused DrLocator rows 2306 // keep track of unused DrLocator rows
2306 if (!usedDrLocator) 2307 if (!usedDrLocator)
2307 { 2308 {
2308 unusedSearchElements.Add(searchElement); 2309 unusedSearchElements.Add(drSearchElement.Id, drSearchElement);
2309 } 2310 }
2310 } 2311 }
2311 else 2312 else
@@ -2370,10 +2371,13 @@ namespace WixToolset.Core.WindowsInstaller
2370 } 2371 }
2371 else 2372 else
2372 { 2373 {
2373 if ("DrLocator" == locatorRow.TableDefinition.Name || 2374 if (searchElement is Wix.DirectorySearch directorySearch)
2374 "RegLocator" == locatorRow.TableDefinition.Name)
2375 { 2375 {
2376 unusedSearchElements.Add(searchElement); 2376 unusedSearchElements.Add(directorySearch.Id, directorySearch);
2377 }
2378 else if (searchElement is Wix.RegistrySearch registrySearch)
2379 {
2380 unusedSearchElements.Add(registrySearch.Id, registrySearch);
2377 } 2381 }
2378 else 2382 else
2379 { 2383 {
@@ -2390,8 +2394,12 @@ namespace WixToolset.Core.WindowsInstaller
2390 } 2394 }
2391 } 2395 }
2392 2396
2393 foreach (Wix.IParentElement unusedSearchElement in unusedSearchElements) 2397 // Iterate through the unused elements through a sorted list of their ids so the output is deterministic.
2398 var unusedSearchElementKeys = unusedSearchElements.Keys.ToList();
2399 unusedSearchElementKeys.Sort();
2400 foreach (var unusedSearchElementKey in unusedSearchElementKeys)
2394 { 2401 {
2402 var unusedSearchElement = unusedSearchElements[unusedSearchElementKey];
2395 var used = false; 2403 var used = false;
2396 2404
2397 Wix.DirectorySearch leafDirectorySearch = null; 2405 Wix.DirectorySearch leafDirectorySearch = null;
@@ -2422,13 +2430,11 @@ namespace WixToolset.Core.WindowsInstaller
2422 2430
2423 property.AddChild(unusedSearchSchemaElement); 2431 property.AddChild(unusedSearchSchemaElement);
2424 used = true; 2432 used = true;
2425 break;
2426 } 2433 }
2427 else if (ccpSearches.Contains(leafDirectorySearch.Id)) 2434 else if (ccpSearches.Contains(leafDirectorySearch.Id))
2428 { 2435 {
2429 complianceCheck.AddChild(unusedSearchSchemaElement); 2436 complianceCheck.AddChild(unusedSearchSchemaElement);
2430 used = true; 2437 used = true;
2431 break;
2432 } 2438 }
2433 else 2439 else
2434 { 2440 {