Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support writing PE32/PE32+ section permissions #7058

Merged
merged 1 commit into from
Mar 19, 2017
Merged

Support writing PE32/PE32+ section permissions #7058

merged 1 commit into from
Mar 19, 2017

Conversation

yol
Copy link
Contributor

@yol yol commented Mar 18, 2017

Hi,

I'm working on adding support for writing PE32(+) section permissions (see #921).

The patch works fine so far (it's mostly adapted from the ELF code), but I've seen that sections that do not have a name get one auto-assigned. bins/pe/normal64.exe is an example of this:

[Sections]
idx=00 vaddr=0x00401000 paddr=0x00000200 sz=512 vsz=4096 perm=m--wx name=sect_0

Here sect_0 was autogenerated and is not actually in the file. This is a problem when trying to modify the section permissions, as the code checks the raw names from the binary and not the ones radare "sees". So to change the permissions one would have to invoke rabin2 like this: rabin2 -O p//x normal64.exe (i.e. with empty section name). It works, but it's not pretty and also fails when there are multiple unnamed sections. How could this be handled better? I can't use the parsed section info for looking up the name since that can't be mapped back to the right section in the binary (sections might get dropped during parsing under certain circumstances so the indices could differ).

@Maijin
Copy link
Contributor

Maijin commented Mar 18, 2017

Can you make a PR for test here https://github.com/radare/radare2-regressions/tree/master/t.tools/rabin2 ?

@yol
Copy link
Contributor Author

yol commented Mar 18, 2017

Done

@Maijin Maijin requested a review from alvarofe March 18, 2017 21:37
@radare radare merged commit a185758 into radareorg:master Mar 19, 2017
@Maijin Maijin mentioned this pull request May 28, 2017
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants