@@ -16,61 +16,60 @@ using namespace std;
1616
1717typedef array<uint8_t , 16 > EFI_GUID;
1818
19- class Resolver {
19+ class Resolver
20+ {
2021protected:
21- Ref<BinaryView> m_view;
22- Ref<BackgroundTask> m_task;
23- size_t m_width;
24- map<EFI_GUID, pair<string, string>> m_protocol;
25- map<EFI_GUID, string> m_user_guids;
22+ Ref<BinaryView> m_view;
23+ Ref<BackgroundTask> m_task;
24+ size_t m_width;
25+ map<EFI_GUID, pair<string, string>> m_protocol;
26+ map<EFI_GUID, string> m_user_guids;
2627
27- vector<pair<uint64_t , string>> m_service_usages;
28- vector<pair<uint64_t , string>> m_protocol_usages;
29- vector<pair<uint64_t , EFI_GUID>> m_guid_usages;
30- vector<pair<uint64_t , string>> m_variable_usages;
28+ vector<pair<uint64_t , string>> m_service_usages;
29+ vector<pair<uint64_t , string>> m_protocol_usages;
30+ vector<pair<uint64_t , EFI_GUID>> m_guid_usages;
31+ vector<pair<uint64_t , string>> m_variable_usages;
3132
32- bool parseUserGuidIfExists (const string& filePath);
33- bool parseProtocolMapping (const string& filePath);
33+ bool parseUserGuidIfExists (const string& filePath);
34+ bool parseProtocolMapping (const string& filePath);
3435
35- /* !
36- For backward compatibility, if a user saved a bndb with older version Binary Ninja
37- this function will try to retrieve types from Platform Types if it doesn't find one
38- in BinaryView
39- */
40- Ref<Type> GetTypeFromViewAndPlatform (string type_name);
41- void initProtocolMapping ();
36+ /* !
37+ For backward compatibility, if a user saved a bndb with older version Binary Ninja
38+ this function will try to retrieve types from Platform Types if it doesn't find one
39+ in BinaryView
40+ */
41+ Ref<Type> GetTypeFromViewAndPlatform (string type_name);
42+ void initProtocolMapping ();
4243
4344public:
44- bool setModuleEntry (EFIModuleType fileType);
45- bool resolveGuidInterface (Ref<Function> func, uint64_t addr, int guid_pos, int interface_pos);
46- Resolver (Ref<BinaryView> view, Ref<BackgroundTask> task);
45+ bool setModuleEntry (EFIModuleType fileType);
46+ bool resolveGuidInterface (Ref<Function> func, uint64_t addr, int guid_pos, int interface_pos);
47+ Resolver (Ref<BinaryView> view, Ref<BackgroundTask> task);
4748
48- pair<string, string> lookupGuid (EFI_GUID guidBytes);
49- pair<string, string> defineAndLookupGuid (uint64_t addr);
49+ pair<string, string> lookupGuid (EFI_GUID guidBytes);
50+ pair<string, string> defineAndLookupGuid (uint64_t addr);
5051
51- string nonConflictingName (const string& basename);
52- static string nonConflictingLocalName (Ref<Function> func, const string& basename);
52+ string nonConflictingName (const string& basename);
53+ static string nonConflictingLocalName (Ref<Function> func, const string& basename);
5354
54- /* !
55- Define the structure used at the callsite with type `typeName`, propagate it to the data section. If it's a structure type, define it fields
56- according to the `followFields` parameter. The input `addr` should be a call instruction
57- \param func the function that contains the callsite (it's parent function)
58- \param addr address of the callsite
59- \param typeName the type that need to define
60- \param paramIdx the parameter index that want to define
61- \param followFields whether to define the structure's fields if they are pointers
62- \return False if failed
55+ /* !
56+ Define the structure used at the callsite with type `typeName`, propagate it to the data section. If it's a
57+ structure type, define it fields according to the `followFields` parameter. The input `addr` should be a call
58+ instruction \param func the function that contains the callsite (it's parent function) \param addr address of the
59+ callsite \param typeName the type that need to define \param paramIdx the parameter index that want to define \param
60+ followFields whether to define the structure's fields if they are pointers \return False if failed
6361
64- \b Example:
65- \code{.cpp}
66- refs = bv->GetCodeReferencesForType(QualifiedName("EFI_GET_VARIABLE"));
67- for (auto ref : refs)
68- {
69- // ... some checking, need to make sure is a call instruction
70- bool ok = defineTypeAtCallsite(ref.func, ref.addr, "EFI_GUID", 2, false);
71- }
72- \endcode
73- */
74- bool defineTypeAtCallsite (Ref<Function> func, uint64_t addr, string typeName, int paramIdx, bool followFields = false );
75- vector<HighLevelILInstruction> HighLevelILExprsAt (Ref<Function> func, Ref<Architecture> arch, uint64_t addr);
62+ \b Example:
63+ \code{.cpp}
64+ refs = bv->GetCodeReferencesForType(QualifiedName("EFI_GET_VARIABLE"));
65+ for (auto ref : refs)
66+ {
67+ // ... some checking, need to make sure is a call instruction
68+ bool ok = defineTypeAtCallsite(ref.func, ref.addr, "EFI_GUID", 2, false);
69+ }
70+ \endcode
71+ */
72+ bool defineTypeAtCallsite (
73+ Ref<Function> func, uint64_t addr, string typeName, int paramIdx, bool followFields = false );
74+ vector<HighLevelILInstruction> HighLevelILExprsAt (Ref<Function> func, Ref<Architecture> arch, uint64_t addr);
7675};
0 commit comments