Sign in to follow this  
Followers 0
Ashww

[RESOLVED] Find all processes, then list them! [RESOLVED]

12 posts in this topic

#1 ·  Posted (edited)

Hello, well ive been messing arround with Autoit for a few days now

I have been checking the forum for a since i started and i noticed a member called "Ashley" attempting to make something to allow you to run files, only if there trusted!

I thought i would give this a go - I think it would be a good contribution to the forum for my first post. Especially if i can be the first to release it!

Well here is what i have(my coding methods are not up to scratch-but i have only just started):

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>

Global $Accountfile = "reportfile.acrf"
Global $detected = _Date_Time_GetLocalTime()
Global $newfile = ""; this will be where the process name is shown!

$Attentiongui = GUICreate("Attention - Account Control", 291, 71, 5, 5, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
$programlable = GUICtrlCreateLabel($newfile & " was detected at " & $Detected & " as a new program!", 8, 8, 271, 17)
$info1 = GUICtrlCreateLabel("Please select an option from the list below!", 8, 24, 204, 17)
$Dobox = GUICtrlCreateCombo("Please select an option", 8, 40, 145, 25)
GUICtrlSetData(-1, "Mark as trusted!|Mark as untrusted!|No action (Not recommended)")
$Donebut = GUICtrlCreateButton("Add to database", 160, 40, 91, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Donebut
            Donebut()
    EndSwitch
WEnd



Func Donebut()
    If GUICtrlRead($Dobox) = "No action (Not recommended)" Then
        If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(52,"Account Control","Are you sure you wish to take no action? The file could be harmful" & @CRLF & @CRLF & "Press 'Yes' if you wish to continue or 'No' if you wish to change actions.")
                Select
            Case $iMsgBoxAnswer = 6;Yes
            FileWriteLine( $Accountfile, $newfile & "; No Action")
            GUIDelete($Attentiongui)
            Case $iMsgBoxAnswer = 7;No
                EndSelect
        Else 
            If GUICtrlRead($Dobox) = "Mark as trusted!" Then
            FileWriteLine( $Accountfile, $newfile & "; Trusted")
            MsgBox(64,"Account Control","Thank you!")
        Else
            If GUICtrlRead($Dobox) = "Mark as untrusted!" Then
                If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(52,"Account Control","Are you sure you with to mark the file as untrusted?" & @CRLF & @CRLF & "Press yes to mark as Untrusted or no to pick another action!")
                Select
            Case $iMsgBoxAnswer = 6;Yes
            FileWriteLine( $Accountfile, $newfile & "; Untrusted")
            GUIDelete($Attentiongui)
            Case $iMsgBoxAnswer = 7;No
            EndSelect
        EndIf
        EndIf
                
    EndIf
EndFunc


Func process()
$list = ProcessList()   
FileWrite($Accountfile, $list)
EndFunc

I havent done any of the actual process stuff, as i do not know where to start! Could someone point me in the right direction! Or better still give me a bit of code to learn from!

Edited by Ashww

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Share this post


Link to post
Share on other sites



@Ashww

Welcome to autoit forum :)

Read FAQs on sticky, make search on forum and use helpfile (F1 in SciTE)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@Ashww

Welcome to autoit forum :)

Read FAQs on sticky, make search on forum and use helpfile (F1 in SciTE)

Cheers, FireFox.

Thank you!

I will have a look at them. Any ideas on what to search in the helpfile?


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Share this post


Link to post
Share on other sites

@Ashww

ProcessList and all functions begining with process, you can also make search on helpfile :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@Ashww

ProcessList and all functions begining with process, you can also make search on helpfile :think:

Cheers, FireFox.

Thank you!

I will have a look :)

Edit:

I have just been looking in the helpfile. and with a tiny bit of editing i came up with this:

$Accountfile = "Accountfile.ini"
$list = ProcessList()

For $i = 1 to $list[0][0]
  FileWriteLine($Accountfile, $list[$i][0])
Next

It outputs this:

