Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

GUI for UPX packer


  • Please log in to reply
3 replies to this topic
Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
I kept suffering with the crappy (atleast the ones i happened to use) GUIs available for UPX, the best exe packer around (incidentally used used by AHK too).
About time i wrote my own. Though I'm sure not many ppl will find uses for it as its mostly a power user (geeky?) thing. Much about the same reason why my Address Bar->Cmd prompt script is not used by many : )

Posted Image

It'll remember the preferences from one use to another

Requirements:
UPX
http://upx.sourceforge.net

For easiest usage create a shortcut to this script in sendto folder (type sendto in start menu > run window)


;___________________________________________
;_______GUI for UPX_________________________

WinTitle = Rajat's UPX GUI Frontend
;___________________________________________

SetFormat, float, 0.2
SetBatchLines, 10ms

ifnotexist, %a_scriptdir%\upx.exe
{
	Msgbox, UPX.exe not found!
	Exitapp
}


input = %1%
ifnotexist, %input%, FileSelectFile, input, 1,, Select File to porcess:
ifnotexist, %input%, exitapp




Gui, Font,  S11 CMaroon Bold, Verdana
Gui, Add, Text, x7 y8 w290 h30, UPX Compressor / Decompressor
Gui, Font, , 
Gui, Add, Button, x37 y48 w90 h30, Compress
Gui, Add, Button, x157 y48 w90 h30, Decompress
Gui, Add, ComboBox, x157 y88 w80 h170 vlev, 1|2|3|4|5|6|7|8|9|-best||
Gui, Add, CheckBox, x17 y118 w130 h20 vres, Compress Resources
Gui, Add, CheckBox, x17 y148 w130 h20 vico, Compress Icons
Gui, Add, CheckBox, x17 y178 w130 h20 vexp, Compress Exports
Gui, Add, CheckBox, x157 y118 w130 h20 vfor, Force Compression
Gui, Add, CheckBox, x157 y148 w130 h20 vrel, Strip Relocations
Gui, Add, CheckBox, x157 y178 w130 h20 vbak, Make Backup
Gui, Add, Text, x7 y208 w290 h30, %input%
Gui, Add, Text, x27 y88 w100 h20, Compression Level :
Gui, Show, x258 y168 h247 w307, %WinTitle%


;getting previous preferences
IniRead, lev, %a_scriptdir%\upx.ini, UPX, Lev
IniRead, res, %a_scriptdir%\upx.ini, UPX, Res
IniRead, ico, %a_scriptdir%\upx.ini, UPX, Ico
IniRead, exp, %a_scriptdir%\upx.ini, UPX, Exp
IniRead, for, %a_scriptdir%\upx.ini, UPX, For
IniRead, rel, %a_scriptdir%\upx.ini, UPX, Rel
IniRead, bak, %a_scriptdir%\upx.ini, UPX, Bak


;loading previous preferences
Control, Choose, %lev%, ComboBox1, %Wintitle%

IfEqual, res, 1, Control, check,, Button3, %WinTitle%
IfEqual, ico, 1, Control, check,, Button4, %WinTitle%
IfEqual, exp, 1, Control, check,, Button5, %WinTitle%
IfEqual, for, 1, Control, check,, Button6, %WinTitle%
IfEqual, rel, 1, Control, check,, Button7, %WinTitle%
IfEqual, bak, 1, Control, check,, Button8, %WinTitle%


Return


GuiClose:
	ExitApp
Return



ButtonCompress:
	Gui, Submit
	Gosub, IniWrite
	SetEnv, cmdline, %cmdline% -%lev%
	
	IfEqual, res, 1, SetEnv, cmdline, %cmdline% --compress-resources=1
	IfEqual, res, 0, SetEnv, cmdline, %cmdline% --compress-resources=0
	
	IfEqual, ico, 1, SetEnv, cmdline, %cmdline% --compress-icons=1
	IfEqual, ico, 0, SetEnv, cmdline, %cmdline% --compress-icons=0

	IfEqual, exp, 1, SetEnv, cmdline, %cmdline% --compress-exports=1
	IfEqual, exp, 0, SetEnv, cmdline, %cmdline% --compress-exports=0
	
	IfEqual, for, 1, SetEnv, cmdline, %cmdline% --force
	
	IfEqual, rel, 1, SetEnv, cmdline, %cmdline% --strip-relocs=1
	IfEqual, rel, 0, SetEnv, cmdline, %cmdline% --strip-relocs=0
	
	
	IfEqual, bak, 1, FileCopy, %input%, %input%.bak
		
	FileGetSize, osize, %input%, k
	envadd, osize, 0.0

	runwait, %comspec% /c %a_scriptdir%\upx.exe %cmdline% "%input%">"%Temp%\upxlog.txt",,hide
	
	FileGetSize, nsize, %input%, k
	envadd, nsize, 0.0
	
	diff = %nsize%
	
	diff *= 100

	diff /= %osize%
	
	StringTrimRight, osize, osize, 3
	StringTrimRight, nsize, nsize, 3
	
	Msgbox, 260, %Label%, Original size`t`t%osize% Kb`nNew size`t`t`t%nsize% Kb`nChange`t`t`t%diff%`%`n`n Do you want to have detailed information?
	IfMsgbox, yes, IfExist, %Temp%\upxlog.txt, run, %Temp%\upxlog.txt
	Exitapp
Return




ButtonDeCompress:
	Gui, Submit
	Gosub, IniWrite
	FileGetSize, osize, %input%, k
	envadd, osize, 0.0

	runwait, %comspec% /c %a_scriptdir%\upx.exe -d "%input%">"%Temp%\upxlog.txt",,hide
	
	FileGetSize, nsize, %input%, k
	envadd, nsize, 0.0
	
	diff = %nsize%
	
	diff *= 100

	diff /= %osize%
	
	StringTrimRight, osize, osize, 3
	StringTrimRight, nsize, nsize, 3
	
	Msgbox, 260, %Label%, Original size`t`t%osize% Kb`nNew size`t`t`t%nsize% Kb`nChange`t`t`t%diff%`%`n`n Do you want to have detailed information?
	IfMsgbox, yes, IfExist, %Temp%\upxlog.txt, run, %Temp%\upxlog.txt
	Exitapp
Return



IniWrite:
	IniWrite, %lev%, %a_scriptdir%\upx.ini, UPX, Lev
	IniWrite, %res%, %a_scriptdir%\upx.ini, UPX, Res
	IniWrite, %ico%, %a_scriptdir%\upx.ini, UPX, Ico
	IniWrite, %exp%, %a_scriptdir%\upx.ini, UPX, Exp
	IniWrite, %for%, %a_scriptdir%\upx.ini, UPX, For
	IniWrite, %rel%, %a_scriptdir%\upx.ini, UPX, Rel
	IniWrite, %bak%, %a_scriptdir%\upx.ini, UPX, Bak
Return	

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
about time i did it... updated the script to use ahk gui.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


  • Guests
  • Last active:
  • Joined: --
Wow nice script :)

It's kinda like
http://upxshell.sourceforge.net/

BesT
  • Guests
  • Last active:
  • Joined: --

About time i wrote my own. Though I'm sure not many ppl will find uses for it as its mostly a power user (geeky?) thing. Much about the same reason why my Address Bar->Cmd prompt script is not used by many : )
[/code]

:) i just got your Adress Bar to CMD just before this one :)