From b56f402238c62a453d2c80437e4bd98a45139ca1 Mon Sep 17 00:00:00 2001 From: ds5678 <49847914+ds5678@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:32:09 -0700 Subject: [PATCH] Handle strings in Call Analysis and Native Method Detection --- Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs | 2 +- .../ProcessingLayers/NativeMethodDetectionProcessingLayer.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs b/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs index 9250594a..e83af639 100644 --- a/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs +++ b/Cpp2IL.Core/ProcessingLayers/CallAnalysisProcessingLayer.cs @@ -96,7 +96,7 @@ private static void InjectAttribute(ApplicationAnalysisContext appContext) { continue; } - if (instruction.Operands.Length > 0 && instruction.Operands[0].Data is IsilImmediateOperand operand) + if (instruction.Operands.Length > 0 && instruction.Operands[0].Data is IsilImmediateOperand operand && operand.Value is not string) { var address = operand.Value.ToUInt64(null); if (appContext.MethodsByAddress.TryGetValue(address, out var list)) diff --git a/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs b/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs index 7a846156..d03d40c0 100644 --- a/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs +++ b/Cpp2IL.Core/ProcessingLayers/NativeMethodDetectionProcessingLayer.cs @@ -86,7 +86,7 @@ private static void AnalyzeMethod(ApplicationAnalysisContext appContext, MethodA private static bool TryGetAddressFromInstruction(InstructionSetIndependentInstruction instruction, out ulong address) { - if (instruction.Operands.Length > 0 && instruction.Operands[0].Data is IsilImmediateOperand operand) + if (instruction.Operands.Length > 0 && instruction.Operands[0].Data is IsilImmediateOperand operand && operand.Value is not string) { address = operand.Value.ToUInt64(null); return true;