Skip to content

How to remove resource section #6

Description

@GoogleCodeExporter
Hello!
I trying to replace resource (remove and create new one with same name).
I following your example 
(https://code.google.com/p/portable-executable-library/source/browse/trunk/sampl
es/resource_editor/main.cpp)

So, i do rename of section

image.section_from_directory(pe_win::image_directory_entry_resource).set_name("o
ldres");

Then create new section 

section new_resources;
new_resources.get_raw_data().resize(1); 
new_resources.set_name(".rsrc"); 
new_resources.readable(true); 
section& attached_section = image.add_section(new_resources);

But after this my PE file become almost 2x times bigger size.

I think this is happening because my resulting PE file have two sections which 
are almost the same except one resource i working with.

So, the question is: How can i completely remove old resource "oldres", so i 
have no duplicate data inside my resulting PE.

Fix me if i'm wrong.

Thanks, Dmitry.


Original issue reported on code.google.com by sdv.br...@gmail.com on 11 Sep 2014 at 1:59

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions