Help - Search - Member List - Calendar
Full Version: Compressing EXE/DLL Files
PPCSG > Power Up Your Devices > Tips & Tricks
vicott
Allow me to introduce Ultimate Packer for eXecutables (UPX).

QUOTE
UPX is a versatile executable packer with the following features:
  • Excellent compression ratio: typically compresses better than WinZip/zip/gzip, use UPX to decrease the size of your distribution !
  • Very fast decompression: ~10 MB/sec on an ancient Pentium 133, ~200 MB/sec on an Athlon XP 2000+.
  • No memory overhead for your compressed executables because of in-place decompression.
  • Safe: you can list, test and unpack your executables. Also, a checksum of both the compressed and uncompressed file is maintained internally.
  • Universal: UPX can pack a number of executable formats.
  • Portable: UPX is written in portable endian-neutral C++
  • Extendable: because of the class layout it's very easy to add new executable formats or new compression algorithms
  • Free: UPX is distributed with full source code under the GNU General Public License, and may be used freely even with commercial programs.


Basically, UPX is a command-line utility for compressing EXE/DLL (as well as some other specific formats). The compressed files are not like ZIP/RAR archives. When you run the compressed EXE files, there will be decompression taking place before the program is launched. However, this decompression process is so fast that you may not notice the difference. Sometimes, the program may even launch faster than in the original state.

Recently, one of the developers ported the command line utility over to Windows CE. However, there isn't a user interface for it. So, I also wrote a simple freeware called UPX4PPC to provide the frontend UI for the command line utility.

P.S: Windows Desktop and Windows Mobile Smartphone versions are also available. Refer to end of the post for all the links.

user posted image

Here are some notes for using UPX4PPC.

1) Please make sure you have LOADS of Program Memory free as UPX uses quite alot of resources. It's worst if the apps you wish to compress are large, as the memory requirements go up significantly depending on the size of the files you wish to compress are large. On my Pocket PC, a total of almost 30MB of RAM free wasn't enough to compress a 6MB EXE file.

2) If you are compressing large files, it is very highly recommended to use the fastest compression ratio. For example, it took me 17.5 seconds to compress a 4.2MB file to 2.8MB using fastest compression. But it took me 187 seconds to compress the same file (down to 2.7MB) using maximum (slowest) compression. For files that are below 1MB, the compression time is less than a minute. I seem to notice that the time taken is not linearly proportional to the filesize, but somewhat like exponential relationship.

3) It is not advisable to compress files that contain multiple icons associated with file extensions. For example, one of the EXE files for Resco Explorer has icons associated with ZIP files. Such icons may be lost after compression. You can use an icon viewer, such as RViewer, to do a quick check on the EXE/DLL file.

4) Not all files can be compressed. This is true especially for apps written using .Net. Advice is to test one by one.

5) Not all programs will work properly after compression. Only a small fraction of programs fall into this category though. The same advice goes: test one by one and make backups. Alternatively, you can uncompress the files using UPX to get back to original state.

6) There are some files which have already been compressed using UPX before. This is not common though, since many developers don't seem to be aware of UPX.

7) Generally, it's not advisable to use the WinCE version of UPX for compressing large files. If you want to deal with large files, try the desktop version instead. This is due to the huge amount of resources required and also the lengthy process which may mislead you into thinking the device has hanged.

If you are serious about freeing up storage space on your main memory of Storage Card, you can give UPX (either desktop version of WinCE version) a try. Do remember to backup and/or test slowly though.

Disclaimer: Please do not hold me responsible if anything goes wrong while using UPX.

Related Notes:
Compress your SmartPhone EXE with UPX 2.0
Compressing EXE files
Compress EXE files on PPC
Overview of UPX
Notes for using UPX

Related Software:
Ultimate Packer for eXecutables (UPX)
UPXgui (UI for Windows PC)
GUI4UPX (UI for Windows PC)
RViewer
UPX for ARM

My UPX-related software:
UPX4PC
UPX4PPC
UPX4SP
thescum
Thanks again vicott,

upx4ppc is much better and more convenient than upx (am still using the cmd prompt style as based on your earlier heads up).

