7

When I just declare

boost::thread t1, t2;

in my program and then compress .exe file with UPX, the compression succeeds. But when I try to launch the compressed exe, Windows tells me that it's "not valid win32 application".

There is a bug report for UPX (similar bug), but it has different error message ("The application failed to initialize properly (0xc0000005)").

In my case OS thinks the file is corrupted or something, so it cant even be started to show errors! Why??

Win7x64, C++, VisualStudio, boost 1.47, UPX3.07

strange news:

  1. Unpacking exe makes corrupted exe that throws error exactly the same as here. ("The application failed to initialize properly (0xc0000005)") And this is for unpacked exe, not packed as in bug report.

  2. extern "C" void tss_cleanup_implemented(void) {} before the inclusion of boost's thread header does not matter. The result is the same.

main.cpp:

#include <boost/thread.hpp>

int main(int argc, char** argv)
{
    boost::thread t;
    return 0;
}

May be someone will try to compile and compress?

Sergey
  • 19,487
  • 13
  • 44
  • 68
  • 1
    Well, is your build set up with boost such that it results in a 32-bit executable, or is it a 64-bit executable? (UPX on windows does not support 64-bit binaries) http://sourceforge.net/tracker/?func=detail&aid=2859708&group_id=2331&atid=352331 – HostileFork says dont trust SE Nov 24 '11 at 21:02
  • tried another packer, it just writes "tls callbacks are not supported" – Sergey Nov 24 '11 at 21:54
  • 3
    Does uncompressing result in getting you a working EXE back? As for TLS, supposedly UPX supports thread local storage since v3.06 (Sept 2010). However, if the problem in UPX is related to the handling of thread local storage, you might be able to work around it by putting `extern "C" void tss_cleanup_implemented(void) {}` before the inclusion of boost's thread header, as prescribed in this older bug report: https://svn.boost.org/trac/boost/ticket/1848 – HostileFork says dont trust SE Nov 24 '11 at 22:44
  • @HostileFork, I added some info – Sergey Nov 25 '11 at 00:40
  • are you linking the boost thread library statically or dynamically? – Ferruccio Nov 25 '11 at 12:21
  • @Ferruccio, tried both! same result! – Sergey Nov 25 '11 at 13:04
  • I tried this with Win7x64, MSVC++ 2010, Boost 1.41, UPX 3.07 and I could not reproduce it. What version of MSVC are you using? I could try with Boost 1.47 when I have the strength to download and Jam it... – Andreas Magnusson Dec 04 '11 at 23:04
  • @Andreas Magnusson, VisualStudio 2010, dont know what is wrong then – Sergey Dec 05 '11 at 11:34
  • It's probably a difference in the version of boost. If they are using some new way of supporting tss that is not handled by that version of ups. – lefticus Dec 05 '11 at 15:49

1 Answers1

1

Bug was repaired in new version 3.08. It's ok now.

Sergey
  • 19,487
  • 13
  • 44
  • 68