[System Process]
System
smss.exe
csrss.exe
wininit.exe
csrss.exe
services.exe
lsass.exe
lsm.exe
winlogon.exe
svchost.exe
svchost.exe
svchost.exe
svchost.exe
svchost.exe
svchost.exe
audiodg.exe
SLsvc.exe
svchost.exe
spoolsv.exe
taskeng.exe
dwm.exe
explorer.exe
svchost.exe
taskeng.exe
avp.exe
BcmSqlStartupSvc.exe
svchost.exe
svchost.exe
sqlbrowser.exe
sqlwriter.exe
svchost.exe
svchost.exe
SearchIndexer.exe
WUDFHost.exe
MSASCui.exe
hkcmd.exe
igfxpers.exe
SynTPEnh.exe
ISBMgr.exe
jusched.exe
MarketingTools.exe
avp.exe
LANUtil.exe
igfxsrvc.exe
wmpnscfg.exe
wmpnetwk.exe
firefox.exe
infocard.exe
SciTE.exe
SearchProtocolHost.exe
SearchFilterHost.exe
AutoIt3Wrapper.exe
AutoIt3.exe
AutoIt3Wrapper.exe

I think this is what i have been looking for.

But now how would i implement this into my code above, so that if the user does not trust a process, it will close it?

Thanks for the help so far :lmao:

Edit: Spelling.

Edited by Ashww

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Share this post


Link to post
Share on other sites

Thats great above, you can use that in here

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>

Global $Accountfile = "reportfile.acrf"
Global $detected = _Date_Time_GetLocalTime()
Global $list, $newfile = ""; this will be where the process name is shown!

If FileExists($Accountfile) Then
    ; read the file from array???
Else
    $list = ProcessList()
    ;FileWrite($Accountfile, $list) ; remember this writes an array
EndIf

$Attentiongui = GUICreate("Attention - Account Control", 291, 71, 5, 5, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
$programlable = GUICtrlCreateLabel($newfile & " was detected at " & $detected & " as a new program!", 8, 8, 291, 17)
$info1 = GUICtrlCreateLabel("Please select an option from the list below!", 8, 24, 204, 17)
$Dobox = GUICtrlCreateCombo("Please select an option", 8, 40, 145, 25)
GUICtrlSetData(-1, "Mark as trusted!|Mark as untrusted!|No action (Not recommended)")
$Donebut = GUICtrlCreateButton("Add to database", 160, 40, 91, 25, 0)
GUISetState(@SW_HIDE)

AdlibEnable("chk_Process")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Donebut
            Donebut()
            GUISetState(@SW_HIDE, $Attentiongui)
    EndSwitch
WEnd

Func chk_Process()
    $list2 = ProcessList()
    If $list2[0][0] > $list[0][0] Then
        GUISetState(@SW_SHOW, $Attentiongui)
        $detected = _NowCalc() ;_Date_Time_GetLocalTime()
        $newfile = $list2[$list2[0][0]][0]
        GUICtrlSetData($programlable, $newfile & " was detected at " & $detected & " as a new program!")
        $list[0][0] = $list2[0][0]
    Else
        $list[0][0] = $list2[0][0]
        ; if you close processes - this resets the list
    EndIf
EndFunc   ;==>chk_Process

Func Donebut()
    If GUICtrlRead($Dobox) = "No action (Not recommended)" Then
        If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(52, "Account Control", "Are you sure you wish to take no action? The file could be harmful" & @CRLF & @CRLF & "Press 'Yes' if you wish to continue or 'No' if you wish to change actions.")
        Select
            Case $iMsgBoxAnswer = 6;Yes
                FileWriteLine($Accountfile, $newfile & "; No Action")
                GUIDelete($Attentiongui)
            Case $iMsgBoxAnswer = 7;No
        EndSelect
    Else
        If GUICtrlRead($Dobox) = "Mark as trusted!" Then
            FileWriteLine($Accountfile, $newfile & "; Trusted")
            MsgBox(64, "Account Control", "Thank you!")
        Else
            If GUICtrlRead($Dobox) = "Mark as untrusted!" Then
                If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(52, "Account Control", "Are you sure you with to mark the file as untrusted?" & @CRLF & @CRLF & "Press yes to mark as Untrusted or no to pick another action!")
                Select
                    Case $iMsgBoxAnswer = 6;Yes
                        FileWriteLine($Accountfile, $newfile & "; Untrusted")
                        GUIDelete($Attentiongui)
                    Case $iMsgBoxAnswer = 7;No
                EndSelect
            EndIf
        EndIf

    EndIf
EndFunc   ;==>Donebut

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thats great above, you can use that in here

Thank you!

I have taken out the No Action! option.

But now how would i make it check if the file is trusted before showing a warning, if the file is trusted allow it to run - without notice. If the file isnt trusted then to close the file.

Here is my edited code:

;Account Control
;Designed to be like Vista's UAC but better
;Many thanks to Firefox and Valuater, And to Ashley for the original idea;)


#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>

Global $Accountfile = "reportfile.acrf"
Global $detected = _Date_Time_GetLocalTime()
Global $list, $newfile = ""; this will be where the process name is shown!

If FileExists($Accountfile) Then
   ; read the file from array???
Else
    $list = ProcessList()
   ;FileWrite($Accountfile, $list); remember this writes an array
EndIf

$Attentiongui = GUICreate("Attention - Account Control", 391, 71, 5, 5, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
$programlable = GUICtrlCreateLabel($newfile & " was detected at " & $detected & " as a new program!", 8, 8, 391, 17)
$info1 = GUICtrlCreateLabel("Please select an option from the list below!", 8, 24, 204, 17)
$Dobox = GUICtrlCreateCombo("Please select an option", 8, 40, 145, 25)
GUICtrlSetData(-1, "Mark as trusted!|Mark as untrusted!")
$Donebut = GUICtrlCreateButton("Add to database", 160, 40, 91, 25, 0)
GUISetState(@SW_HIDE)

AdlibEnable("chk_Process")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Donebut
            Donebut()
            GUISetState(@SW_HIDE, $Attentiongui)
    EndSwitch
WEnd

Func chk_Process()
    $list2 = ProcessList()
    If $list2[0][0] > $list[0][0] Then
        GUISetState(@SW_SHOW, $Attentiongui)
        $detected = _NowCalc();_Date_Time_GetLocalTime()
        $newfile = $list2[$list2[0][0]][0]
        GUICtrlSetData($programlable, $newfile & " was detected at " & $detected & " as a new program!")
        $list[0][0] = $list2[0][0]
    Else
        $list[0][0] = $list2[0][0]
       ; if you close processes - this resets the list
    EndIf
EndFunc  ;==>chk_Process

Func Donebut()
        If GUICtrlRead($Dobox) = "Mark as trusted!" Then
            FileWriteLine($Accountfile, $newfile & "; Trusted")
            MsgBox(64, "Account Control", "Thank you!")
        Else
            If GUICtrlRead($Dobox) = "Mark as untrusted!" Then
                If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
                $iMsgBoxAnswer = MsgBox(52, "Account Control", "Are you sure you with to mark the file as untrusted?" & @CRLF & @CRLF & "Press yes to mark as Untrusted or no to pick another action!")
                Select
                    Case $iMsgBoxAnswer = 6;Yes
                        FileWriteLine($Accountfile, $newfile & "; Untrusted")
                        GUIDelete($Attentiongui)
                    Case $iMsgBoxAnswer = 7;No
                EndSelect
            EndIf
        EndIf

EndFunc  ;==>Donebut

Thanks :)


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Share this post


Link to post
Share on other sites

There needs to be a lot of thought pu into this. I am not sure which direction it should go right now.

Normally, I just help with the code, but this is a little more complicated... :)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

A little further...

;Account Control
;Designed to be like Vista's UAC but better
;Many thanks to Firefox and Valuater, And to Ashley for the original idea;)

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>
#include <File.au3>
#include <Array.au3>

Global $Timer = TimerInit(), $Check_Wait = 5 ; check all Trusted every 5 minutes ( some can close and new ones open )
Global $Accountfile = "reportfile.acrf"
Global $detected = _Date_Time_GetLocalTime()
Global $list_Hold, $list, $newfile = ""; this will be where the process name is shown!

If UBound(ProcessList(@ScriptName)) >= 2 Then
    MsgBox(64, "* NOTE * ", "Account Control -  was already running  ", 5)
    Exit
EndIf

If FileExists($Accountfile) Then
    _FileReadToArray($Accountfile, $list)
Else
    If MsgBox(262193, "First Run", "Please be sure all Running Programs are Trusted and Press OK      ") <> 1 Then Exit
    Set_List()
EndIf