Really appreciate all the effort.
vicott
But the disadvantage of the PPC version is that it does not work well when the total filesize of the session is too big. I think it's better to keep within 3MB of files for each session. Otherwise, it will take too long or there might not be enough RAM to perform the compression. The desktop version is still the best. Anyway, there are already at least 2 GUI programs written for Windows PC to make it more convenient than using command-line. Unfortunately, both are buggy. Actually, I also did a raw UI for Windows PC, but I had no motivation to enhance it and release it as users are really very fussy. brooding.gif
thescum
between the GUI and te cmd line upx, if i may OT, the cmd line upx is still the best, and pretty hassle free.

Tried your app, and its pretty good, but much slower than the cmd line upx. In any case its a good tool to have, as i hardly use AS to install, and may be hardpressed to find upx on remote desktops.
aldeba
Wow, i was just thinking of this earlier in the morning. Thanxs for the great ui. Will try it out!
vicott
If you are thinking of compressing PPC executetables on your Windows PC, you can check out GUI4UPX or D’Express.

GUI4UPX offers many options and the bug found in the previous version has been fixed in the recent update.

D'Express, on the other hand, does not offer many features but it very simple and easy to use.
jeffwong
Greating compressing too..
vicott
BTW, Smartphone users can also try to compress EXE/DLL files on your devices. You will need to use the desktop version of UPX (or together with one of the GUI tools) to compress the files on the PC and then manually transfer to the Smartphone.

Actually, there is alot of executable formats that UPX can handle. It can handle PPC/Smartphone/PC executables and more. Check out the UPX website to find out what you can compress.
jeffwong
QUOTE(vicott @ Aug 28 2006, 03:31 PM)
BTW, Smartphone users can also try to compress EXE/DLL files on your devices. You will need to use the desktop version of UPX (or together with one of the GUI tools) to compress the files on the PC and then manually transfer to the Smartphone.

Actually, there is alot of executable formats that UPX can handle. It can handle PPC/Smartphone/PC executables and more. Check out the UPX website to find out what you can compress.
*



Just a check... so does it mean it will take up more memory to load if i does that in my smart phone
vicott
QUOTE(jeffwong @ Aug 28 2006, 04:43 PM)
Just a check... so does it mean it will take up more memory to load if i does that in my smart phone
*


As mentioned on UPX website, there is no memory overload. The auto decompression is also so fast that you won't even notice a lag. In fact, programs may even launch faster than before because the processor needs to process less bytes because of the smaller file size.
forests_gump
vicott, any idea if any UPX GUI or yours can:

. auto pick up all dll,exe from a specified directory and all subdir under it for compression?

Currently UPX GUI i know need to individually pick and submit for compression.

Very tedious leh
jeffwong
Oh... thanks
vicott
QUOTE(forests_gump @ Aug 28 2006, 09:06 PM)
vicott, any idea if any UPX GUI or yours can:

. auto pick up all dll,exe from a specified directory and all subdir under it for compression?

Currently UPX GUI i know need to individually pick and submit for compression.

Very tedious leh
*


I think the GUI for desktop version should be able to allow you to use "shift" or "ctrl" to select multiple files. It's faster that way. Actually, it's not really advisable to select too many files using the PPC version as the compression speed can be very horrible, especially if you choose maximum compression. So, I don't think I want to modify it to allow automatic adding of files under selected folder.
forests_gump
what i would like to do is create an rar, contain all the dll and exe, retaining the installed directory structure. Then an GUI could just pick off the directory and subdirectory automatically.

currently desktop version, all need to select.

I understand ppc has lower processing power.
Just a though, does it make sense to change ppc program auto pick up 1 dll/exe file at a time and perform compression, then move off to next file in same directory?

This way, performance and numerous file compression can be archive on ppc.
vicott
QUOTE(forests_gump @ Aug 29 2006, 08:36 AM)
I understand ppc has lower processing power.
Just a though, does it make sense to change ppc program auto pick up 1 dll/exe file at a time and perform compression, then move off to next file in same directory?
*


It's not really a good idea to auto pick, because there are a few instances which UPX will not be able to compress the file:
1) The executable is written in .Net.
2) The program has been compressed by UPX before.
3) The program cannot be compressed due to other reasons.
4) The program will not run properly if certain files are compressed.
5) Embedded icons may be lost after compression.

