Files
BinaryObjectScanner/BinaryObjectScanner.Protection/CDCheck.cs

38 lines
1.2 KiB
C#
Raw Normal View History

using BinaryObjectScanner.Interfaces;
2023-09-16 02:04:47 -04:00
using SabreTools.Serialization.Wrappers;
2021-03-21 14:30:37 -07:00
namespace BinaryObjectScanner.Protection
{
2022-05-01 17:17:15 -07:00
public class CDCheck : IPortableExecutableCheck
{
/// <inheritdoc/>
2023-09-17 22:37:01 -04:00
#if NET48
2022-05-01 17:17:15 -07:00
public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
2023-09-17 22:37:01 -04:00
#else
public string? CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
#endif
{
// Get the sections from the executable, if possible
2023-09-17 22:37:01 -04:00
var sections = pex.Model.SectionTable;
if (sections == null)
return null;
2023-09-17 22:37:01 -04:00
var name = pex.Comments;
2022-12-08 14:36:43 -08:00
if (name?.Contains("CDCheck utlity for Microsoft Game Studios") == true)
return "Microsoft Game Studios CD Check";
2022-12-08 14:36:43 -08:00
// To broad to be of use
//name = pex.InternalName;
//if (name?.Contains("CDCheck") == true)
// return "Microsoft Game Studios CD Check";
2022-12-08 14:36:43 -08:00
// To broad to be of use
//name = pex.OriginalFilename;
//if (name?.Contains("CDCheck.exe") == true)
// return "Microsoft Game Studios CD Check";
2021-09-13 23:46:59 -07:00
2022-12-08 14:36:43 -08:00
return null;
}
}
}