| 86 | |
| 87 | |
| 88 | std::optional<CompleteObjectLocator> ReadCompleteObjectorLocator(BinaryView *view, uint64_t address) |
| 89 | { |
| 90 | auto coLocator = CompleteObjectLocator(view, address); |
| 91 | uint64_t startAddr = view->GetOriginalImageBase(); |
| 92 | |
| 93 | auto outsideSection = [&](uint64_t addr) { |
| 94 | return view->GetSectionsAt(addr).empty(); |
| 95 | }; |
| 96 | |
| 97 | if (coLocator.signature > 1) |
| 98 | return std::nullopt; |
| 99 | |
| 100 | if (coLocator.signature == COL_SIG_REV1) |
| 101 | { |
| 102 | if (coLocator.pSelf + startAddr != address) |
| 103 | return std::nullopt; |
| 104 | |
| 105 | // Relative addrs |
| 106 | if (outsideSection(coLocator.pTypeDescriptor + startAddr)) |
| 107 | return std::nullopt; |
| 108 | |
| 109 | if (outsideSection(coLocator.pClassHierarchyDescriptor + startAddr)) |
| 110 | return std::nullopt; |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | // Absolute addrs |
| 115 | if (outsideSection(coLocator.pTypeDescriptor)) |
| 116 | return std::nullopt; |
| 117 | |
| 118 | if (outsideSection(coLocator.pClassHierarchyDescriptor)) |
| 119 | return std::nullopt; |
| 120 | } |
| 121 | |
| 122 | return coLocator; |
| 123 | } |
| 124 | |
| 125 | |
| 126 | Ref<Type> GetPMDType(BinaryView *view) |
no test coverage detected