diff options
| author | Bob Arnson <bob@firegiant.com> | 2020-10-23 17:32:44 -0400 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2020-10-24 19:44:44 -0400 |
| commit | 8b5505cd13367d48bce4ec8a6018e370ed3755b1 (patch) | |
| tree | 97fb50229aff208bce91b160d11ffeee9b1e783a /src/WixToolset.Core.WindowsInstaller | |
| parent | 95188080c8005c01c39bb071459b36f8660bcfcd (diff) | |
| download | wix-8b5505cd13367d48bce4ec8a6018e370ed3755b1.tar.gz wix-8b5505cd13367d48bce4ec8a6018e370ed3755b1.tar.bz2 wix-8b5505cd13367d48bce4ec8a6018e370ed3755b1.zip | |
Reorganize Product/Package to Package/SummaryInformation.
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller')
3 files changed, 72 insertions, 57 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs index 6af2dc7a..a496c7ce 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs | |||
| @@ -46,9 +46,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 46 | this.InstallerVersion = 0; | 46 | this.InstallerVersion = 0; |
| 47 | this.ModularizationSuffix = null; | 47 | this.ModularizationSuffix = null; |
| 48 | 48 | ||
| 49 | var foundCreateDataTime = false; | 49 | var foundCreateDateTime = false; |
| 50 | var foundLastSaveDataTime = false; | 50 | var foundLastSaveDataTime = false; |
| 51 | var foundCreatingApplication = false; | 51 | var foundCreatingApplication = false; |
| 52 | var foundPackageCode = false; | ||
| 52 | var now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture); | 53 | var now = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture); |
| 53 | 54 | ||
| 54 | foreach (var summaryInformationSymbol in this.Section.Symbols.OfType<SummaryInformationSymbol>()) | 55 | foreach (var summaryInformationSymbol in this.Section.Symbols.OfType<SummaryInformationSymbol>()) |
| @@ -73,20 +74,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 73 | break; | 74 | break; |
| 74 | 75 | ||
| 75 | case SummaryInformationType.PackageCode: // PID_REVNUMBER | 76 | case SummaryInformationType.PackageCode: // PID_REVNUMBER |
| 77 | foundPackageCode = true; | ||
| 76 | var packageCode = summaryInformationSymbol.Value; | 78 | var packageCode = summaryInformationSymbol.Value; |
| 77 | 79 | ||
| 78 | if (SectionType.Module == this.Section.Type) | 80 | if (SectionType.Module == this.Section.Type) |
| 79 | { | 81 | { |
| 80 | this.ModularizationSuffix = "." + packageCode.Substring(1, 36).Replace('-', '_'); | 82 | this.ModularizationSuffix = "." + packageCode.Substring(1, 36).Replace('-', '_'); |
| 81 | } | 83 | } |
| 82 | else if ("*" == packageCode) | ||
| 83 | { | ||
| 84 | // set the revision number (package/patch code) if it should be automatically generated | ||
| 85 | summaryInformationSymbol.Value = Common.GenerateGuid(); | ||
| 86 | } | ||
| 87 | break; | 84 | break; |
| 88 | case SummaryInformationType.Created: | 85 | case SummaryInformationType.Created: |
| 89 | foundCreateDataTime = true; | 86 | foundCreateDateTime = true; |
| 90 | break; | 87 | break; |
| 91 | case SummaryInformationType.LastSaved: | 88 | case SummaryInformationType.LastSaved: |
| 92 | foundLastSaveDataTime = true; | 89 | foundLastSaveDataTime = true; |
| @@ -113,8 +110,18 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 113 | } | 110 | } |
| 114 | } | 111 | } |
| 115 | 112 | ||
| 113 | // set the revision number (package/patch code) if it should be automatically generated | ||
| 114 | if (!foundPackageCode) | ||
| 115 | { | ||
| 116 | this.Section.AddSymbol(new SummaryInformationSymbol(null) | ||
| 117 | { | ||
| 118 | PropertyId = SummaryInformationType.PackageCode, | ||
| 119 | Value = Common.GenerateGuid(), | ||
| 120 | }); | ||
| 121 | } | ||
| 122 | |||
| 116 | // add a summary information row for the create time/date property if its not already set | 123 | // add a summary information row for the create time/date property if its not already set |
| 117 | if (!foundCreateDataTime) | 124 | if (!foundCreateDateTime) |
| 118 | { | 125 | { |
| 119 | this.Section.AddSymbol(new SummaryInformationSymbol(null) | 126 | this.Section.AddSymbol(new SummaryInformationSymbol(null) |
| 120 | { | 127 | { |
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index a0146fda..80ee75a5 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | |||
| @@ -160,7 +160,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 160 | this.RootElement = new XElement(Names.PatchCreationElement); | 160 | this.RootElement = new XElement(Names.PatchCreationElement); |
| 161 | break; | 161 | break; |
| 162 | case OutputType.Product: | 162 | case OutputType.Product: |
| 163 | this.RootElement = new XElement(Names.ProductElement); | 163 | this.RootElement = new XElement(Names.PackageElement); |
| 164 | break; | 164 | break; |
| 165 | default: | 165 | default: |
| 166 | throw new InvalidOperationException("Unknown output type."); | 166 | throw new InvalidOperationException("Unknown output type."); |
| @@ -669,6 +669,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 669 | } | 669 | } |
| 670 | else | 670 | else |
| 671 | { | 671 | { |
| 672 | this.FinalizeSummaryInformationStream(tables); | ||
| 672 | this.FinalizeCheckBoxTable(tables); | 673 | this.FinalizeCheckBoxTable(tables); |
| 673 | this.FinalizeComponentTable(tables); | 674 | this.FinalizeComponentTable(tables); |
| 674 | this.FinalizeDialogTable(tables); | 675 | this.FinalizeDialogTable(tables); |
| @@ -2548,7 +2549,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 2548 | switch (table.Name) | 2549 | switch (table.Name) |
| 2549 | { | 2550 | { |
| 2550 | case "_SummaryInformation": | 2551 | case "_SummaryInformation": |
| 2551 | this.Decompile_SummaryInformationTable(table); | 2552 | // handled in FinalizeDecompile |
| 2552 | break; | 2553 | break; |
| 2553 | case "AdminExecuteSequence": | 2554 | case "AdminExecuteSequence": |
| 2554 | case "AdminUISequence": | 2555 | case "AdminUISequence": |
| @@ -2976,11 +2977,13 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 2976 | /// Decompile the _SummaryInformation table. | 2977 | /// Decompile the _SummaryInformation table. |
| 2977 | /// </summary> | 2978 | /// </summary> |
| 2978 | /// <param name="table">The table to decompile.</param> | 2979 | /// <param name="table">The table to decompile.</param> |
| 2979 | private void Decompile_SummaryInformationTable(Table table) | 2980 | private void FinalizeSummaryInformationStream(TableIndexedCollection tables) |
| 2980 | { | 2981 | { |
| 2982 | var table = tables["_SummaryInformation"]; | ||
| 2983 | |||
| 2981 | if (OutputType.Module == this.OutputType || OutputType.Product == this.OutputType) | 2984 | if (OutputType.Module == this.OutputType || OutputType.Product == this.OutputType) |
| 2982 | { | 2985 | { |
| 2983 | var xPackage = new XElement(Names.PackageElement); | 2986 | var xSummaryInformation = new XElement(Names.SummaryInformationElement); |
| 2984 | 2987 | ||
| 2985 | foreach (var row in table.Rows) | 2988 | foreach (var row in table.Rows) |
| 2986 | { | 2989 | { |
| @@ -2993,56 +2996,63 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 2993 | case 1: | 2996 | case 1: |
| 2994 | if ("1252" != value) | 2997 | if ("1252" != value) |
| 2995 | { | 2998 | { |
| 2996 | xPackage.SetAttributeValue("SummaryCodepage", value); | 2999 | xSummaryInformation.SetAttributeValue("Codepage", value); |
| 2997 | } | 3000 | } |
| 2998 | break; | 3001 | break; |
| 2999 | case 3: | 3002 | case 3: |
| 3000 | xPackage.SetAttributeValue("Description", value); | 3003 | { |
| 3004 | var productName = this.RootElement.Attribute("Name")?.Value; | ||
| 3005 | if (value != productName) | ||
| 3006 | { | ||
| 3007 | xSummaryInformation.SetAttributeValue("Description", value); | ||
| 3008 | } | ||
| 3001 | break; | 3009 | break; |
| 3010 | } | ||
| 3002 | case 4: | 3011 | case 4: |
| 3003 | xPackage.SetAttributeValue("Manufacturer", value); | 3012 | { |
| 3004 | break; | 3013 | var productManufacturer = this.RootElement.Attribute("Manufacturer")?.Value; |
| 3005 | case 5: | 3014 | if (value != productManufacturer) |
| 3006 | if ("Installer" != value) | ||
| 3007 | { | 3015 | { |
| 3008 | xPackage.SetAttributeValue("Keywords", value); | 3016 | xSummaryInformation.SetAttributeValue("Manufacturer", value); |
| 3009 | } | 3017 | } |
| 3010 | break; | 3018 | break; |
| 3011 | case 6: | 3019 | } |
| 3012 | if (!value.StartsWith("This installer database contains the logic and data required to install ")) | 3020 | case 5: |
| 3021 | if ("Installer" != value) | ||
| 3013 | { | 3022 | { |
| 3014 | xPackage.SetAttributeValue("Comments", value); | 3023 | xSummaryInformation.SetAttributeValue("Keywords", value); |
| 3015 | } | 3024 | } |
| 3016 | break; | 3025 | break; |
| 3017 | case 7: | 3026 | case 7: |
| 3018 | var template = value.Split(';'); | 3027 | var template = value.Split(';'); |
| 3019 | if (0 < template.Length && 0 < template[template.Length - 1].Length) | 3028 | if (0 < template.Length && 0 < template[template.Length - 1].Length) |
| 3020 | { | 3029 | { |
| 3021 | xPackage.SetAttributeValue("Languages", template[template.Length - 1]); | 3030 | this.RootElement.SetAttributeValue("Language", template[template.Length - 1]); |
| 3022 | } | ||
| 3023 | |||
| 3024 | var platform = GetPlatformFromTemplateSummaryInformation(template).ToString().ToLowerInvariant(); | ||
| 3025 | if (!String.IsNullOrEmpty(platform)) | ||
| 3026 | { | ||
| 3027 | xPackage.SetAttributeValue("Platform", platform); | ||
| 3028 | } | 3031 | } |
| 3029 | break; | 3032 | break; |
| 3030 | case 9: | 3033 | case 9: |
| 3031 | if (OutputType.Module == this.OutputType) | 3034 | if (OutputType.Module == this.OutputType) |
| 3032 | { | 3035 | { |
| 3033 | this.ModularizationGuid = value; | 3036 | this.ModularizationGuid = value; |
| 3034 | xPackage.SetAttributeValue("Id", value); | ||
| 3035 | } | 3037 | } |
| 3036 | break; | 3038 | break; |
| 3037 | case 14: | 3039 | case 14: |
| 3038 | xPackage.SetAttributeValue("InstallerVersion", row.FieldAsInteger(1)); | 3040 | var installerVersion = row.FieldAsInteger(1); |
| 3041 | // Default InstallerVersion. | ||
| 3042 | if (installerVersion != 500) | ||
| 3043 | { | ||
| 3044 | this.RootElement.SetAttributeValue("InstallerVersion", installerVersion); | ||
| 3045 | } | ||
| 3039 | break; | 3046 | break; |
| 3040 | case 15: | 3047 | case 15: |
| 3041 | var wordCount = row.FieldAsInteger(1); | 3048 | var wordCount = row.FieldAsInteger(1); |
| 3042 | if (0x1 == (wordCount & 0x1)) | 3049 | if (0x1 == (wordCount & 0x1)) |
| 3043 | { | 3050 | { |
| 3044 | this.ShortNames = true; | 3051 | this.ShortNames = true; |
| 3045 | xPackage.SetAttributeValue("ShortNames", "yes"); | 3052 | if (OutputType.Product == this.OutputType) |
| 3053 | { | ||
| 3054 | this.RootElement.SetAttributeValue("ShortNames", "yes"); | ||
| 3055 | } | ||
| 3046 | } | 3056 | } |
| 3047 | 3057 | ||
| 3048 | if (0x2 == (wordCount & 0x2)) | 3058 | if (0x2 == (wordCount & 0x2)) |
| @@ -3051,38 +3061,35 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 3051 | 3061 | ||
| 3052 | if (OutputType.Product == this.OutputType) | 3062 | if (OutputType.Product == this.OutputType) |
| 3053 | { | 3063 | { |
| 3054 | xPackage.SetAttributeValue("Compressed", "yes"); | 3064 | this.RootElement.SetAttributeValue("Compressed", "yes"); |
| 3055 | } | 3065 | } |
| 3056 | } | 3066 | } |
| 3057 | 3067 | ||
| 3058 | if (0x4 == (wordCount & 0x4)) | 3068 | if (OutputType.Product == this.OutputType) |
| 3059 | { | 3069 | { |
| 3060 | xPackage.SetAttributeValue("AdminImage", "yes"); | 3070 | if (0x8 == (wordCount & 0x8)) |
| 3061 | } | 3071 | { |
| 3062 | 3072 | this.RootElement.SetAttributeValue("Scope", "perUser"); | |
| 3063 | if (0x8 == (wordCount & 0x8)) | 3073 | } |
| 3064 | { | 3074 | else |
| 3065 | xPackage.SetAttributeValue("InstallPrivileges", "limited"); | 3075 | { |
| 3076 | var xAllUsers = this.RootElement.Elements(Names.PropertyElement).SingleOrDefault(p => p.Attribute("Id")?.Value == "ALLUSERS"); | ||
| 3077 | if (xAllUsers?.Attribute("Value")?.Value == "1") | ||
| 3078 | { | ||
| 3079 | xAllUsers?.Remove(); | ||
| 3080 | } | ||
| 3081 | } | ||
| 3066 | } | 3082 | } |
| 3067 | 3083 | ||
| 3068 | break; | 3084 | break; |
| 3069 | case 19: | ||
| 3070 | var security = row.FieldAsInteger(1); | ||
| 3071 | switch (security) | ||
| 3072 | { | ||
| 3073 | case 0: | ||
| 3074 | xPackage.SetAttributeValue("ReadOnly", "no"); | ||
| 3075 | break; | ||
| 3076 | case 4: | ||
| 3077 | xPackage.SetAttributeValue("ReadOnly", "yes"); | ||
| 3078 | break; | ||
| 3079 | } | ||
| 3080 | break; | ||
| 3081 | } | 3085 | } |
| 3082 | } | 3086 | } |
| 3083 | } | 3087 | } |
| 3084 | 3088 | ||
| 3085 | this.RootElement.Add(xPackage); | 3089 | if (xSummaryInformation.HasAttributes) |
| 3090 | { | ||
| 3091 | this.RootElement.Add(xSummaryInformation); | ||
| 3092 | } | ||
| 3086 | } | 3093 | } |
| 3087 | else | 3094 | else |
| 3088 | { | 3095 | { |
| @@ -6204,7 +6211,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 6204 | this.RootElement.SetAttributeValue("Manufacturer", value); | 6211 | this.RootElement.SetAttributeValue("Manufacturer", value); |
| 6205 | continue; | 6212 | continue; |
| 6206 | case "ProductCode": | 6213 | case "ProductCode": |
| 6207 | this.RootElement.SetAttributeValue("Id", value.ToUpper(CultureInfo.InvariantCulture)); | 6214 | this.RootElement.SetAttributeValue("ProductCode", value.ToUpper(CultureInfo.InvariantCulture)); |
| 6208 | continue; | 6215 | continue; |
| 6209 | case "ProductLanguage": | 6216 | case "ProductLanguage": |
| 6210 | this.RootElement.SetAttributeValue("Language", value); | 6217 | this.RootElement.SetAttributeValue("Language", value); |
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs index 63ab5cd3..82258c57 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Names.cs | |||
| @@ -8,10 +8,12 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
| 8 | 8 | ||
| 9 | public static readonly XName WixElement = WxsNamespace + "Wix"; | 9 | public static readonly XName WixElement = WxsNamespace + "Wix"; |
| 10 | 10 | ||
| 11 | public static readonly XName ProductElement = WxsNamespace + "Product"; | 11 | public static readonly XName PackageElement = WxsNamespace + "Package"; |
| 12 | public static readonly XName ModuleElement = WxsNamespace + "Module"; | 12 | public static readonly XName ModuleElement = WxsNamespace + "Module"; |
| 13 | public static readonly XName PatchCreationElement = WxsNamespace + "PatchCreation"; | 13 | public static readonly XName PatchCreationElement = WxsNamespace + "PatchCreation"; |
| 14 | 14 | ||
| 15 | public static readonly XName SummaryInformationElement = WxsNamespace + "SummaryInformation"; | ||
| 16 | |||
| 15 | public static readonly XName CustomElement = WxsNamespace + "Custom"; | 17 | public static readonly XName CustomElement = WxsNamespace + "Custom"; |
| 16 | 18 | ||
| 17 | public static readonly XName AdminExecuteSequenceElement = WxsNamespace + "AdminExecuteSequence"; | 19 | public static readonly XName AdminExecuteSequenceElement = WxsNamespace + "AdminExecuteSequence"; |
| @@ -30,9 +32,8 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
| 30 | public static readonly XName FileElement = WxsNamespace + "File"; | 32 | public static readonly XName FileElement = WxsNamespace + "File"; |
| 31 | 33 | ||
| 32 | public static readonly XName EnsureTableElement = WxsNamespace + "EnsureTable"; | 34 | public static readonly XName EnsureTableElement = WxsNamespace + "EnsureTable"; |
| 33 | public static readonly XName PackageElement = WxsNamespace + "Package"; | ||
| 34 | public static readonly XName PatchInformationElement = WxsNamespace + "PatchInformation"; | 35 | public static readonly XName PatchInformationElement = WxsNamespace + "PatchInformation"; |
| 35 | 36 | ||
| 36 | public static readonly XName ProgressTextElement = WxsNamespace + "ProgressText"; | 37 | public static readonly XName ProgressTextElement = WxsNamespace + "ProgressText"; |
| 37 | public static readonly XName UIElement = WxsNamespace + "UI"; | 38 | public static readonly XName UIElement = WxsNamespace + "UI"; |
| 38 | 39 | ||
