SiMoNsAyS Posted January 3, 2005 Posted January 3, 2005 (edited) This is a consecuence of the thread "Hacking WinRAR SFX for customized installers".Well you are a fanatic of "hex editing" or "resource hacking" so you'll find interesting the idea of a Send To> shortcut for UPX compression. You just need to download UPX for Windows and place UPX.EXE on System32. Then place the next 2 batch files on "%USERPROFILE%\SendTo".For MakeUPX.cmd@ECHO OFF@ECHO.SET EXT=%~x1SET LCEXT=%EXT:~-1%SET FSIZE=%~z1IF %FSIZE%==0 GOTO END:COMPRESS%WINDIR%\SYSTEM32\UPX.EXE -k --best --crp-ms=999999 --force %1:ENDFor ExpandUPX.cmd@ECHO OFF@ECHO.SET EXT=%~x1SET LCEXT=%EXT:~-1%SET FSIZE=%~z1IF %FSIZE%==0 GOTO END:DECOMPRESS%WINDIR%\SYSTEM32\UPX.EXE -k -d --force %1:ENDOptions:-k: switch will keep a backup of your original file like "file.xyz > file.xy~"--force: will force de comp./decomp. of your original file:END: down this line you can place a PAUSE line to see the result, errors and ratio.Unattended:You can place the files unattended by locating UPX.EXE on "$OEM$\$$" and "$Docs\YourUsername" but this last is known to have some problems so let me recommend to create a RAR-SFX archive or a self-destructing batch file to copy both cmds.Hope that it is clear enough . If you are interested on a direct rightclick menu entrie contact me, it will be easy.Credits:Well I personally don't like to have any credit on those things, first because I only had the idea and based it on a @jdoe's similar code ("Send To>MakeCAB") and @totoymola's thread Edited January 3, 2005 by SiMoNsAyS
MCT Posted January 3, 2005 Posted January 3, 2005 i never thought of this, nice idea EDIT:u dont really need%WINDIR%\SYSTEM32\ do u? cuz it looks there anyways for the file
SiMoNsAyS Posted January 3, 2005 Author Posted January 3, 2005 (edited) @MCT true, you don't need it. it's just to prevent a "possible issue" and because the original code had it .edit: this opens a new world in the unattended installations as RAR-SFX and 7ZIP-SFX did... i've reduced my firefox.exe file from 6mb to 2mb , once compressed on a rar it only saves a few kb but is a nice way to start... Edited January 3, 2005 by SiMoNsAyS
totoymola Posted January 3, 2005 Posted January 3, 2005 Nice! Really fast! However, I don't know the purpose of this switch.--crp-ms=999999
MCT Posted January 3, 2005 Posted January 3, 2005 i dunno if its me, but i cant get it 2 work i didnt alter any of the coding
SiMoNsAyS Posted January 3, 2005 Author Posted January 3, 2005 However, I don't know the purpose of this switch.--crp-ms=999999me neither i just found it googl'ing here. i used the same command line as the script did for a win32 app and supposed it will work better edit: @MCT try to add a PAUSE at the end of the script to see what happens
totoymola Posted January 3, 2005 Posted January 3, 2005 Simon, I'm not good on these things, but this is another way that I figured out.I placed UPX is in the my system32 folder, and I just added this shortcut to my %userprofile%\sendto The "Close on exit" must be checked.I think it does the same thing. Any ideas? SendTo_UPX_Shortcut.zip
Martin Zugec Posted January 3, 2005 Posted January 3, 2005 IMHO crp-ms means usage of memory - better compression, but need more physical memory...
totoymola Posted January 3, 2005 Posted January 3, 2005 IMHO crp-ms means usage of memory - better compression, but need more physical memory...Makes sense. So what are the other options on using it?
Martin Zugec Posted January 3, 2005 Posted January 3, 2005 Well, if I remembed right, there was no profit from using lesser value than 999999... Even with this value the amount of requested ram is really small...
totoymola Posted January 3, 2005 Posted January 3, 2005 I tried using the -k --best switch on the shortcut, but it ignores the -k. I don't know why. But anyway, the --best works.
prathapml Posted January 3, 2005 Posted January 3, 2005 this opens a new world in the unattended installations as RAR-SFX and 7ZIP-SFX did... i've reduced my firefox.exe file from 6mb to 2mb , once compressed on a rar it only saves a few kb but is a nice way to start...Nice, but keep this in mind:1. A UPX'ed file will run slower.2. If you will anyway RAR/7zip some file, then don't UPX it (because that will lead to recursive compression, thereby increasing total file size).For example, if RARing a file of 6 MB makes it deflate to 3.5 MB, UPXing that file and then RARing it will result in 4 MB (i.e., not as small as it could have been if directly RAR'ed).
bucketbuster Posted January 3, 2005 Posted January 3, 2005 This method worked great on firefox.exe.But when using it on thunderbird.exe, the exe-icon got removed; thunderbird still worked.The exe-icon became the same as regxpcom.exe and xpicleanup.exe.
SiMoNsAyS Posted January 3, 2005 Author Posted January 3, 2005 @MCT , strange those switches works perfect for me@totoymola, maybe it ignores the -k switch because you used the shortcut and not the .cmd file @prathapml:1) slower... maybe, but i preffer to open a program 1 sec later and save 4mb. the term slower does not make justice on nowdays computer 2) the mainly use of that information is the ability to reduce an .exe non-rared setup.i won't use it to reduce all of my installed programs, i want to reduce setups and it will be very helpful.about the compression ratio, well firefox.exe got down from ~6mb to ~2mb and the original xpi (firefox inside) was ~4mb and after UPX ~3,9mb so size got decresed but not too much.@bucketbuster, yeah i observed it on some .exe files. icon got compressed to and "disappeared", that's why i recommend to use UPX'ing with installers and not main programs
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now