fix: Magic information querying being wrong with non-zero base address
This commit is contained in:
parent
b57eaca365
commit
752a2d2e8d
@ -115,7 +115,7 @@ namespace hex::magic {
|
|||||||
|
|
||||||
std::string getDescription(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
std::string getDescription(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
||||||
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
||||||
provider->read(provider->getBaseAddress() + address, buffer.data(), buffer.size());
|
provider->read(address, buffer.data(), buffer.size());
|
||||||
|
|
||||||
return getDescription(buffer, firstEntryOnly);
|
return getDescription(buffer, firstEntryOnly);
|
||||||
}
|
}
|
||||||
@ -140,14 +140,14 @@ namespace hex::magic {
|
|||||||
|
|
||||||
std::string getMIMEType(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
std::string getMIMEType(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
||||||
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
||||||
provider->read(provider->getBaseAddress() + address, buffer.data(), buffer.size());
|
provider->read(address, buffer.data(), buffer.size());
|
||||||
|
|
||||||
return getMIMEType(buffer, firstEntryOnly);
|
return getMIMEType(buffer, firstEntryOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getExtensions(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
std::string getExtensions(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
||||||
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
||||||
provider->read(provider->getBaseAddress() + address, buffer.data(), buffer.size());
|
provider->read(address, buffer.data(), buffer.size());
|
||||||
|
|
||||||
return getExtensions(buffer, firstEntryOnly);
|
return getExtensions(buffer, firstEntryOnly);
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ namespace hex::magic {
|
|||||||
|
|
||||||
std::string getAppleCreatorType(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
std::string getAppleCreatorType(prv::Provider *provider, u64 address, size_t size, bool firstEntryOnly) {
|
||||||
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
std::vector<u8> buffer(std::min<u64>(provider->getSize(), size), 0x00);
|
||||||
provider->read(provider->getBaseAddress() + address, buffer.data(), buffer.size());
|
provider->read(address, buffer.data(), buffer.size());
|
||||||
|
|
||||||
return getAppleCreatorType(buffer, firstEntryOnly);
|
return getAppleCreatorType(buffer, firstEntryOnly);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user