Sign in to follow this  
Followers 0
daslick

Adware Remover

1 post in this topic

Here's the code to adware remover I wrote. It makes a list of all the files you select and when you click "delete it all" it kills the all of their processes and deletes the files. This works well on those nasty little pests with multiple processes that when you close them, 2 seconds later they restart themselves.

If someone wants to improve the code by making the browse dialog work with multiselect go ahead.

Enjoy!

#include <GuiConstants.au3>
#include <File.au3>
$GUI_Handle = GuiCreate("Spyware", 127, 88,(@DesktopWidth-127)/2, (@DesktopHeight-88)/2)
$add = GuiCtrlCreateButton("Add to list", 10, 10, 110, 30)
$del = GuiCtrlCreateButton("Delete it all", 10, 50, 110, 31)
GuiSetState()
dim $file
Func _pathtofile($sFullPath)
    $str = StringSPlit($sFullPath, "\")
    return $str[$str[0]]
EndFunc
Func _addit()
    $file = FileOpen(@TempDir & "\temp.txt", 1)
    If $file = -1 Then
        ;MsgBox(0, "Error", "Unable to open file.")
            Exit
        EndIf
    FileWrite($file, $addme & @CRLF)
    $addme = ""
    fileclose ( $file )
EndFunc
Func _doit()
    $file = FileOpen(@TempDir & "\temp.txt", 0)
    While 1
    $path = FileReadLine($file)
    If @error = -1 Then ExitLoop
        $filename = _pathtofile($path)
        ProcessClose ($filename)
        FileDelete ($path)
Wend
    ProcessClose ( $addme )
    ProcessClose(_pathtofile($addme))
    FileWrite($file, $addme & @CRLF)
    FileWrite($file, $addme & @CRLF)
    FileClose($file)
EndFunc
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    ;FileDelete ("C:\remove.txt")
        ExitLoop
    Case $msg = $add
        $addme = FileOpenDialog( "Devin's Spyware Destroyer", "C:\Windows\System32\", "Executables (*.exe)", 1 )
            if not $addme = "" then _addit()
    Case $msg = $del
        _doit()
    Case Else
    EndSelect
WEnd

Share this post


Link to post
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
Sign in to follow this  
Followers 0