Return error if trying to create images with negative or overflow sectors on formats that don't support them.

This commit is contained in:
2025-10-24 02:13:08 +01:00
parent cf988b9d63
commit d706fbfc3f
32 changed files with 5639 additions and 8140 deletions

View File

@@ -61,6 +61,20 @@ public sealed partial class Alcohol120
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
_imageInfo = new ImageInfo
{
MediaType = mediaType,

View File

@@ -58,6 +58,20 @@ public sealed partial class Anex86
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors * sectorSize > int.MaxValue || sectors > (long)int.MaxValue * 8 * 33)
{
ErrorMessage = Localization.Too_many_sectors;

View File

@@ -61,6 +61,20 @@ public sealed partial class Apple2Mg
}
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -56,6 +56,20 @@ public sealed partial class AppleDos
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(mediaType != MediaType.Apple32SS && mediaType != MediaType.Apple33SS)
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -59,6 +59,20 @@ public sealed partial class Apridisk
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
_imageInfo = new ImageInfo
{
MediaType = mediaType,

View File

@@ -63,6 +63,20 @@ public sealed partial class Blu
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors > 0xFFFFFF)
{
ErrorMessage = Localization.Too_many_sectors;

View File

@@ -75,6 +75,20 @@ public sealed partial class Cdrdao
else
_separateTracksWriting = false;
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);
@@ -487,8 +501,9 @@ public sealed partial class Cdrdao
}
if(_writingTracks != null && _writingStreams != null)
foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct())
oldTrack.Close();
{
foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) oldTrack.Close();
}
ulong currentOffset = 0;
_writingTracks = [];

View File

@@ -81,6 +81,20 @@ public sealed partial class CdrWin
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
_imageInfo = new ImageInfo
{
MediaType = mediaType,
@@ -422,8 +436,9 @@ public sealed partial class CdrWin
}
if(_writingTracks != null && _writingStreams != null)
foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct())
oldTrack.Close();
{
foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) oldTrack.Close();
}
_writingTracks = [];

View File

@@ -56,6 +56,20 @@ public sealed partial class CisCopy
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -62,6 +62,20 @@ public sealed partial class CloneCd
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
_imageInfo = new ImageInfo
{
MediaType = mediaType,

View File

@@ -63,6 +63,20 @@ public sealed partial class CopyTape
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
_imageInfo = new ImageInfo
{
MediaType = mediaType,

View File

@@ -63,6 +63,20 @@ public sealed partial class DiskCopy42
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
switch(mediaType)
{
case MediaType.AppleFileWare:

View File

@@ -58,6 +58,20 @@ public sealed partial class DriDiskCopy
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors > ushort.MaxValue)
{
ErrorMessage = Localization.Too_many_sectors;

File diff suppressed because it is too large Load Diff

View File

@@ -2952,4 +2952,10 @@
<data name="A2R_Name" xml:space="preserve">
<value>A2R</value>
</data>
<data name="Negative_sectors_are_not_supported" xml:space="preserve">
<value>Los sectores negativos no están soportados.</value>
</data>
<data name="Overflow_sectors_are_not_supported" xml:space="preserve">
<value>Los sectores de sobrecarga no están soportados.</value>
</data>
</root>

View File

@@ -2959,4 +2959,10 @@
<data name="Vhd_Block_size_Must_be_a_power_of_2" xml:space="preserve">
<value>Block size. Must be a power of 2. Only 2MiB and 512KiB are supported by VirtualPC</value>
</data>
<data name="Negative_sectors_are_not_supported" xml:space="preserve">
<value>Negative sectors are not supported.</value>
</data>
<data name="Overflow_sectors_are_not_supported" xml:space="preserve">
<value>Overflow sectors are not supported.</value>
</data>
</root>

View File

@@ -57,6 +57,20 @@ public sealed partial class MaxiDisk
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors > 90 * 2 * 255)
{
ErrorMessage = Localization.Too_many_sectors;

View File

@@ -59,6 +59,20 @@ public sealed partial class Nhdr0
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -59,6 +59,20 @@ public sealed partial class Parallels
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -60,6 +60,20 @@ public sealed partial class Qcow
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -60,6 +60,20 @@ public sealed partial class Qcow2
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -60,6 +60,20 @@ public sealed partial class Qed
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -59,6 +59,20 @@ public sealed partial class RayDim
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors > 255 * 255 * 255)
{
ErrorMessage = Localization.Too_many_sectors;

View File

@@ -60,6 +60,20 @@ public sealed partial class RsIde
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors > 63 * 16 * 1024)
{
ErrorMessage = Localization.Too_many_sectors;

View File

@@ -231,6 +231,20 @@ public sealed partial class SaveDskF
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors > ushort.MaxValue)
{
ErrorMessage = Localization.Too_many_sectors;

View File

@@ -59,6 +59,20 @@ public sealed partial class T98
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -61,6 +61,20 @@ public sealed partial class Udif
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -60,6 +60,20 @@ public sealed partial class Vdi
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -215,6 +215,20 @@ public sealed partial class Vhd
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -135,6 +135,20 @@ public sealed partial class VMware
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(!SupportedMediaTypes.Contains(mediaType))
{
ErrorMessage = string.Format(Localization.Unsupported_media_format_0, mediaType);

View File

@@ -59,6 +59,20 @@ public sealed partial class Virtual98
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
if(sectors > uint.MaxValue)
{
ErrorMessage = Localization.Too_many_sectors;

View File

@@ -57,6 +57,20 @@ public sealed partial class ZZZRawImage
return false;
}
if(negativeSectors != 0)
{
ErrorMessage = Localization.Negative_sectors_are_not_supported;
return false;
}
if(overflowSectors != 0)
{
ErrorMessage = Localization.Overflow_sectors_are_not_supported;
return false;
}
_extension = Path.GetExtension(path)?.ToLower();
switch(_extension)