MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GetLoadSettingsForData

Method GetLoadSettingsForData

view/kernelcache/core/KCView.cpp:799–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797
798
799Ref<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
832BinaryNinja::Ref<BinaryNinja::BinaryView> KCViewType::Parse(BinaryNinja::BinaryView* data)

Callers

nothing calls this directly

Calls 8

c_strMethod · 0.80
UpdatePropertyMethod · 0.80
GetLoadSettingsMethod · 0.80
DeserializeSchemaMethod · 0.80
SerializeSchemaMethod · 0.80
InitMethod · 0.45
ContainsMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected