Jump to content

AutoUpdater - false / positive problem


Recommended Posts

Hey guys,

I having some hard times getting false-positive, probably because I am trying to execute my AutoUpdater.

Here is my code:
 

Global $iUpdateTimer = 0

While 1
    checkUpdates(10)
WEnd


Func checkUpdates($iDelay = 10)
    $iDelay = $iDelay * 1000 * 60
    If TimerDiff($iUpdateTimer) > $iDelay Then
        ConsoleWrite('checking for updates...' & @CRLF)
        $iUpdateTimer = TimerInit()

        If FileExists('AutoUpdater.exe') Then ShellExecuteWait('AutoUpdater.exe') ; this is the line which cause my problem
    EndIf
EndFunc

And AutoUpdater code:

#include <MsgBoxConstants.au3>
#include <FileConstants.au3>

Global $sExecName = 'test.exe'
Global $sUpdatePath = @UserProfileDir &'\desktop\AnyAppName\update\'& $sExecName
Global $sUserPath = @UserProfileDir &'\desktop\AnyAppName\'& $sExecName
Global $sCopyright = 'someUniqueStringHere'

If Not FileExists($sUpdatePath) Then Exit 0
If FileGetVersion($sUpdatePath, $FV_LEGALCOPYRIGHT) <> $sCopyright Then Exit 0 ; checking if we really want to update and execute the file

If FileGetVersion($sUpdatePath) > FileGetVersion($sUserPath) Then
    $iResponse = MsgBox(BitOR($MB_YESNO, $MB_ICONQUESTION),'AnyAppName', 'There is an update available, would you like to update?')
    If $iResponse == $IDYES Then
        If ProcessExists($sExecName) Then
            ProcessClose($sExecName)
            Sleep(500)
        EndIf
        FileCopy($sUpdatePath, $sUserPath, $FC_OVERWRITE)
        Sleep(3000)
        ShellExecute($sUserPath)
        Exit 1
    EndIf
EndIf
Exit 0

I am not trying to ask, why is my code is getting recognized as false-positive, because this is quite obvious, but is there any other way to get things done without running external process?
 

ss.JPG

Edited by DesireDenied
Link to comment
Share on other sites

thanks Jos, it is really good place to start but I have already read this.

the problem is, I dont want to indicate my AutoUpdater as false-positive on every single workstation in my company.
just wondering if there is any other way to autoupdate my compiled script file.

I can always wait till the end of the day, and then manually update all the copies of my compiled script but I am not really satisfied with this option.

Edited by DesireDenied
Link to comment
Share on other sites

The script could set itself in the whilelist of the AV, so you do not have to perform this task manually.  Shouldn't be too much of a problem to program it.  Once it is done, then run your autoUpdater.

Link to comment
Share on other sites

I made a lot of noise around the topic, but today when I got back to work, everything seems completely fine.

I have just changed one line:
 

; orignal line
If FileExists('AutoUpdater.exe') Then ShellExecuteWait('AutoUpdater.exe')

; changed to
If FileExists('AutoUpdater.exe') Then RunWait('AutoUpdater.exe')

and the false-positive is gone.

Thank you guys for all your help, especially @Exit - will try this one.

By the way, we are using ESET Antivirus, if someone is interested.

Edited by DesireDenied
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

×
×
  • Create New...