| 301 | |
| 302 | |
| 303 | uint64_t PEHeaders::GetValueOfStructMember( |
| 304 | BinaryViewRef data, const std::string& structName, uint64_t structStart, const std::string& fieldName) |
| 305 | { |
| 306 | TypeRef type = data->GetTypeByName(structName); |
| 307 | if (!type) |
| 308 | return 0; |
| 309 | if (type->GetClass() != StructureTypeClass) |
| 310 | return 0; |
| 311 | StructureRef s = type->GetStructure(); |
| 312 | for (auto& member : s->GetMembers()) |
| 313 | { |
| 314 | if (member.name == fieldName) |
| 315 | { |
| 316 | uint64_t offset = structStart + member.offset; |
| 317 | size_t width = member.type->GetWidth(); |
| 318 | if (width > 8) |
| 319 | return 0; |
| 320 | uint64_t value = 0; |
| 321 | data->Read(&value, offset, width); |
| 322 | return value; |
| 323 | } |
| 324 | } |
| 325 | return 0; |
| 326 | } |
| 327 | |
| 328 | |
| 329 | uint64_t PEHeaders::GetAddressAfterStruct(BinaryViewRef data, const std::string& structName, uint64_t structStart) |
nothing calls this directly
no test coverage detected