2022-07-27 14:06:52 -06:00
using System ;
using System.Collections.Concurrent ;
2021-07-18 09:44:23 -07:00
using System.Collections.Generic ;
2023-03-09 11:52:28 -05:00
using BinaryObjectScanner.Interfaces ;
2023-03-07 16:59:14 -05:00
using BinaryObjectScanner.Matching ;
using BinaryObjectScanner.Wrappers ;
2019-09-27 23:52:24 -07:00
2023-03-09 23:19:27 -05:00
namespace BinaryObjectScanner.Protection
2019-09-27 23:52:24 -07:00
{
2022-07-27 14:06:52 -06:00
/// <summary>
/// MediaCloQ was a copy protection created by SunnComm to protect music CDs. It's a multisession CD, and all the audio tracks are erroneously marked as data tracks.
2023-02-09 07:05:13 -07:00
/// <see href="https://github.com/TheRogueArchivist/DRML/blob/main/entries/MediaCloQ/MediaCloQ.md/>
2022-07-27 14:06:52 -06:00
/// </summary>
public class MediaCloQ : IPathCheck , IPortableExecutableCheck
2019-09-27 23:52:24 -07:00
{
2023-01-14 01:44:10 -07:00
// TODO: "Karaoke Spotlight Series - Pop Hits - Vol. 132" - Sound Choice (SC8732)" is currently undetected, due to there seeming to be no reference to MediaCloQ in the disc's contents.
2022-07-27 14:06:52 -06:00
/// <inheritdoc/>
public string CheckPortableExecutable ( string file , PortableExecutable pex , bool includeDebug )
{
// Get the sections from the executable, if possible
var sections = pex ? . SectionTable ;
if ( sections = = null )
return null ;
// Found in scvfy.exe on "Charley Pride - A Tribute to Jim Reeves" (barcode "7 816190222-2 4").
string name = pex . FileDescription ;
2022-08-21 20:34:59 -07:00
if ( name ? . StartsWith ( "scvfy MFC Application" , StringComparison . OrdinalIgnoreCase ) = = true )
2022-07-27 14:06:52 -06:00
return $"MediaCloQ" ;
// Found in scvfy.exe on "Charley Pride - A Tribute to Jim Reeves" (barcode "7 816190222-2 4").
name = pex . ProductName ;
2022-08-21 20:34:59 -07:00
if ( name ? . StartsWith ( "scvfy Application" , StringComparison . OrdinalIgnoreCase ) = = true )
2022-07-27 14:06:52 -06:00
return $"MediaCloQ" ;
return null ;
}
2021-02-26 00:32:09 -08:00
/// <inheritdoc/>
2021-07-18 09:44:23 -07:00
public ConcurrentQueue < string > CheckDirectoryPath ( string path , IEnumerable < string > files )
2019-09-27 23:52:24 -07:00
{
2021-03-23 09:52:09 -07:00
var matchers = new List < PathMatchSet >
{
2023-01-14 01:44:10 -07:00
// The file "sunncomm.ico" was a previously used file check, but since it's just an icon of the SunnComm logo, it seems too likely to result in false positives.
2022-07-27 14:06:52 -06:00
// Found on "Charley Pride - A Tribute to Jim Reeves" (barcode "7 816190222-2 4").
new PathMatchSet ( new PathMatch ( "scvfy.exe" , useEndsWith : true ) , "MediaCloQ" ) ,
2021-03-23 09:52:09 -07:00
} ;
2021-03-23 13:35:12 -07:00
return MatchUtil . GetAllMatches ( files , matchers , any : true ) ;
2021-03-19 15:41:49 -07:00
}
/// <inheritdoc/>
public string CheckFilePath ( string path )
{
2021-03-23 09:52:09 -07:00
var matchers = new List < PathMatchSet >
{
2023-01-14 01:44:10 -07:00
// The file "sunncomm.ico" was a previously used file check, but since it's just an icon of the SunnComm logo, it seems too likely to result in false positives.
2022-07-27 14:06:52 -06:00
// Found on "Charley Pride - A Tribute to Jim Reeves" (barcode "7 816190222-2 4").
new PathMatchSet ( new PathMatch ( "scvfy.exe" , useEndsWith : true ) , "MediaCloQ" ) ,
2021-03-23 09:52:09 -07:00
} ;
2019-09-27 23:52:24 -07:00
2021-03-23 09:52:09 -07:00
return MatchUtil . GetFirstMatch ( path , matchers , any : true ) ;
2019-09-27 23:52:24 -07:00
}
}
}