$Attentiongui = GUICreate("Attention - Account Control", 391, 71, 5, 5, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
$programlable = GUICtrlCreateLabel($newfile & " was detected at " & $detected & " as a new program!", 8, 8, 391, 17)
$info1 = GUICtrlCreateLabel("Please select an option from the list below!", 8, 24, 204, 17)
$Dobox = GUICtrlCreateCombo("Please select an option", 8, 40, 145, 25)
GUICtrlSetData(-1, "Mark as trusted!|Mark as untrusted!")
$Donebut = GUICtrlCreateButton("Add to database", 160, 40, 91, 25, 0)
GUISetState(@SW_HIDE)

AdlibEnable("chk_Process")

While 1
    Sleep(10)
WEnd

Func chk_Process()
    $list2 = ProcessList()
    If $list2[0][0] > $list_Hold Then Return Check_List()
    $list_Hold = $list2[0][0]
    If (Int(TimerDiff($Timer)) / (1000 * 60)) >= $Check_Wait Then Check_List()
EndFunc   ;==>chk_Process

Func Set_List()
    $list2 = ProcessList()
    For $i = 1 To UBound($list2) - 1
        If StringInStr($list2[$i][0], ".exe") Then FileWriteLine($Accountfile, $list2[$i][0] & "; Trusted")
    Next
    _FileReadToArray($Accountfile, $list)
EndFunc   ;==>Set_List

Func Check_List()
    AdlibDisable()
    $list = ""
    $list2 = ProcessList()
    _FileReadToArray($Accountfile, $list)
    For $x = 1 To UBound($list2) - 1
        $found = 0
        If Not StringInStr($list2[$x][0], ".exe") Then ContinueLoop
        For $i = 1 To UBound($list) - 1
            If StringInStr($list[$i], $list2[$x][0]) Then
                If StringInStr($list[$i], "Untrusted") Then ProcessClose($list2[$x][0])
                $found = 1
                ExitLoop
            EndIf
        Next
        If Not $found Then Show_GUI($list2[$x][0])
    Next
    $list2 = ProcessList()
    $list_Hold = $list2[0][0]
    $Timer = TimerInit()
    AdlibEnable("chk_Process")
EndFunc   ;==>Check_List

Func Show_GUI($addnewfile = "")
    $newfile = $addnewfile
    GUISetState(@SW_SHOW, $Attentiongui)
    $detected = _NowCalc();_Date_Time_GetLocalTime()
    GUICtrlSetData($programlable, $newfile & " was detected at " & $detected & " as a new program!")

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Donebut
                Donebut()
                GUISetState(@SW_HIDE, $Attentiongui)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>Show_GUI

Func Donebut()
    If GUICtrlRead($Dobox) = "Mark as trusted!" Then
        FileWriteLine($Accountfile, $newfile & "; Trusted")
        MsgBox(64, "Account Control", "Thank you!", 2)
    Else
        If MsgBox(52, "Account Control", "Are you sure you want to mark the file as UnTrusted?" & @CRLF & @CRLF & "Press yes to mark as UnTrusted or no to pick another action!") <> 6 Then Return
        FileWriteLine($Accountfile, $newfile & "; Untrusted")
        ProcessClose($newfile)
        GUISetState(@SW_HIDE, $Attentiongui)
    EndIf
EndFunc   ;==>Donebut

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

There needs to be a lot of thought pu into this. I am not sure which direction it should go right now.

Normally, I just help with the code, but this is a little more complicated... :)

8)

Hello,

Basicly I would like this to be like vista's UAC.

Cheers

Ashww


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Share this post


Link to post
Share on other sites

@valuator

Thank you. I will be testing this when I get home thank you for all of you help :)

I didn't think it would be this complicated - but at least I'm learning :lmao:


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Share this post


Link to post
Share on other sites

A little further...

;Account Control
;Designed to be like Vista's UAC but better
;Many thanks to Firefox and Valuater, And to Ashley for the original idea;)

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>
#include <File.au3>
#include <Array.au3>

Global $Timer = TimerInit(), $Check_Wait = 5 ; check all Trusted every 5 minutes ( some can close and new ones open )
Global $Accountfile = "reportfile.acrf"
Global $detected = _Date_Time_GetLocalTime()
Global $list_Hold, $list, $newfile = ""; this will be where the process name is shown!