That's why I highly recommend that users test out manually to see which programs still work properly after compression. It's quite a nightmare if you have compressed too many files before testing out and end up not knowing which files should not be compressed.
jeffwong
Will that help if i compress those file that is required in the startup of the PPC. Will the startup time of the PPC be faster? Or it depend on the memory.
vicott
QUOTE(jeffwong @ Aug 29 2006, 10:34 AM)
Will that help if i compress those file that is required in the startup of the PPC. Will the startup time of the PPC be faster? Or it depend on the memory.
*


Actually, the difference is not noticeable at all. For startup timing, it really depends on device performance and also the apps that run on startup. Some apps are known to slow down the startup timing considerably.
thescum
happened to be surfing Vicott's site, and there's a new version.

http://www.mobile-sg.com/ppc/apps/?p=UPX4PPC

thanks for the continuing improvements to the interface.

Would like to make a request, would it be possible for you to mask out read-only or protected ROM files from showing in the selection dialog boxes. This will make it easier for us to search and pick out the exes/dlls to compress.
vicott
QUOTE(thescum @ Sep 6 2006, 12:53 PM)
Would like to make a request, would it be possible for you to mask out read-only or protected ROM files from showing in the selection dialog boxes. This will make it easier for us to search and pick out the exes/dlls to compress.
*


Unfortunately, I think the file selection dialog is out of my control. I'm using gsGetFile SDK and I can't find any flag which hides read-only files in the file open dialog.
vicott
For those who use command line UPX without GUI, here are more options for compression:

--compress-icons=0 Don't compress any icons.
--compress-resources=0 Don't compress any resources at all.

I tried both options and the icons no longer go missing. Of course, the filesize is bigger than if you compress the icons/resources, but this is very useful if you compress files which contain file extension icons. grin.gif

I think I will add the first parameter as the default for the next version of UPX4PPC.
vicott
UPX4PPC version 0.3.1 has been released 2 days ago. In this new version, icons found in the files are never compressed. So, you won't get missing icons after compressing EXE/DLL files. You can now safely compress files which contain file extension icons with no worries.

On another note, I've also developed the desktop version, which is also a GUI program to work with UPX. It can be used to compress EXE/DLL files (files meant for Windows PC and also Windows Mobile).

Since there isn't a GUI program of UPX for Smartphones, you can also transfer your EXE/DLL files from Smartphone to PC and compress using UPX4PC before transferring the files back to the device.

The advantages of using desktop version as compared to Pocket PC version are:
1) Much faster due to more powerful processor.
2) File dialog allows multiple file selection. You can add many files at one go.
3) Progress is reported in the textbox.
4) No need to be so bothered with limited memory resources.
5) Desktop is easier to control. Obviously larger screen.

user posted image
UPX4PC
kekinlim
Hi..

Thanks the software, vicott... I haven tried it yet but can i check with you something...

1) I am using Dopod 838Pro so i just install the desktop version and after connected through activesync, i just select the exe/DLL files in my phone and convert them. (Like what you advise, is to 1 by 1 right? in case some program might not run properly after compression)

2) Any other important things to look out for?

Thanks again for this software..

Regards,
Kekin
vicott
QUOTE(kekinlim @ Oct 26 2006, 04:08 PM)
Hi..

Thanks the software, vicott... I haven tried it yet but can i check with you something...

1) I am using Dopod 838Pro so i just install the desktop version and after connected through activesync, i just select the exe/DLL files in my phone and convert them. (Like what you advise, is to 1 by 1 right? in case some program might not run properly after compression)

2) Any other important things to look out for?

Thanks again for this software..
*


If you are going to compress files from the PC, you have to transfer the EXE/DLL files from the PPC to the PC first, then convert, and overwrite. It's more troublesome, but it's more stable and faster to do it on the PC.

As for points to note, you can actually read up some of my past blog entries. The links to the related blog entries are on the product page(s).
kekinlim
thanks vicott... will read up more before i try
vicott
To the Smartphone users, UPX4SP has just been released!

user posted image

