Jump to content

Smaller x64 exe scripts


BullGates
 Share

Recommended Posts

Ok, to illustrate the problem, pre-compress the x64 bin file, then compile an empty script. Now from a cmd prompt, run this:

<script>.exe /ErrorStdOut /AutoIt3ExecuteLine "asdf"

Yes, I know the command is bogus, but that's important. The script will crash. This doesn't happen if the compiled script is post-compressed with my script posted earlier.

Link to comment
Share on other sites

My point was that the wrapper directive and au3check are not foolproof, nothing more.

Here, here's a better example that doesn't actually crash.

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt("MustDeclareVars", 1)

_Main()

Func _Main()
    If False Then
        Local $var = "declared"
        MsgBox(0, "", $var) ; to avoid 'declared but not used' warning
    EndIf
    $var = "not declared"
EndFunc

So in a way you're correct, nothing makes up for bad programming.

Edited by wraithdu
Link to comment
Share on other sites

  • 1 month later...
  • Developers

thanks for the good info. perhaps this could be added as an option in Autoit3Wrapper?

I have no intention to add support for tools that are not part of the AutoIt3 or SciTE4AutoIt3 installers.

A simple solution would be to add a #AutoIt3Wrapper_Run_After= directive that should be able to do this.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I have no intention to add support for tools that are not part of the AutoIt3 or SciTE4AutoIt3 installers.

A simple solution would be to add a #AutoIt3Wrapper_Run_After= directive that should be able to do this.

yes the #AutoIt3Wrapper_Run_After= works quite well, the point of the suggestion though was for AutoIt3Wrapper to support compression of x64 exe; which UPX option in your GUI doesn't currently provide. obviously if you decided to add this it would make sense to ship mpress.exe along with the upx.exe that you already ship with AutoIt3Wrapper in the SciTE4AutoIt3 installer. the benefit being that the general user-base would have easy access to the feature.

in any case its only a suggestion and you are perfectly free to do/or don't do whatever you like.

Homes32

Link to comment
Share on other sites

  • 3 years later...
  • Developers

Mpress does a pretty good job creating a smaller EXE.

Added this as Directive:

#AutoIt3Wrapper_Run_After="%scitedir%\mpress\mpress.exe" -r -q %out%

Result:

<< test.exe >>
PE32/x86 843.12kB -> 340.0kB  Ratio: 40.3%

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

After compillation with

#AutoIt3Wrapper_Run_After="%scitedir%\mpress\mpress.exe" -r -q %out%
App say: Unable to Open Scryt file .

 

Need more input than this. ;)

For starters: Show the SciTE outputpane information when running Compile.

PS. Could you be having AntiVirus type issues like you mentioned in> your other post

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Oops!

Excuse me! It was with AutoIt v3.3.8.3. In AutoIt v3.310.2 :

PE32+/x64 920.12kB -> 352.0kB Ratio: 38.2%

PE32/x86 1175.12kB -> 673.0kB Ratio: 57.2%

Apps run OK.

But compression in AutoIt v3.3.8.3, not in the new AutoIt v3.310.2 is better.

#AutoIt3Wrapper_Run_After="%scitedir%upxupx.exe" --ultra-brute -qf --compress-exports=1 --compress-icons=0 --strip-relocs=1 %out%

How to compile x64 with built-in Directive? Thank's!

Edited by Jekov
Link to comment
Share on other sites

There is no v3.3.8.3. Did you mean v3.3.9.3? Which is a beta release and should be used for production code.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I compile my .au3  namely in AutoIt v3.3.8.3, because there outfile size is smaller than with  the new release or any beta:

Running:(3.3.8.1)
#AutoIt3Wrapper_Run_After="%scitedir%\upx\upx.exe" --ultra-brute -qf --compress-exports=1 --compress-icons=0 --strip-relocs=1 %out%
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2013
UPX 3.91w Markus Oberhumer, Laszlo Molnar & John Reiser Sep 30th 2013

File size Ratio Format Name
-------------------- ------ ----------- -----------
790151 -> 317063 40.13% win64/pe TrackCleanReg_x64.exe
Edited by Jekov
Link to comment
Share on other sites

  • Developers

