Convert namePointer from RVA to raw data pointer

This previously worked by chance with the PE32 executables we saw, but
it didn't work with the PE32+ executables we saw.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 1 year ago
parent 6b18461297
commit 6fe155540a
  1. 3
      archive/src/main/kotlin/org/openrs2/archive/client/ClientImporter.kt

@ -360,7 +360,8 @@ public class ClientImporter @Inject constructor(
pe.sectionTable.rvaConverter.convertVirtualAddressToRawDataPointer(exportTable.namePointerRVA.toInt()) pe.sectionTable.rvaConverter.convertVirtualAddressToRawDataPointer(exportTable.namePointerRVA.toInt())
for (i in 0 until exportTable.numberOfNamePointers.toInt()) { for (i in 0 until exportTable.numberOfNamePointers.toInt()) {
val namePointer = buf.readerIndex() + buf.getIntLE(buf.readerIndex() + namePointerTable + 4 * i) val namePointerRva = buf.readerIndex() + buf.getIntLE(buf.readerIndex() + namePointerTable + 4 * i)
val namePointer = pe.sectionTable.rvaConverter.convertVirtualAddressToRawDataPointer(namePointerRva)
val end = buf.forEachByte(namePointer, buf.writerIndex() - namePointer, ByteProcessor.FIND_NUL) val end = buf.forEachByte(namePointer, buf.writerIndex() - namePointer, ByteProcessor.FIND_NUL)
require(end != -1) { require(end != -1) {

Loading…
Cancel
Save