0

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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