Compatible with WM2003. Not tested with WM5 and QVGA screens though, but I would expect no problems. So, I would appreciate WM5 Smartphone users to give it a try and let me know if there are any issues. If possible, I would love to see some screenshots of the application running on a WM5 Smartphone with QVGA screen.
vicott
Thanks to all the support, UPX4PPC has been nominated under "Misc Utilities" for Best Software Awards 2007 organised by Smartphone & Pocket PC Magazine!

Btw, Simplified Chinese version of UPX4SP is now available and has been tested with WM5 as well as WM6 emulators, and also all screen types.
Cheshire
Cool, the ability to leave the icons uncompressed really did it for me. I did not use UPX because of missing icons on my PPC, which is now no longer a problem! w00t.gif
thescum
Congrats Vicott for the recognition of your efforts.

This app has helped me countless times before, but none so apparent than with my previous ROM (shipment ROM) on the Touch, where there's precious little ROM space to begin with.

Here's my vote for this app to win.
vicott
UPX4PPC Version 0.4.2 has just been released. Latest version of UPX and gsGetFile have been included. The most important change is that UPX4PPC supports all types of screen resolutions/orientations now, including Native VGA, True VGA and W-VGA.
vicott
UPX4PPC has been confirmed as a finalist in the "Misc Utilities" category for Best Software Awards 2007. One step closer... grin.gif

The other 2 finalists in the same category are AdapTex and TapText.
vicott
UPX4SP has just been updated to v0.1.2. It supports all screen resolutions/orientations as well as screen rotation on-the-fly (i.e. supports Dopod C500 better now).
vicott
UPX has been updated to version 3.02, but I do not intend to release an update for UPX4PC, UPX4PPC or UPX4SP so soon. If you wish to update the UPX core engine without having to wait for me to release an update of the above mentioned software, please refer to this blog entry for info.
wid4008
I came across UPX program by chance when I install Pocket Secure because they have a UPX version. This UPX program really helps save a great deal of space!

I managed to save over 6MB on my 6828! :)
The programs I UPXed and still work flawlessly are
- Resco Audio Recorder
- eWallet
- Multipad
- Repligo
- Resco Picture Viewer Pro
- Sprite Backup
- Agendus Pro
vicott
just a note, it is advisable to use compression option excluding icons for applications which contain file extension icons like Resco Photo Viewer. Otherwise, all the file extension icons will be lost.
wid4008
QUOTE(vicott @ Dec 31 2007, 04:06 PM)
just a note, it is advisable to use compression option excluding icons for applications which contain file extension icons like Resco Photo Viewer. Otherwise, all the file extension icons will be lost.
*



Just check my resco viewer and found out that all the icons disappeared just like vicott has said. Will change the compression options now. Thanks. :)
nicepal
hmmm... sounds cooll... huh.... a better solution then to modifying the ROM. howeve it does sound a bit :chim to me though.... ;>
nicepal
vicott, u think i cn use this on my d810???
vicott
QUOTE(nicepal @ Dec 31 2007, 11:45 PM)
vicott, u think i cn use this on my d810???
*


It works for all Windows Mobile devices running on WM2003 and above. Only verified exception so far is Sevo P809.
nicepal
so those zip file is for safe keeping?
notice save 1mb by compressing. also notice that if next time I want to compress again. got to add those files manually again. as I after compress, the list goes blank...
vicott
QUOTE(nicepal @ Jan 1 2008, 12:49 AM)
so those zip file is for safe keeping?
notice save 1mb by compressing. also notice that if next time I want to compress again. got to add those files manually again. as I after compress, the list goes blank...
*


ZIP file is for backup purposes. If you read the earlier posts and/or links, you will notice that not all EXEs can be compressed successfully. Some just cannot be compressed, while some may fail to run after compressing. That's where the backups will come in handy.

Of course you have to manually add in files that you wish to compress. It would be inefficient and highly not feasible/practical for the application to detect what files to add in automatically. You wouldn't want the application to take few minutes just to scan the whole device and add in files automatically, don't you? Doing it manually is so much much faster than that.
nicepal
yep. ia do agree.. the more i surf ppcsg. the more i love my pda ph... thks guys..
vicott
I'm very glad to announce that UPX4PPC is a winner in "Misc. Utilities" category for Best Software Awards 2008, organised by Smartphone & Pocket PC magazine. Thanbk you all for the support all along! grin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.