I'm having problems using madExcept + UPX on Delphi 2007. Whenever I open the compressed application, a Windows exception dialog appears code 0xc0000005. Anyone has the solution for this?
Thanks!
I'm having problems using madExcept + UPX on Delphi 2007. Whenever I open the compressed application, a Windows exception dialog appears code 0xc0000005. Anyone has the solution for this?
Thanks!
That exception code usually means it's an unhandled external exception. What happens if you don't Use UPX? Does the exception go away?
It may not have anything to do with MadExcept, BTW. That exception code usually indicates that the exception happened before the VCL's exception handlers can be set up, and therefore it would probably be before MadExcept gets hooked in as well.
EDIT: From your comment, it sounds like UPX's compression technique may be interfering with MadExcept/Delphi's ability to hook up the Exception handler chain. Did you check the link Bruce provided?
I've successfully used madExcept with ASProtect, so I know it can be used with exe compression. However, there may be some specific problems with UPX.
Stack tracing on exceptions etc. requires mapping in-memory code addresses to virtual addresses as stored in the executable, so that they can be correlated with either a .map file or debug info which indicates the function or source file and line. Normally, the mapping is straight-forward and relatively linear.
Executable compression mucks this up because it doesn't have a straight-forward mapping, particularly not one in line with the PE spec. This is because the executable compression replaces the initialization routine in the executable with one that extracts data from disk into memory (this also means that compressed executables don't share pages with other instances, and use more memory than uncompressed executables, since they need to page in everything all at once), before forwarding to the newly-expanded original initialization routine.
So, without quite clever relative-address storage of code locations in the stack tracing, it's unlikely that the two techniques will work together.
FWIW, I personally don't recommend using executable packers.
It was already covered in MadShi's own forums:
Forum Article #1
Forum Article #2
There's a dozen of other topics around, but to sum a long story, MadExcept 3.* and after is known to work OK with UPX, below not.