upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/pe_loader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src/pe_loader.cpp')
-rw-r--r--runtime/src/pe_loader.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp
index ca12273b2..9ac97239f 100644
--- a/runtime/src/pe_loader.cpp
+++ b/runtime/src/pe_loader.cpp
@@ -592,9 +592,12 @@ void Loader::bind_imports(Module& m) {
592 if (!d->ImportAddressTableRVA) 592 if (!d->ImportAddressTableRVA)
593 throw std::runtime_error(m.name + ": a delay-import descriptor has no address table"); 593 throw std::runtime_error(m.name + ": a delay-import descriptor has no address table");
594 std::string dll = read_string(m.name, m.base, m.size, d->DllNameRVA, "a delay-imported DLL name"); 594 std::string dll = read_string(m.name, m.base, m.size, d->DllNameRVA, "a delay-imported DLL name");
595 // The name table is optional: without it, entries are read back through the address table itself. 595 // Without a name table the IAT still holds delay thunks, not import names, so there is no symbol to bind
596 bind_thunks(dll, d->ImportNameTableRVA ? d->ImportNameTableRVA : d->ImportAddressTableRVA, 596 // eagerly. Every MSVC delay descriptor and every System32 DLL has one; reject the form instead of reading
597 d->ImportAddressTableRVA); 597 // thunk addresses as name RVAs.
598 if (!d->ImportNameTableRVA)
599 throw std::runtime_error(m.name + ": a delay-import descriptor has no name table");
600 bind_thunks(dll, d->ImportNameTableRVA, d->ImportAddressTableRVA);
598 } 601 }
599 } 602 }
600} 603}