From bf5d9d33de0c25da9f83896d9e03841e22aeb75a Mon Sep 17 00:00:00 2001 From: DaLynX Date: Tue, 12 Mar 2019 14:43:50 +0100 Subject: [PATCH] [PE] Delete existing resource table when building a new one --- src/PE/Builder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PE/Builder.cpp b/src/PE/Builder.cpp index eeb9b906ee..2e758d248e 100644 --- a/src/PE/Builder.cpp +++ b/src/PE/Builder.cpp @@ -256,6 +256,9 @@ void Builder::build_resources(void) { new_section_rsrc.characteristics(0x40000040); new_section_rsrc.content(content); + if (this->binary_->has_resources()) { + this->binary_->remove(this->binary_->data_directory(DATA_DIRECTORY::RESOURCE_TABLE).section(), true); + } Section& rsrc_section = this->binary_->add_section(new_section_rsrc, PE_SECTION_TYPES::RESOURCE); this->construct_resources(node, &content, &offsetToHeader, &offsetToData, &offsetToName, rsrc_section.virtual_address(), 0);