| 797 | |
| 798 | |
| 799 | Ref<Settings> KCViewType::GetLoadSettingsForData(BinaryView* data) |
| 800 | { |
| 801 | Ref<BinaryView> viewRef = Parse(data); |
| 802 | if (!viewRef || !viewRef->Init()) |
| 803 | { |
| 804 | LogWarn("Failed to initialize view of type '%s'. Generating default load settings.", GetName().c_str()); |
| 805 | viewRef = data; |
| 806 | } |
| 807 | |
| 808 | Ref<Settings> settings = GetDefaultLoadSettingsForData(viewRef); |
| 809 | |
| 810 | // specify default load settings that can be overridden |
| 811 | std::vector<std::string> overrides = {"loader.imageBase", "loader.platform"}; |
| 812 | settings->UpdateProperty("loader.imageBase", "message", "Note: File indicates image is not relocatable."); |
| 813 | |
| 814 | for (const auto& override : overrides) |
| 815 | { |
| 816 | if (settings->Contains(override)) |
| 817 | settings->UpdateProperty(override, "readOnly", false); |
| 818 | } |
| 819 | |
| 820 | // Merge existing load settings if they exist. This allows for the selection of a specific object file from a Mach-O |
| 821 | // Universal file. The 'Universal' BinaryViewType generates a schema with 'loader.universal.architectures'. This |
| 822 | // schema contains an appropriate 'Mach-O' load schema for selecting a specific object file. The embedded schema |
| 823 | // contains 'loader.macho.universalImageOffset'. |
| 824 | Ref<Settings> loadSettings = viewRef->GetLoadSettings(GetName()); |
| 825 | if (loadSettings && !loadSettings->IsEmpty()) |
| 826 | settings->DeserializeSchema(loadSettings->SerializeSchema()); |
| 827 | |
| 828 | return settings; |
| 829 | } |
| 830 | |
| 831 | |
| 832 | BinaryNinja::Ref<BinaryNinja::BinaryView> KCViewType::Parse(BinaryNinja::BinaryView* data) |
nothing calls this directly
no test coverage detected