From b564ff214dc28c384b0ddabb424024b23252d5f6 Mon Sep 17 00:00:00 2001 From: TheRogueArchivist <24215969+TheRogueArchivist@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:35:26 -0600 Subject: [PATCH] Add initial Channelware detection (#311) --- BinaryObjectScanner/FileType/Textfile.cs | 8 ++ BinaryObjectScanner/Protection/Channelware.cs | 113 ++++++++++++++++++ README.md | 1 + 3 files changed, 122 insertions(+) create mode 100644 BinaryObjectScanner/Protection/Channelware.cs diff --git a/BinaryObjectScanner/FileType/Textfile.cs b/BinaryObjectScanner/FileType/Textfile.cs index 499fce0b..c6a29b1a 100644 --- a/BinaryObjectScanner/FileType/Textfile.cs +++ b/BinaryObjectScanner/FileType/Textfile.cs @@ -54,6 +54,14 @@ namespace BinaryObjectScanner.FileType else if (fileContent.Contains("Please enter a valid registration number")) protections.Add("CD-Key / Serial"); + // Channelware + // Found in "README.TXT" in Redump entry 116358. + if (fileContent.Contains("This application is a Channelware-activated product.")) + protections.Add("Channelware"); + // Found in "Swr.dat" in the "TOYSTORY" installation folder from Redump entry 12354. + if (fileContent.Contains("cwsw.com/authts")) + protections.Add("Channelware"); + // CopyKiller // Found in "autorun.dat" in CopyKiller versions 3.62 and 3.64. if (fileContent.Contains("CopyKiller CD-Protection V3.6x")) diff --git a/BinaryObjectScanner/Protection/Channelware.cs b/BinaryObjectScanner/Protection/Channelware.cs new file mode 100644 index 00000000..aa97912a --- /dev/null +++ b/BinaryObjectScanner/Protection/Channelware.cs @@ -0,0 +1,113 @@ +#if NET40_OR_GREATER || NETCOREAPP +using System.Collections.Concurrent; +#endif +using System.Collections.Generic; +using System.IO; +using BinaryObjectScanner.Interfaces; +using SabreTools.Matching; +using SabreTools.Serialization.Wrappers; + +namespace BinaryObjectScanner.Protection +{ + /// + /// Channelware was an online activation DRM. + /// + /// Official websites: + /// + /// https://web.archive.org/web/19980212121046/http://www.channelware.com/index.html + /// https://web.archive.org/web/20021002225705/http://cwsw.com/Home/default.asp + /// https://web.archive.org/web/20040101180929/http://www.netactive.com/Home/ + /// + /// TODO: + /// Add version detection. Redump entry 116358 is version 1.x and Redump entry 12354 is 2.x, but the file versions are inconsistent. + /// Investigate "NetActive Reach", which is is either a newer version of this DRM, or a new DRM created by the same company. (https://web.archive.org/web/20040101162921/http://www.netactive.com/Products/) + /// + public class Channelware : IPathCheck, IPortableExecutableCheck + { + /// + public string? CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) + { + // Get the sections from the executable, if possible + var sections = pex.Model.SectionTable; + if (sections == null) + return null; + + // Found in "AbeWincw.dll" in Redump entry 116358 and in "TOYSGMcw.dll" in the "TOYSTORY" installation folder from Redump entry 12354. + var name = pex.ProductName; + if (name?.Equals("ChannelWare Utilities") == true) + return "Channelware"; + + // Found in "cwbrowse.exe" in the "Channelware" folder installed from Redump entry 12354. + if (name?.Equals("Channelware Browser Launcher") == true) + return "Channelware"; + + // Found in "cwuninst.exe" in the "Channelware" folder installed from Redump entry 12354. + if (name?.Equals("Channelware Launcher Uninstall Application") == true) + return "Channelware"; + + // Found in "cwbrowse.exe" in the "Channelware\CWBrowse" folder installed from Redump entry 116358. + if (name?.Equals("Channelware Authorization Server Browser Launcher") == true) + return "Channelware"; + + name = pex.FileDescription; + // Found in "cwuninst.exe" in the "Channelware" folder installed from Redump entry 12354. + if (name?.Equals("Channelware Launcher Uninstall") == true) + return "Channelware"; + + name = pex.LegalTrademarks; + // Found in "CWAuto.dll" and "Upgrader.exe" in the "TOYSTORY" installation folder from Redump entry 12354. + if (name?.Equals("Channelware") == true) + return "Channelware"; + + return null; + } + + /// +#if NET20 || NET35 + public Queue CheckDirectoryPath(string path, IEnumerable? files) +#else + public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) +#endif + { + var matchers = new List + { + // Found in Redump entries 12354 and 116358. + new(new FilePathMatch("cwlaunch.hlp"), "Channelware"), + + // Found in the "Channelware\CWBrowse" folder installed from Redump entry 116358, and in the "Channelware" folder installed from Redump entry 12354. + new(new FilePathMatch("cwbrowse.exe"), "Channelware"), + + // Found in the "Channelware" folder installed from Redump entry 12354. + new(new FilePathMatch("cwuninst.exe"), "Channelware"), + new(new FilePathMatch("chanwr.ini"), "Channelware"), + new(new FilePathMatch("CWAuto.dll"), "Channelware"), + + // TODO: Add check for "CWare" and "cware" folders. + }; + + return MatchUtil.GetAllMatches(files, matchers, any: true); + } + + /// + public string? CheckFilePath(string path) + { + var matchers = new List + { + // Found in Redump entries 12354 and 116358. + new(new FilePathMatch("cwlaunch.hlp"), "Channelware"), + + // Found in the "Channelware\CWBrowse" folder installed from Redump entry 116358, and in the "Channelware" folder installed from Redump entry 12354. + new(new FilePathMatch("cwbrowse.exe"), "Channelware"), + + // Found in the "Channelware" folder installed from Redump entry 12354. + new(new FilePathMatch("cwuninst.exe"), "Channelware"), + new(new FilePathMatch("chanwr.ini"), "Channelware"), + new(new FilePathMatch("CWAuto.dll"), "Channelware"), + + // TODO: Add check for "CWare" and "cware" folders. + }; + + return MatchUtil.GetFirstMatch(path, matchers, any: true); + } + } +} diff --git a/README.md b/README.md index e95f40e3..2d7b2937 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ Below is a list of protections detected by BinaryObjectScanner. The two columns | CD-X | False | True | Unconfirmed¹ | | CDSHiELD SE | True | False | | | Cenga ProtectDVD | True | True | | +| Channelware | True | True | Version finding and detection of later versions unimplemented | | ChosenBytes CodeLock | True | True | Partially unconfirmed² | | CopyKiller | True | True | | | CopyLok/CodeLok | True | False | |