From bb90ea6e3108fa1d1bae577dbdd159ae8ddd8b67 Mon Sep 17 00:00:00 2001
From: LTRData
Date: Sun, 3 Mar 2024 11:32:24 +0100
Subject: [PATCH] Added ManufacturerId to CDBuilder
---
Library/DiscUtils.Iso9660/BuildParameters.cs | 3 +++
Library/DiscUtils.Iso9660/CDBuilder.cs | 25 +++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Library/DiscUtils.Iso9660/BuildParameters.cs b/Library/DiscUtils.Iso9660/BuildParameters.cs
index 481a739fc..ccd87d638 100644
--- a/Library/DiscUtils.Iso9660/BuildParameters.cs
+++ b/Library/DiscUtils.Iso9660/BuildParameters.cs
@@ -26,10 +26,13 @@ internal class BuildParameters
{
public BuildParameters()
{
+ ManufacturerId = ".NET DiscUtils";
VolumeIdentifier = string.Empty;
UseJoliet = true;
}
+ public string ManufacturerId { get; set; }
+
public bool UseJoliet { get; set; }
public string VolumeIdentifier { get; set; }
diff --git a/Library/DiscUtils.Iso9660/CDBuilder.cs b/Library/DiscUtils.Iso9660/CDBuilder.cs
index 13545df38..953013391 100644
--- a/Library/DiscUtils.Iso9660/CDBuilder.cs
+++ b/Library/DiscUtils.Iso9660/CDBuilder.cs
@@ -115,6 +115,26 @@ public string VolumeIdentifier
}
}
+ ///
+ /// Gets or sets the Manufacturer ID for the ISO file.
+ ///
+ ///
+ /// Must be a valid identifier, i.e. max 23 characters.
+ ///
+ public string ManufacturerId
+ {
+ get => _buildParams.ManufacturerId;
+
+ set
+ {
+ if (value.Length > 23)
+ {
+ throw new ArgumentException("Not a valid volume identifier");
+ }
+ _buildParams.ManufacturerId = value;
+ }
+ }
+
///
/// Sets the boot image for the ISO image.
///
@@ -272,7 +292,10 @@ protected override List FixExtents(out long totalLength)
focus += MathUtilities.RoundUp(bootImageExtent.Length, IsoUtilities.SectorSize);
var bootCatalog = new byte[IsoUtilities.SectorSize];
- var bve = new BootValidationEntry();
+ var bve = new BootValidationEntry
+ {
+ ManfId = ManufacturerId
+ };
bve.WriteTo(bootCatalog, 0x00);
_bootEntry.ImageStart = (uint)MathUtilities.Ceil(bootImagePos, IsoUtilities.SectorSize);
if (_bootEntry.BootMediaType == BootDeviceEmulation.NoEmulation)