From e2289fb9c095ef1750a63adf550f3d661c0f3fab Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sun, 9 Aug 2020 19:54:43 +0200 Subject: [PATCH] AppModel: Include all binary symbols in model --- Il2CppInspector.Common/Model/AppModel.cs | 12 ++++++++---- Il2CppInspector.Common/Model/AppType.cs | 1 + Il2CppInspector.Common/Outputs/JSONMetadata.cs | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Il2CppInspector.Common/Model/AppModel.cs b/Il2CppInspector.Common/Model/AppModel.cs index 8229066..4bc5cb7 100644 --- a/Il2CppInspector.Common/Model/AppModel.cs +++ b/Il2CppInspector.Common/Model/AppModel.cs @@ -16,8 +16,6 @@ using Il2CppInspector.Reflection; namespace Il2CppInspector.Model { - // Class that represents a composite IL/C++ type - // Class that represents the entire structure of the IL2CPP binary realized as C++ types and code, // correlated with .NET types where applicable. Primarily designed to enable automated static analysis of disassembly code. public class AppModel : IEnumerable @@ -58,9 +56,12 @@ namespace Il2CppInspector.Model // The .NET type model for the application public TypeModel ILModel { get; } - // All of the symbol exports (including function exports) for the binary + // All of the exports (including function exports) for the binary public List Exports { get; } + // All of the symbols representing function names, signatures or type/field names or address labels for the binary + public Dictionary Symbols { get; } + // All of the API exports defined in the IL2CPP binary // Note: Multiple export names may have the same virtual address public MultiKeyDictionary AvailableAPIs { get; } = new MultiKeyDictionary(); @@ -99,7 +100,10 @@ namespace Il2CppInspector.Model ILModel = model; // Get addresses of all exports - Exports = model.Package.Binary.Image.GetExports()?.ToList() ?? new List(); + Exports = Package.BinaryImage.GetExports()?.ToList() ?? new List(); + + // Get all symbols + Symbols = Package.BinaryImage.GetSymbolTable(); } // Build the application model targeting a specific version of Unity and C++ compiler diff --git a/Il2CppInspector.Common/Model/AppType.cs b/Il2CppInspector.Common/Model/AppType.cs index 489b3f2..86f9a3f 100644 --- a/Il2CppInspector.Common/Model/AppType.cs +++ b/Il2CppInspector.Common/Model/AppType.cs @@ -9,6 +9,7 @@ using Il2CppInspector.Reflection; namespace Il2CppInspector.Model { + // Class that represents a composite IL/C++ type public class AppType { // The logical group this type is part of diff --git a/Il2CppInspector.Common/Outputs/JSONMetadata.cs b/Il2CppInspector.Common/Outputs/JSONMetadata.cs index f491d5f..41055db 100644 --- a/Il2CppInspector.Common/Outputs/JSONMetadata.cs +++ b/Il2CppInspector.Common/Outputs/JSONMetadata.cs @@ -187,7 +187,7 @@ namespace Il2CppInspector.Outputs } private void writeSymbols() { - var symbols = model.Package.BinaryImage.GetSymbolTable().Values; + var symbols = model.Symbols.Values; writeArray("symbols", () => { foreach (var symbol in symbols) {