version 3.3.8.1 is not using standard PE resources so that could lead to issues.

Version 3.3.10.x should be no problem.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 2 weeks later...

I mean , why not instead in AutoIt3Wrapper compile x64 code:

    ; Compile x64 version ORIGIN
    If $INP_Compile_Both = "y" Or $INP_UseX64 <> 'n' Then
        Compile_Run_AUT2EXE('x64', $TempOutFile)
        If $INP_AutoIt3Wrapper_Testing <> "y" Then Compile_Upd_res($TempOutFile)
        If FileCopy($TempOutFile, $ScriptFile_Out_x64, 1) Then
            Write_RC_Console_Msg("Created program:" & $ScriptFile_Out_x64, "", "+")
        Else
            Write_RC_Console_Msg("Problem copying file from: " & $TempOutFile & " To :" & $ScriptFile_Out_x64, "", "!")
        EndIf
        If $Pragma_Out = "" Then FileDelete($TempOutFile)
    EndIf

Replace with working code x64 UPX compression:

; Compile x64 version
    If $INP_Compile_Both = "y" Or $INP_UseX64 <> 'n' Then
        Compile_Run_AUT2EXE('x64', $TempOutFile)
        If $INP_AutoIt3Wrapper_Testing <> "y" Then
            ; Move the created EXE by AUT2EXE to a tempdir to be able to add the resources and UPX without conflicts
            If $Pragma_Out <> "" Then
                $TempOutFile = _TempFile($TempDir, "~AU3", "." & $ScriptFile_Out_Type)
                FileMove($Pragma_Out, $TempOutFile, 1)
            EndIf
            If Compile_Upd_res($TempOutFile) And $INP_UseUpx = "y" Then
                ; ########################################################################################
                ; Check if Pragma is used for UPX updates and supported
                ; ########################################################################################
                If $Pragma_UseUpx <> "" Then
                    If _VersionCompare($AUT2EXE_PGM_VER, "3.3.9.4") = 1 Then
                        ConsoleWrite("> #pragma Compile(UPX, true/false) found." & @CRLF)
                        ConsoleWrite("-    Ignoring all #AutoIt3Wrapper_UseUPX #directive!" & @CRLF)
                        $INP_Res_requestedExecutionLevel = ""
                        $INP_Res_Compatibility = ""
                    Else
                        ConsoleWrite("- Ignoring all #pragma Compile(UPX, true/false) because AutoIt3 version: " & $AUT2EXE_PGM_VER & " doesn't support it!" & @CRLF)
                        If $INP_UseUpx = "y" Then Compile_UPX($TempOutFile)
                    EndIf
                Else
                    If $Pragma_UseUpx <> "" Then ConsoleWrite("- Ignoring all #pragma Compile(UPX, true/false) because AutoIt3 version: " & $AUT2EXE_PGM_VER & " doesn't support it!" & @CRLF)
                    If $INP_UseUpx = "y" Then Compile_UPX($TempOutFile)
                EndIf
            EndIf
        EndIf
        If $Pragma_Out <> "" Then
            ; Move the tempfile back
            FileMove($TempOutFile, $Pragma_Out, 1)
            If FileExists($Pragma_Out) Then
                Write_RC_Console_Msg("Created program (pragma):" & $Pragma_Out, "", "+")
                $ScriptFile_Out_x64 = $Pragma_Out
            Else
                Write_RC_Console_Msg("AUT2EXE did not created program:" & $Pragma_Out, "", "!")
            EndIf
        ElseIf FileMove($TempOutFile, $ScriptFile_Out_x64, 1) Then
            Write_RC_Console_Msg("Created program:" & $ScriptFile_Out_x64, "", "+")
        Else
            Write_RC_Console_Msg("Problem copying file from: " & $TempOutFile & " To :" & $ScriptFile_Out_x64, "", "!")
        EndIf
    EndIf

It suits me.

Link to comment
Share on other sites

  • Developers

Assume your point is that UPX now also support x64 compiled script were this wasn't case before and you would like the support added?

v 3.91.0.0 does indeed have: " experimental support for Win64/PE", so I could added the support for x64 compiled scripts but this it remains experimental.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...