Introduce early exception for overlength Windows Installer table name
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Bevan Weiss committed
Jul 20, 2024 at 13:39 UTC
1afc0bd5592ecf6e6547f36cfef25127b586f4c3
2 files changed
+20
src/api/wix/WixToolset.Data/ErrorMessages.cs
+6
@@ -2266,6 +2266,11 @@ namespace WixToolset.Data
2266
return Message(sourceLineNumbers, Ids.IllegalAttributeWhenNested, "The File element contains an attribute '{0}' that cannot be used in a File element that is a child of a Component element.", attributeName);
2267
}
2268
2269
+ public static Message OverlengthTableNameInProductOrMergeModule(SourceLineNumber sourceLineNumbers, string tableName)
2270
+ {
2271
+ return Message(sourceLineNumbers, Ids.OverlengthTableNameInProductOrMergeModule, "The table name '{0}' is invalid because the table name exceeds 31 characters in length. For more information, see: https://learn.microsoft.com/en-au/windows/win32/msi/table-names", tableName);
2272
+ }
2273
+
2274
private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
2275
{
2276
return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args);
@@ -2667,6 +2672,7 @@ namespace WixToolset.Data
2672
MsiTransactionInvalidPackage2 = 412,
2673
ExpectedAttributeOrElementWithOtherAttribute = 413,
2674
ExpectedAttributeOrElementWithoutOtherAttribute = 414,
2675
+ OverlengthTableNameInProductOrMergeModule = 415
2676
}
2677
}
2678
}
src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateWindowsInstallerDataFromIRCommand.cs
+14
@@ -1447,6 +1447,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind
1447
this.Messaging.Write(WarningMessages.DangerousTableInMergeModule(row.SourceLineNumbers, table.Name));
1448
}
1449
}
1450
+ else if (31 < table.Name.Length)
1451
+ {
1452
+ foreach (var row in table.Rows)
1453
+ {
1454
+ this.Messaging.Write(ErrorMessages.OverlengthTableNameInProductOrMergeModule(row.SourceLineNumbers, table.Name));
1455
+ }
1456
+ }
1457
break;
1458
1459
case OutputType.PatchCreation:
@@ -1506,6 +1513,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind
1513
this.Messaging.Write(WarningMessages.UnexpectedTableInProduct(row.SourceLineNumbers, table.Name));
1514
}
1515
}
1516
+ else if (31 < table.Name.Length)
1517
+ {
1518
+ foreach (var row in table.Rows)
1519
+ {
1520
+ this.Messaging.Write(ErrorMessages.OverlengthTableNameInProductOrMergeModule(row.SourceLineNumbers, table.Name));
1521
+ }
1522
+ }
1523
break;
1524
}
1525
}