If UBound(ProcessList(@ScriptName)) >= 2 Then
    MsgBox(64, "* NOTE * ", "Account Control -  was already running  ", 5)
    Exit
EndIf

If FileExists($Accountfile) Then
    _FileReadToArray($Accountfile, $list)
Else
    If MsgBox(262193, "First Run", "Please be sure all Running Programs are Trusted and Press OK      ") <> 1 Then Exit
    Set_List()
EndIf

$Attentiongui = GUICreate("Attention - Account Control", 391, 71, 5, 5, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
$programlable = GUICtrlCreateLabel($newfile & " was detected at " & $detected & " as a new program!", 8, 8, 391, 17)
$info1 = GUICtrlCreateLabel("Please select an option from the list below!", 8, 24, 204, 17)
$Dobox = GUICtrlCreateCombo("Please select an option", 8, 40, 145, 25)
GUICtrlSetData(-1, "Mark as trusted!|Mark as untrusted!")
$Donebut = GUICtrlCreateButton("Add to database", 160, 40, 91, 25, 0)
GUISetState(@SW_HIDE)

AdlibEnable("chk_Process")

While 1
    Sleep(10)
WEnd

Func chk_Process()
    $list2 = ProcessList()
    If $list2[0][0] > $list_Hold Then Return Check_List()
    $list_Hold = $list2[0][0]
    If (Int(TimerDiff($Timer)) / (1000 * 60)) >= $Check_Wait Then Check_List()
EndFunc   ;==>chk_Process

Func Set_List()
    $list2 = ProcessList()
    For $i = 1 To UBound($list2) - 1
        If StringInStr($list2[$i][0], ".exe") Then FileWriteLine($Accountfile, $list2[$i][0] & "; Trusted")
    Next
    _FileReadToArray($Accountfile, $list)
EndFunc   ;==>Set_List

Func Check_List()
    AdlibDisable()
    $list = ""
    $list2 = ProcessList()
    _FileReadToArray($Accountfile, $list)
    For $x = 1 To UBound($list2) - 1
        $found = 0
        If Not StringInStr($list2[$x][0], ".exe") Then ContinueLoop
        For $i = 1 To UBound($list) - 1
            If StringInStr($list[$i], $list2[$x][0]) Then
                If StringInStr($list[$i], "Untrusted") Then ProcessClose($list2[$x][0])
                $found = 1
                ExitLoop
            EndIf
        Next
        If Not $found Then Show_GUI($list2[$x][0])
    Next
    $list2 = ProcessList()
    $list_Hold = $list2[0][0]
    $Timer = TimerInit()
    AdlibEnable("chk_Process")
EndFunc   ;==>Check_List

Func Show_GUI($addnewfile = "")
    $newfile = $addnewfile
    GUISetState(@SW_SHOW, $Attentiongui)
    $detected = _NowCalc();_Date_Time_GetLocalTime()
    GUICtrlSetData($programlable, $newfile & " was detected at " & $detected & " as a new program!")

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Donebut
                Donebut()
                GUISetState(@SW_HIDE, $Attentiongui)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>Show_GUI

Func Donebut()
    If GUICtrlRead($Dobox) = "Mark as trusted!" Then
        FileWriteLine($Accountfile, $newfile & "; Trusted")
        MsgBox(64, "Account Control", "Thank you!", 2)
    Else
        If MsgBox(52, "Account Control", "Are you sure you want to mark the file as UnTrusted?" & @CRLF & @CRLF & "Press yes to mark as UnTrusted or no to pick another action!") <> 6 Then Return
        FileWriteLine($Accountfile, $newfile & "; Untrusted")
        ProcessClose($newfile)
        GUISetState(@SW_HIDE, $Attentiongui)
    EndIf
EndFunc   ;==>Donebut

8)

That code is great :) Thank you so much. I will be changing some of the coding- just to make it a little more user freiendly. I will also be posting this as an example - Maybe some people can learn some stuff from this code. I certainaly have learnt alot while coding it, and reading others coding helps me alot.

All credit will be given :lmao:

Cheers,

Ashww X)


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Projects: Account Control Wii style gui Bingo Caller - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Want a website? Click here!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -I use my Blackberry Storm to browse the forum! Please be patient!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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