Jump to content

Include files and program overhead


rdwray
 Share

Recommended Posts

Compiled programs are extremely large (268kb for a single messagebox) without the overhead produced by #Include files (causing longer load times). Is there a way to load a single constant (Windows having over 52,000) from a file or must this be done manually? Thanks...

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Link to comment
Share on other sites

In SciTE if you choose Tools->Compile, or press Ctrl+F7 you get a window with a number of extra options to build your script with.

On the Obfuscator tab you will find the options for Obfuscator, which will make some modifications to your script before it is build.

These options include removing unused variables and/or functions, making the script very hard to read and more.

Link to comment
Share on other sites

Spammer - ran into a problem in that the program will not run, shows window but not progress bar. Here it is:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Test2.exe
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/so
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.3.6.1
    Author:         myName
    
    Script Function:
    Template AutoIt script.
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo, $hStatusBar, $progress, $percent = 0, $direction = 1

_Example_CallBack()

Func _Example_CallBack()
    Local $hGUI, $iTimerProgress, $btn_change, $iWait = 10, $btn_state
    Local $aParts[3] = [75, 330, -1]

    $hGUI = GUICreate("Timers Using CallBack Function(s)", 400, 320)
    $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    $btn_state = GUICtrlCreateButton("Start Progress Bar", 70, 270, 100, 25)
    $btn_change = GUICtrlCreateButton("Change", 215, 270, 90, 25)
    GUICtrlSetState($btn_change, $GUI_DISABLE)
    $hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aParts)
    _GUICtrlStatusBar_SetText($hStatusBar, "Timers")
    _GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
    $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
    GUICtrlSetColor($progress, 0xff0000)
    _GUICtrlStatusBar_EmbedControl($hStatusBar, 1, GUICtrlGetHandle($progress))
    GUISetState()

    _Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock") ; create timer

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn_state
                If GUICtrlRead($btn_state) = "Start Progress Bar" Then
                    $iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "_UpdateProgressBar") ; create timer
                    If @error Or $iTimerProgress = 0 Then ContinueLoop
                    GUICtrlSetData($btn_state, "Stop Progress Bar")
                    GUICtrlSetState($btn_change, $GUI_ENABLE)
                Else
                    GUICtrlSetState($btn_change, $GUI_DISABLE)
                    _Timer_KillTimer($hGUI, $iTimerProgress)
                    GUICtrlSetData($btn_state, "Start Progress Bar")
                EndIf

            Case $btn_change
                If $iWait = 10 Then
                    $iWait = 250
                Else
                    $iWait = 10
                EndIf
                MemoWrite("Timer for _UpdateProgressBar set at: " & $iWait & " milliseconds")
                $iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "", $iTimerProgress) ; reuse timer with different interval
        EndSwitch
    WEnd
    ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF)
    GUIDelete()
EndFunc   ;==>_Example_CallBack

; call back function
Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    _GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
EndFunc   ;==>_UpdateStatusBarClock

; call back function
Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    $percent += 5 * $direction
    GUICtrlSetData($progress, $percent)
    If $percent = 100 Or $percent = 0 Then $direction *= -1
    If $percent = 100 Then
        GUICtrlSetColor($progress, 0xff0000)
    ElseIf $percent = 0 Then
        GUICtrlSetColor($progress, 0x0000ff)
    EndIf
EndFunc   ;==>_UpdateProgressBar

; Write a line to the memo control
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Edited by rdwray

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Link to comment
Share on other sites

Stripping functions doesn't work properly for function that accept a string as function name. (Like DllCallbackRegister, which is used by _Timer_SetTimer.

Likewise stripping variables doesn't work properly with functions that accept a string as variable name. (Like Eval)

It makes sense if you take into consideration that fall all obfuscator knows you could be getting these string from user input, there is no way it can know what functions a user is going to use.

I know of two ways you can solve this:

the first is probably the easiest: Just put the following at the top of your script:

If 0 Then _UpdateStatusBarClock(0, 0, 0, 0)
If 0 Then _UpdateProgressBar(0, 0, 0, 0)

Those lines will never run, because the If statement will never be true, but obfuscator has no way of knowing that, as it doesn't evaluate any statement.

This will prevent those two functions from being stripped. After all, obfuscator sees you intend to use them.

The other option is to add the functions to the file obfuscator created in your script dir.

Link to comment
Share on other sites

Spammer, you have to watch out for those MVPs. I would still like to know where the /os option for Obfuscator came from, what it means and are there any more? The list produced with the compiler did not show it and I can't find any reference.

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Link to comment
Share on other sites

The help folder does not exist, but I finally found this list. Thanks...

Now I did find this list of options, but the /os is not in them:

/CV or /Convert_Vars=0 ; No Variable encryption (Default = 1)

/CF or /Convert_Funcs=0 ; No FuncName encryption (Default = 1)

/CS or /Convert_Strings=0 ; No String encryption (Default = 1)

/CN or /Convert_Numerics=0 ; No Numeric encryption (Default = 1 )

/SO or /StripOnly ; Set the options to: /SF /SV /CV=0 /CF=0 /CS=0 /CN=0

/SOI or /StripOnlyIncludes ; Same as /SO but will leave masterscript untouched.

/OM or /ObfuscateMinumum ; Generates a much smaller obfuscated file.

/SF or /StripUnusedFunc ; Remove Func's that are not used by the MainScript. (Default = 0)

/SV or /StripUnusedVars ; Remove unused Gobal Variable declarations lines. (Default = 0)

/SCI or /showconsoleinfo 0 ; Default Minimal output to the console; warning and errors.

/SCI or /showconsoleinfo 1 ; Show more progress information.

/SCI or /showconsoleinfo 9 ; Show all debug lines as found in the Obfuscator.log

/Beta ; Use the AutoIt\Beta\Include files

Edited by rdwray

“No other God have I but Thee; born in a manger, died on a tree.” Martin Luther

Link to comment
Share on other sites

Stay calm.

Hehe I'm fine. Just felt a bit silly for not knowing that and advising someone to use my silly workaround.

Now I did find this list of options, but the /os is not in them:

...

/SO or /StripOnly ; Set the options to: /SF /SV /CV=0 /CF=0 /CS=0 /CN=0

...

/SO, not /OS

So the options it sets are:

Remove Func's that are not used by the MainScript.

Remove unused Gobal Variable declarations lines.

No Variable encryption

No FuncName encryption

No String encryption

No Numeric encryption

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...