コード例 #1
0
        public AnalysisApplicability CanAnalyze(BinaryAnalyzerContext context, out string reasonForNotAnalyzing)
        {
            PE portableExecutable        = context.PE;
            AnalysisApplicability result = AnalysisApplicability.NotApplicableToSpecifiedTarget;

            reasonForNotAnalyzing = MetadataConditions.ImageIsKernelModeBinary;
            if (portableExecutable.IsKernelMode)
            {
                return(result);
            }

            reasonForNotAnalyzing = MetadataConditions.ImageIsResourceOnlyBinary;
            if (portableExecutable.IsResourceOnly)
            {
                return(result);
            }

            reasonForNotAnalyzing = MetadataConditions.ImageIsILOnlyManagedAssembly;
            if (portableExecutable.IsILOnly)
            {
                return(result);
            }

            if (portableExecutable.LinkerVersion < MinimumSupportedLinkerVersion)
            {
                reasonForNotAnalyzing = RuleUtilities.BuildObsoleteToolsMessage(
                    portableExecutable.LinkerVersion, MinimumSupportedLinkerVersion);
                return(result);
            }

            return(AnalysisApplicability.ApplicableToSpecifiedTarget);
        }