• Ich möchte auf meine C# version verweisen da diese schneller ist.
    DisallowRun in C#

    Keine Ahnung ob jemand das brauch oder nicht, war nur irgendwann mal so eine Idee.
    wer will kann es ja weiter entwickeln und besser machen was ich sinnlos gemacht habe :p

    EDIT:
    Ich sollte vielleicht noch sagen was es macht :p
    das ist einfach nur ein programm welches über die registry die Disallowrun einstellungen grafisch vornehmen kann. also sprich ach keine ahnung seht es euch an :D

    Spoiler anzeigen
    [autoit]


    #Region include
    Opt("TrayMenuMode", 1)
    #include <array.au3>
    #include <String.au3>
    #include <RegFunc.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <_GetSID.au3>
    #include <Misc.au3>
    #EndRegion include

    [/autoit] [autoit][/autoit] [autoit]

    #Region Globale variablen
    Global $SID = _GetSID(), $Form1
    Global $ar[100][3]
    Global $ae[100][3]
    Local $i, $anzahl = 0
    Global $newar, $IncomingData[100][3], $OutData[100][3]
    Global $Regsetting_block = "HKEY_USERS\" & $SID & "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun"
    Global $Regsetting_example = "HKEY_USERS\" & $SID & "\Software\Ron_Welzel\DisallowRun\Werte_example"
    Global $data
    Global $notblockliste[100]
    Global $restart = False
    Global $timenowjetzt
    Global $lizwert = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Notepad\DefaultFonts", "lizablauf")
    #EndRegion Globale variablen

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=C:\Users\Ron\Documents\AutoIT3\Disallowrun\Form1.kxf
    $Form1 = GUICreate(@ScriptName & " by Ron Welzel", 617, 463, 192, 124)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
    GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
    GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
    $lock_list = GUICtrlCreateList("", 392, 40, 209, 370)
    GUICtrlSetData(-1, "")
    GUICtrlSetOnEvent(-1, "lock_listClick")
    $example_list = GUICtrlCreateList("", 16, 40, 209, 370)
    GUICtrlSetData(-1, "")
    GUICtrlSetOnEvent(-1, "example_listClick")
    $hinzufugen_button = GUICtrlCreateButton("Hinzufügen >>", 240, 40, 139, 25)
    GUICtrlSetOnEvent(-1, "hinzufugen_buttonClick")
    $entfernen_butten = GUICtrlCreateButton("<< Entfernen", 240, 72, 139, 25)
    GUICtrlSetOnEvent(-1, "entfernen_buttenClick")
    $Group1 = GUICtrlCreateGroup("Neue Programme", 232, 104, 153, 169)
    $newprog_input = GUICtrlCreateInput("", 248, 136, 97, 21)
    GUICtrlSetOnEvent(-1, "newprog_inputChange")
    $newprog_button = GUICtrlCreateButton("Einfügen", 248, 168, 123, 25)
    GUICtrlSetOnEvent(-1, "newprog_buttonClick")
    $locklist_radio = GUICtrlCreateRadio("Blocklist", 240, 224, 113, 17)
    GUICtrlSetOnEvent(-1, "locklist_radioClick")
    $examplelist_radio = GUICtrlCreateRadio("Programmliste", 240, 248, 113, 17)
    GUICtrlSetOnEvent(-1, "examplelist_radioClick")
    GUICtrlCreateLabel("Programme hinzufügen zur:", 240, 200, 132, 17)
    GUICtrlSetOnEvent(-1, "Label9Click")
    $fileselct = GUICtrlCreateButton("...", 352, 136, 27, 21)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    GUICtrlSetOnEvent(-1, "fileselctClick")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateLabel("Programmliste", 48, 8, 124, 28)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0x000000)
    GUICtrlSetOnEvent(-1, "Label10Click")
    GUICtrlCreateLabel("Blockliste", 448, 8, 114, 28)
    GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
    GUICtrlSetColor(-1, 0x000000)
    GUICtrlSetOnEvent(-1, "Label11Click")
    GUICtrlCreateLabel("Autor: Ron Welzel", 232, 328, 92, 17)
    GUICtrlSetOnEvent(-1, "Label12Click")
    GUICtrlCreateLabel("Version:", 232, 344, 42, 17)
    GUICtrlSetOnEvent(-1, "Label13Click")
    $version_label = GUICtrlCreateLabel(FileGetVersion(@ScriptFullPath), 272, 344, 37, 17)
    GUICtrlSetOnEvent(-1, "version_labelClick")
    $anwenden_button = GUICtrlCreateButton("Anwenden", 424, 424, 131, 25)
    GUICtrlSetOnEvent(-1, "anwenden_buttonClick")
    $loschen = GUICtrlCreateButton("<< Markierten Eintrag Löschen", 232, 288, 155, 25)
    GUICtrlSetOnEvent(-1, "loschenClick")
    GUISetState(@SW_HIDE, $Form1)
    GUICtrlSetState($examplelist_radio, $GUI_CHECKED)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    #Region debug meldungen
    ;//////////////////////
    ;debug region msgbox debugmeldungen
    ;false = off , true = on (0 = off,1 = on)
    Global $debug = False
    ;//////////////////////
    ;Zum debuggen verwenden sie:
    ; if $debug = 1 then msgbox(0,"Debug","")
    ;
    If $debug = 1 Then MsgBox(0, "Debug", "Debuggen ist Aktiviert")
    ;////////////////////////////////////////
    #EndRegion debug meldungen

    [/autoit] [autoit][/autoit] [autoit]

    #Region notlock
    ;Hier kommt die liste der nicht zu blockenden programme hin wobei der index maximal bis 99 gehen darf!
    $notblockliste[0] = "explorer.exe"
    $notblockliste[1] = @ScriptName
    ;/////////////////////////////////////////////////////////////
    ;//////////////Wertsetzfunktion der blockenden programme//////
    ;/////////////////////////////////////////////////////////////
    Local $blockcount = 0
    For $i = 0 To UBound($notblockliste) - 1
    If $notblockliste[$i] <> "" Then $blockcount = $blockcount + 1
    Next
    $blockcount = $blockcount - 1
    Global $notlock[$blockcount + 1]
    For $i = 0 To $blockcount
    $notlock[$i] = $notblockliste[$i]
    Next
    #EndRegion notlock

    [/autoit] [autoit][/autoit] [autoit]

    #Region Leere felder füllen
    For $i = 0 To 99 Step +1
    For $e = 0 To 2 Step +1
    $ar[$i][$e] = "leer"
    Next
    Next
    For $i = 0 To 99 Step +1
    For $e = 0 To 2 Step +1
    $ae[$i][$e] = "leer"
    Next
    Next
    #EndRegion Leere felder füllen

    [/autoit] [autoit][/autoit] [autoit]

    #Region werte lesen
    $ar = _GetRegValues($Regsetting_block)
    $ae = _GetRegValues($Regsetting_example)
    #EndRegion werte lesen

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    GUISetState(@SW_SHOW, $Form1)
    #Region ### liste anzeigen ###
    For $i = 0 To UBound($ar) - 1
    $data = $ar[$i][2]
    If $data <> "" Then _GUICtrlListBox_InsertString($lock_list, $data) ;Eintrag einfügen
    Next
    ;_ArrayDisplay($ar)
    For $i = 0 To UBound($ae) - 1
    $data = $ae[$i][2]
    If $data <> "" Then _GUICtrlListBox_InsertString($example_list, $data) ;Eintrag einfügen
    Next
    ;_ArrayDisplay($ae)
    #EndRegion ### liste anzeigen ###
    While 1
    If _IsPressed("2E") Then _del()
    Sleep(100)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Form1Close()
    Local $frage
    RegDelete("HKEY_USERS\" & $SID & "\Software\Ron_Welzel\DisallowRun\Werte_example")
    For $i = 0 To _GUICtrlListBox_GetCount($example_list) - 1
    $data = _GUICtrlListBox_GetText($example_list, $i)
    If $data <> "0" Then RegWrite("HKEY_USERS\" & $SID & "\Software\Ron_Welzel\DisallowRun\Werte_example", $i, "REG_SZ", $data)
    Next
    RegDelete("HKEY_USERS\" & $SID & "\Software\Ron_Welzel\DisallowRun\Werte_block")
    For $i = 0 To _GUICtrlListBox_GetCount($lock_list) - 1
    $data = _GUICtrlListBox_GetText($lock_list, $i)
    If $data <> "0" Then RegWrite("HKEY_USERS\" & $SID & "\Software\Ron_Welzel\DisallowRun\Werte_block", $i, "REG_SZ", $data)
    Next
    If $restart = True Then
    $frage = MsgBox(4096 + 4, "Neustarten?", "Es sind Änderungen durchgeführt worden," & @LF & "diese werden erst nach einem Neustart aktiv." & @LF & @LF & "Jetzt Neustarten?")
    If $frage <> 7 Then
    Shutdown(2)
    Else
    Exit
    EndIf
    EndIf
    Exit
    EndFunc ;==>Form1Close

    [/autoit] [autoit][/autoit] [autoit]

    Func entfernen_buttenClick()
    Local $number
    $data = ""
    $data = _GUICtrlListBox_GetText($lock_list, _GUICtrlListBox_GetCurSel($lock_list))
    ;$number = _GUICtrlListBox_GetSelCount( _GUICtrlListBox_GetCurSel($lock_list))
    ;msgbox(0,"",$number)
    _GUICtrlListBox_BeginUpdate($lock_list)
    _GUICtrlListBox_DeleteString($lock_list, _GUICtrlListBox_FindString($lock_list, $data, True))
    _GUICtrlListBox_EndUpdate($lock_list) ;ListBox sperren
    _GUICtrlListBox_BeginUpdate($example_list)
    _GUICtrlListBox_InsertString($example_list, $data) ;Eintrag einfügen
    _GUICtrlListBox_EndUpdate($example_list) ;ListBox sperren
    EndFunc ;==>entfernen_buttenClick

    [/autoit] [autoit][/autoit] [autoit]

    Func hinzufugen_buttonClick()
    Local $number
    $data = ""
    $data = _GUICtrlListBox_GetText($example_list, _GUICtrlListBox_GetCurSel($example_list))
    ;$number = _GUICtrlListBox_GetSelCount( _GUICtrlListBox_GetCurSel($lock_list))
    ;msgbox(0,"",$number)
    _GUICtrlListBox_BeginUpdate($example_list)
    _GUICtrlListBox_DeleteString($example_list, _GUICtrlListBox_FindString($example_list, $data, True))
    _GUICtrlListBox_EndUpdate($example_list) ;ListBox sperren
    _GUICtrlListBox_BeginUpdate($lock_list)
    _GUICtrlListBox_InsertString($lock_list, $data) ;Eintrag einfügen
    _GUICtrlListBox_EndUpdate($lock_list) ;ListBox sperren
    EndFunc ;==>hinzufugen_buttonClick

    [/autoit] [autoit][/autoit] [autoit]

    Func newprog_buttonClick()
    If GUICtrlRead($locklist_radio) = 1 Then
    $data = GUICtrlRead($newprog_input)
    If $data <> "" Then
    If StringLen($data) = 1 Or StringLen($data) = 2 Or StringLen($data) = 3 Or StringLen($data) = 4 Then
    $data = $data & ".exe"
    EndIf
    $dataarray = StringSplit($data, "")
    If $dataarray[UBound($dataarray) - 4] == "." And $dataarray[UBound($dataarray) - 3] = "e" And $dataarray[UBound($dataarray) - 2] = "x" And $dataarray[UBound($dataarray) - 1] = "e" Then
    Else
    $data = $data & ".exe"
    EndIf
    For $i = 0 To UBound($notlock) - 1
    If $data = $notlock[$i] Then
    MsgBox(0, "System", $notlock[$i] & "sollte nicht gesperrt werden!")
    GUICtrlSetData($newprog_input, "")
    EndIf
    Next
    _vergleichstringlocklist($data)
    GUICtrlSetData($newprog_input, "")
    EndIf
    EndIf
    If GUICtrlRead($examplelist_radio) = 1 Then
    Local $dataarray[100]
    $data = GUICtrlRead($newprog_input)
    If $data <> "" Then
    If StringLen($data) = 1 Or StringLen($data) = 2 Or StringLen($data) = 3 Or StringLen($data) = 4 Then
    $data = $data & ".exe"
    EndIf
    $dataarray = StringSplit($data, "")
    If $dataarray[UBound($dataarray) - 4] == "." And $dataarray[UBound($dataarray) - 3] = "e" And $dataarray[UBound($dataarray) - 2] = "x" And $dataarray[UBound($dataarray) - 1] = "e" Then
    Else
    $data = $data & ".exe"
    EndIf
    For $i = 0 To UBound($notlock) - 1
    If $data = $notlock[$i] Then
    MsgBox(0, "System", $notlock[$i] & " Sollte nicht gesperrt werden!")
    GUICtrlSetData($newprog_input, "")
    $data = ""
    EndIf
    Next
    _vergleichstringexapmlelist($data)
    GUICtrlSetData($newprog_input, "")
    EndIf
    EndIf
    EndFunc ;==>newprog_buttonClick

    [/autoit] [autoit][/autoit] [autoit]

    Func _vergleichstringexapmlelist($string)
    If $string <> "" Then ;Wenn die Daten nicht leer sind
    $exists = False ;Gibt an ob es den Eintrag schon gibt
    $count = _GUICtrlListBox_GetCount($example_list) ;Einträge der ListBox
    For $i = 0 To $count - 1 ;Druchlaufen
    $entry = _GUICtrlListBox_GetText($example_list, $i) ;Eintrag lesen
    If $entry = $string Then ;Wenn gleich mit neunem Eintrag
    $exists = True ;Doppelter Eintrag!
    ExitLoop ;Verlasse Überprüfung
    EndIf
    Next
    $count = _GUICtrlListBox_GetCount($lock_list) ;Einträge der ListBox
    For $i = 0 To $count - 1 ;Druchlaufen
    $entry = _GUICtrlListBox_GetText($lock_list, $i) ;Eintrag lesen
    If $entry = $string Then ;Wenn gleich mit neunem Eintrag
    $exists = True ;Doppelter Eintrag!
    ExitLoop ;Verlasse Überprüfung
    EndIf
    Next
    If $exists = False Then ;Wenn der Eintrag noch nicht existiert
    _GUICtrlListBox_BeginUpdate($example_list) ;ListBox entsperren
    _GUICtrlListBox_InsertString($example_list, $string) ;Eintrag einfügen
    _GUICtrlListBox_EndUpdate($example_list) ;ListBox sperren
    EndIf
    EndIf
    EndFunc ;==>_vergleichstringexapmlelist

    [/autoit] [autoit][/autoit] [autoit]

    Func _vergleichstringlocklist($string)
    If $string <> "" Then ;Wenn die Daten nicht leer sind
    $exists = False ;Gibt an ob es den Eintrag schon gibt
    $count = _GUICtrlListBox_GetCount($lock_list) ;Einträge der ListBox
    For $i = 0 To $count - 1 ;Druchlaufen
    $entry = _GUICtrlListBox_GetText($lock_list, $i) ;Eintrag lesen
    If $entry = $string Then ;Wenn gleich mit neunem Eintrag
    $exists = True ;Doppelter Eintrag!
    ExitLoop ;Verlasse Überprüfung
    EndIf
    Next
    $count = _GUICtrlListBox_GetCount($example_list) ;Einträge der ListBox
    For $i = 0 To $count - 1 ;Druchlaufen
    $entry = _GUICtrlListBox_GetText($example_list, $i) ;Eintrag lesen
    If $entry = $string Then ;Wenn gleich mit neunem Eintrag
    $exists = True ;Doppelter Eintrag!
    ExitLoop ;Verlasse Überprüfung
    EndIf
    Next
    If $exists = False Then ;Wenn der Eintrag noch nicht existiert
    _GUICtrlListBox_BeginUpdate($lock_list) ;ListBox entsperren
    _GUICtrlListBox_InsertString($lock_list, $string) ;Eintrag einfügen
    _GUICtrlListBox_EndUpdate($lock_list) ;ListBox sperren
    EndIf
    EndIf
    EndFunc ;==>_vergleichstringlocklist

    [/autoit] [autoit][/autoit] [autoit]

    Func anwenden_buttonClick()
    RegDelete("HKEY_USERS\" & $SID & "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun")
    RegWrite("HKEY_USERS\" & $SID & "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "DisallowRun", "REG_DWORD", "1")
    For $i = 0 To _GUICtrlListBox_GetCount($lock_list) - 1
    $data = _GUICtrlListBox_GetText($lock_list, $i)
    If $data <> "0" Then RegWrite("HKEY_USERS\" & $SID & "\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Disallowrun", $i + 1, "REG_SZ", $data)
    Next
    $restart = True
    EndFunc ;==>anwenden_buttonClick

    [/autoit] [autoit][/autoit] [autoit]

    Func fileselctClick()
    Local $filearray[100]
    $fileload = FileOpenDialog("Programm Auswählen", "", "Anwendungen (*.exe)")
    $filearray = StringSplit($fileload, "\")
    $number = UBound($filearray) - 1
    If $filearray[$number] <> "" Then GUICtrlSetData($newprog_input, $filearray[$number])
    EndFunc ;==>fileselctClick

    [/autoit] [autoit][/autoit] [autoit]

    Func loschenClick()
    $data = _GUICtrlListBox_GetText($example_list, _GUICtrlListBox_GetCurSel($example_list))
    _GUICtrlListBox_BeginUpdate($example_list)
    _GUICtrlListBox_DeleteString($example_list, _GUICtrlListBox_FindString($example_list, $data, True))
    _GUICtrlListBox_EndUpdate($example_list) ;ListBox sperren
    EndFunc ;==>loschenClick

    [/autoit] [autoit][/autoit] [autoit]

    Func _del()
    $data = _GUICtrlListBox_GetText($example_list, _GUICtrlListBox_GetCurSel($example_list))
    _GUICtrlListBox_BeginUpdate($example_list)
    _GUICtrlListBox_DeleteString($example_list, _GUICtrlListBox_FindString($example_list, $data, True))
    _GUICtrlListBox_EndUpdate($example_list) ;ListBox sperren
    EndFunc ;==>_del

    [/autoit]