Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions BinaryObjectScanner/Protection/Macrovision.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ public partial class Macrovision : IDiskImageCheck<ISO9660>, IExecutableCheck<Ne
if (diskImage.VolumeDescriptorSet[0] is not PrimaryVolumeDescriptor pvd)
return null;

var applicationUse = pvd.ApplicationUse;
var reserved653Bytes = pvd.Reserved653Bytes;

#region RipGuard

// Macrovision RipGuard protected DVDs have the string "MVSNRGFP" at the start of the application use, followed
// by some other data. The meaning of the rest of the data is unknown, but ultimately not necessary to check.
// Meaning of string unknown. Best guess is "Macrovision RipGuard (File?) Protection"
// While not checked, this string plus a similar-looking block of data appear near the very end of the image
// as well. Possibly part of another standard ISO9660 field?
byte[] ripGuardBytes = [0x4D, 0x56, 0x53, 0x4E, 0x52, 0x47, 0x46, 0x50]; // MVSNRGFP
int offset = 0;
var compareBytes = applicationUse.ReadBytes(ref offset, 8);
if (compareBytes.EqualsExactly(ripGuardBytes))
return "Macrovision RipGuard";

#endregion RipGuard

#region SafeDisc

if (!FileType.ISO9660.NoteworthyApplicationUse(pvd))
return null;

Expand All @@ -37,12 +57,9 @@ public partial class Macrovision : IDiskImageCheck<ISO9660>, IExecutableCheck<Ne
if (!FileType.ISO9660.NoteworthyReserved653Bytes(pvd))
return null;

var applicationUse = pvd.ApplicationUse;
var reserved653Bytes = pvd.Reserved653Bytes;

#region Read Application Use

int offset = 0;
offset = 0;
var appUseZeroBytes = applicationUse.ReadBytes(ref offset, 256);
var appUseDataBytesOne = applicationUse.ReadBytes(ref offset, 128);
offset += 64; // Some extra values get added here over time. Check is good enough, easier to skip this.
Expand Down Expand Up @@ -84,6 +101,8 @@ public partial class Macrovision : IDiskImageCheck<ISO9660>, IExecutableCheck<Ne
return null;

return "SafeDisc";

#endregion
}

/// <inheritdoc/>
Expand Down