2

I want to automate some manifest file changes (change requestedExecutionLevel level to requireAdministator from asInvoker) so I have to use ResourceHacker CLI.

I have managed to extract the resources file using the command

ResourceHacker.exe -open rh.exe -save rh.res -action extract -mask MANIFEST, -log CONSOLE

After modifying the rh.res file and after running

ResourceHacker.exe -open "rh.exe" -save "rh2.exe" -action addoverwrite -res "rh.res" -mask MANIFEST, -log CONSOLE

I get the rh2.exe file which works perfectly fine, but doesn't have any changes as far as I can see. However, checking the MD5 I can observe that the hash is different.

1 Answer 1

1

Your commands to correct replace the manifest are correct. The likely problem is you are corrupting the .res file; note this is a compiled binary format, you cannot just modify it in a simple text editor, despite it containing the manifest contents in a text format. After exporting, if you make the text longer you will need to modify the .res file header, some basic details here https://docs.microsoft.com/en-us/windows/win32/menurc/resource-file-formats Alternately edit the .res file in Resource Hacker or Visual Studio then compare the files at a binary level to see what is being modified. Once you have a valid .res file to import your commands will work.

You can manually confirm your .res file is the problem by using Resource Hacker to manually replace your .res file, if you have corrupted it you will get a failure message.

With a corrupt .res file you will see something like this:

enter image description here

With a valid .res file you will see output like below:

enter image description here

2
  • However, there are tools to extract "decompiled" .res files (that is .rc scripts without the symbolic names given to IDs) which could be used to extract a textual form, then patch that and then reintroduce it into the binary. Don't recall, though, if ResourceHacker has this ability.
    – 0xC0000022L
    Jan 18, 2022 at 8:00
  • Yes resource hacker can do this via the gui Jan 18, 2022 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.