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
Modify resource of wixtoolset Setup.exe destroys executable #19
Comments
It should be able to work with other types as well, it would be good if you posted a minimum amount of code to reproduce the problem here or elsewhere. |
I have now seen, that the attached CAB file at the end of the executable is the problem. |
Probably. It would be helpful if you wrote a unit test within this library that reproduce the problem, to begin with - make a very small executable that exhibits this issue. It's likely the CAB is appended without any record within the executable, however, so it may need some work. |
Hello, Thanks, Am 09.06.2014 11:53, schrieb Daniel Doubrovkine (dB.) @dblockdotorg:
|
Attachments don't work via Github. |
Hello, Am 09.06.2014 12:27, schrieb Daniel Doubrovkine (dB.) @dblockdotorg:
|
I am having this same exact issue using this library on an .exe that I created with the 7-zip 7zsd.sfx module. The file size goes from 900kb to 111kb and the .exe is corrupt and will not run. Here is my code:
|
I solved the issue for myself by changing the resources on 7zsd.sfx BEFORE combining it with my archive, not on the resulting .exe file. I don't think this is a bug in this library. I used the tool by Denis Zabavchik on CodeProject (http://www.codeproject.com/Articles/13355/Modification-of-Version-Information-Resources-in-C) and got the same result. |
As described by nadcracker the same process applies for Wix executables. |
Is there a chance this issue will be fixed? Currently there is no way to change resources (for example icon) on resulting self-extracting archive with this library. ResourceHacker does it with no problems. |
Please contribute. |
I can contribute with testing the fix if it be done. |
@Fergusson Can you please describe your solution a little bit further? My bootstrapper is about 800 MB. If I extract the engine of my bundle by using Insignia, I get a 70 MB file. When I modify the version resource of the extracted engine, my file still shrinks to about 800 Kb. |
Basically it's possible but it's a lot of work. |
As @Fergusson wrote above it's not an issue of ResourceLib. If some can provide a repro, we might re-open this issue. |
I do think it's a bug, not that I know how to fix it, in theory resourcelib should never "destroy" anything, no? |
@dblock it might be a bug of resourcelib, but @nadcraker mentioned the same issue occurs even when using another library. A repro is required to investigate the origin of the "destruction". |
Resource Hacker is able to do it on my wix bundle. |
@rolix7 can you provide us with a small (i.e. ≪ 800 MB) binary for reproduction? |
Yes, for sure. Where can I upload it? |
Please make a pull request with ideally a failing test, or just the binary in your fork. |
I'm pretty new to github, so I hope I did nothing wrong. |
Thanks @rolix7 , I could reproduce your issue with your pull request. However, it looks to me as its not resourcelib's fault. Before and after patching I was able to tread the resources with Resource Hacker, and everything looks ok. Maybe WiX creates non-standard PE files, which get corrupt when using Windows' API to modify resources. Nevertheless I'll continue to look for the origin of the issue. |
the threadstarter haven't said that he has problems with resources - i assume there are some PE sections that get lost after saving resource and reassembling PE Header. |
Here's the source code of WiX which is responsible for writing/reading the PE Header. Perhaps it's useful for some of you experts. |
@rolix7 Thanks for the pointer to WiX's source code. TL;DR: to me it looks like WiX is doing it wrong According to the output of
In a hex viewer you can see that after the last section, the file continues for another 104205 bytes, starting with 0x4D 0x53 0x43 0x46 ( I patched the By the way, the
which means
Intermediate result
So after editing the resources, the exact payload WiX is referring to is eliminated. Therefore my conclusion is that WiX
As far as I understand the specification, this procedure is not compliant with the PE format. That might be the reason why Feel free to report this to the WiX team. Maybe I'm wrong. Anyway, I have also posted my analysis on my blog. |
@thoemmi Thanks for your great research! It really seems like it's a problem of WiX rather than resourcelib. Nevertheless it would be interesting, how ResourceHacker is doing that job correctly. |
I can only guess that Resource Hacker doesn't use the Win32 API for handling resources but manipulates the binary directly. Can your PR #60 be closed? |
Yes, should I do it? As I said, i'm pretty new to github and I don't know the conventions yet. |
Hello,
I tried to modify the version resource of a Setup.exe created by the wixtoolset burn engine. (http://wixtoolset.org/). This execuable has a cab file included.
After the resource modification operation the Setup.exe is very much smaller than the original one and it's impossible to execute it. Additionally the included cab file is destroyed.
Is RescoureLib only working with DLL files?
Ulrich
The text was updated successfully, but these errors were encountered: