www.digitalmars.com         C & C++   DMDScript  

c++.wxwindows - [OT] using upx with dm

reply Hakki Dogusan <dogusanh tr.net> writes:
Hi,

(Sorry to post here, I can't decide which group is suitable)

I can't use upx with dmc. Log is as follows:

C:\a_C\adret\bin>\tools\upx\upx -oa.exe adret.exe
                      Ultimate Packer for eXecutables
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
UPX 1.25w        Markus F.X.J. Oberhumer & Laszlo Molnar        Jun 29th 
2004

         File size         Ratio      Format      Name
    --------------------   ------   -----------   -----------
upx: adret.exe: CantPackException: file is possibly packed/protected 
(try --forc
e)

Packed 1 file: 0 ok, 1 error.


If I use --force flag, then it compress. But compressed exe is not run 
(ie.no error, nothing) !


C:\a_C\adret\bin>\tools\upx\upx --force -oa.exe adret.exe
                      Ultimate Packer for eXecutables
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
UPX 1.25w        Markus F.X.J. Oberhumer & Laszlo Molnar        Jun 29th 
2004

         File size         Ratio      Format      Name
    --------------------   ------   -----------   -----------
    9717000 ->   2836992   29.20%    win32/pe     a.exe

Packed 1 file.



How to solve ? Is there compiler/linker flags to use ?


--
Regards,
Hakki Dogusan
May 02 2005
parent reply Jack <Jack_member pathlink.com> writes:
In article <d54kuu$14iq$1 digitaldaemon.com>, Hakki Dogusan says...
Hi,

(Sorry to post here, I can't decide which group is suitable)

I can't use upx with dmc. Log is as follows:

C:\a_C\adret\bin>\tools\upx\upx -oa.exe adret.exe
                      Ultimate Packer for eXecutables
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
UPX 1.25w        Markus F.X.J. Oberhumer & Laszlo Molnar        Jun 29th 
2004

         File size         Ratio      Format      Name
    --------------------   ------   -----------   -----------
upx: adret.exe: CantPackException: file is possibly packed/protected 
(try --forc
e)

Packed 1 file: 0 ok, 1 error.


If I use --force flag, then it compress. But compressed exe is not run 
(ie.no error, nothing) !


C:\a_C\adret\bin>\tools\upx\upx --force -oa.exe adret.exe
                      Ultimate Packer for eXecutables
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
UPX 1.25w        Markus F.X.J. Oberhumer & Laszlo Molnar        Jun 29th 
2004

         File size         Ratio      Format      Name
    --------------------   ------   -----------   -----------
    9717000 ->   2836992   29.20%    win32/pe     a.exe

Packed 1 file.



How to solve ? Is there compiler/linker flags to use ?


--
Regards,
Hakki Dogusan
Well, I think it's because the code of the excutable produced by Digital Mars linker isn't placed on the first section in the PE header as most (if not all) other compilers place their code in the first section of the PE file (Digital Mars linker places them in the second section and uses some weird name...). It would be nice if Digital Mars linker will place the code and their names in the PE header like the others) _TEXT -> .text CRT$XIA -> ???
May 02 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Jack" <Jack_member pathlink.com> wrote in message
news:d54svd$1bm8$1 digitaldaemon.com...
 Well, I think it's because the code of the excutable produced by Digital
Mars
 linker isn't placed on the first section in the PE header as most (if not
all)
 other compilers place their code in the first section of the PE file
(Digital
 Mars linker places them in the second section and uses some weird
name...). It
 would be nice if Digital Mars linker will place the code and their names
in the
 PE header like the others)

 _TEXT -> .text
 CRT$XIA -> ???
If that's the case for why upx fails, then upx is broken. It's easy to find the code segment in a windows PE file. Each section is flagged for various characteristics, and one of those flags is set for "code". If DMC executables were invalid, they wouldn't work on every version of Windows, including win32s. They also work fine with Microsoft debuggers, which have no problems finding the code segment. Digital Mars has an exe file dumper, www.digitalmars.com/ctg/dumpexe.html I think you should forward the bug report to the upx developers.
May 02 2005
parent reply Sergio Reyes-Peniche <sreyesp gmail.com> writes:
You could try out the latest upx beta. Version 1.25 doesn't do the 
trick, but I think latest ones do (although the developers warn about 
its beta status and about distributing exe's compressed with this version).

Sergio.
May 04 2005
parent Hakki Dogusan <dogusanh tr.net> writes:
Hi,

Sergio Reyes-Peniche wrote:

 You could try out the latest upx beta. Version 1.25 doesn't do the 
 trick, but I think latest ones do (although the developers warn about 
 its beta status and about distributing exe's compressed with this version).
 
 Sergio.
Indeed, upx version 1.93 with --force flag works. But the warn is big enough to not use it. Thanks. -- Regards, Hakki Dogusan
May 12 2005