Jump to content

Please help complete code of Window Services


 Share

Recommended Posts

I was doing 1 autoit optimize windows ( tweak ) OS runs on XP , Win 7 , Win 8 , and win 10. Code still run, but one problem is it inconvenient in some cases 1 , so I ask you to help me implement the following issues :

1 - When pressing Button Check is completed, it is the status of the services they have available lists .

 

2 - Services have left each Check Box

 

3 - Check the Services and Enable or Disable

 

4 - When clicking the Enable or Disable Button will appear showing 1 Box Enable or Disable Services process that

 

 

This is my code :

#include <ProgressConstants.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>
#Include <WinAPI.au3>
#include <Array.au3>
#include <ComboConstants.au3>
#include <StaticConstants.au3>
#include <Process.au3>
#include <ScrollBarConstants.au3>
#include <GuiEdit.au3>
 #include <InetConstants.au3>
 #include <ListviewConstants.au3>

Dim $adrivearray[100], $Var = False, $TempDir = @TempDir & "\"
Dim $aRegKeys[33]
Dim $drivearray[100]
Dim $MyServices
Dim $MyServicesList
$Form1 = GUICreate("Optimize v2.2.0 by OSTEAM | Áp dụng cho Windows 7 & WindowsXP", 611, 497, 190, 125)
$ListView1 = GUICtrlCreateListView(" | Service|Status | ", 8, 8, 460, 450, $LVS_NOSORTHEADER+$LVS_SINGLESEL,$LVS_EX_GRIDLINES )
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 25)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 200)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150)
$opt = GUICtrlCreateButton("Optimize", 470, 68, 133, 59)
$msconfig = GUICtrlCreateButton("Msconfig", 470, 131, 133, 59)
$driver = GUICtrlCreateButton("Device Manager", 470, 193, 133, 59)
$chkdsk = GUICtrlCreateButton("Check Disk", 470, 255, 133, 59)
$chip = GUICtrlCreateButton("3D Chip", 470, 316, 133, 59)
$hwinfo = GUICtrlCreateButton(" Hardware", 470, 377, 133, 59)
$testcpu = GUICtrlCreateButton("TEST CPU - VGA ", 470, 437, 133, 59)
$ktra = GUICtrlCreateButton("Check Services", 470, 7, 133, 59)
$Progress1 = GUICtrlCreateProgress(8, 460, 460, 33)
GUISetState(@SW_SHOW, $Form1)

      $MyServices = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
      $MyServicesList = $MyServices.ExecQuery("SELECT * FROM Win32_Service")

While 1
      Switch GUIGetMsg()

Case $ktra
     SplashTextOn("Thông báo", "Đang kiểm tra....", 400, 60, -1, -1, 1, "Tahoma", 24)
   ;----Windows Update---------------------
$myServiceQuery = "Windows Update"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" &  $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
;----Computer Browser-----
$myServiceQuery = "Computer Browser"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Bluetooth Support Service-----
$myServiceQuery = "Bluetooth Support Service"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----DHCP Client-----
$myServiceQuery = "DHCP Client"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Google Update Service (gupdate)-----
$myServiceQuery = "Google Update Service (gupdate)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Google Update Service (gupdatem)-----
$myServiceQuery = "Google Update Service (gupdatem)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Print Spooler-----
$myServiceQuery = "Print Spooler"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Skype Update-----
$myServiceQuery = "Skype Update"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Disk Defragmenter-----
$myServiceQuery = "Disk Defragmenter"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Desktop Window Manager Session Manager-----
$myServiceQuery = "Desktop Window Manager Session Manager"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Task Scheduler-----
$myServiceQuery = "Task Scheduler"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
    ;----UPnP Device Host-----
$myServiceQuery = "UPnP Device Host"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
      ;----Windows Defender-----
$myServiceQuery = "Windows Defender"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
          ;----Windows Firewall XP-----
$myServiceQuery = "Windows Firewall/Internet Connection Sharing (ICS)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
      ;----Windows Firewall-----
$myServiceQuery = "Windows Firewall"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
      ;----Windows Search-----
$myServiceQuery = "Windows Search"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----WLAN AutoConfig-----
$myServiceQuery = "WLAN AutoConfig"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Automatic Updates WinXP-----
$myServiceQuery = "Automatic Updates"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Wireless Zero Configuration WinXP-----
$myServiceQuery = "Wireless Zero Configuration"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Windows FireWall/Internet Connection Sharing(ICS) WinXP-----
$myServiceQuery = "Windows FireWall/Internet Connection Sharing(ICS)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----QoS RSUP WinXP------
$myServiceQuery = "QoS RSUP"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Superfetch------
$myServiceQuery = "Superfetch"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;------WinHTTP Web Proxy Auto-Discovery Service
     $myServiceQuery = "WinHTTP Web Proxy Auto-Discovery Service"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;------System Restore Xp
     $myServiceQuery = "System Restore Service"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;------Visual Effects
$FW = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting")
If $FW = 0 Then
   $FW = "Let Windows choose what's best for my computer "
 EndIf
If $FW = 1 Then
   $FW = "Adjust for best appearance"
EndIf
If $FW = 2 Then
   $FW = "Adjust for best Performance "
EndIf
If $FW = 3 Then
   $FW = "Custom"
EndIf
GUICtrlCreateListViewItem("|" & "Visual Effects" & "|" & $FW & "|" & "System", $ListView1)

;---------PagingFiles--------
$FW1 = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "PagingFiles")
If $FW1 = "?:\pagefile.sys" Then
   $FW1 = "Automatically manage paging file size for all drivers"
EndIf
If $FW1 = "c:\pagefile.sys 4096 4096" Then
   $FW1 = "Custom Size :C:\4096 4096"
EndIf
If $FW1 = "c:\pagefile.sys 0 0" Then
   $FW1 = "System manged size"
EndIf
If $FW1 = "" Then
   $FW1 = "C:\None"
EndIf
 GUICtrlCreateListViewItem("|" & "Paging Files" & "|" & $FW1 & "|" & "System", $ListView1)

;---------Automatically restart----
$FW2 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl", "AutoReboot")
If $FW2 = 0 Then
   $FW2 = "Disable"
EndIf
If $FW2 = 1 Then
   $FW2 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "Automatically restart" & "|" & $FW2 & "|" & "System", $ListView1)
;---------Write debugging infomation----
$FW4 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl", "CrashDumpEnabled")
If $FW4 = 0 Then
   $FW4 = "(None)"
EndIf
If $FW4 = 3 Then
   $FW4 = "Small memory dump (256KB)"
EndIf
If $FW4 = 2 Then
   $FW4 = "Kernel memory dump"
EndIf
GUICtrlCreateListViewItem("|" & "Write debugging infomation" & "|" & $FW4 & "|" & "System", $ListView1)
;---------Write an event to the system log----
$FW5 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl", "LogEvent")
If @OSArch = "X64" Then
   EndIf
If $FW5 = 0 Then
   $FW5 = "Disable"
EndIf
If $FW5 = 1 Then
   $FW5 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "Write an event to the system log" & "|" & $FW5 & "|" & "System", $ListView1)
;---------ComputerRestore----
If @OSVersion = "WIN_7" Then
$FW3 = RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "RPSessionInterval")

If @OSArch = "X64" Then
   EndIf
If $FW3 = 0 Then
   $FW3 = "Disable"
EndIf
If $FW3 = 1 Then
   $FW3 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "System Restore" & "|" & $FW3 & "|" & "System", $ListView1)
EndIf
;---------ComputerRestore XP----
If @OSVersion = "WIN_XP" Then
$FW3 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore", "DisableSR")
If $FW6 = 0 Then
   $FW6 = "Disable"
EndIf
If $FW6 = 1 Then
   $FW6 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "System Restore" & "|" & $FW6 & "|" & "System", $ListView1)
EndIf
SplashOff()
       ;--------------------
    Case $opt
       SplashTextOn("Thông báo", "Đang Optimize....", 400, 60, -1, -1, 1, "Tahoma", 24)
  Local $sService,$sCMD,$xCMD,$vCMD,$sListService=StringSplit("wuauserv|AMD External Events Utility|AMD FUEL Service|amdacpusrsvc|NVSvc|FontCache3.0.0.0|WPFFontCache_v0400|NvNetworkService|GfExperienceService|NvStreamSvc|WajaIntEn Monitor|PnkBstrA|AMD External Events Utility|odserv|idsvc|MozillaMaintenance|Stereo Service|nvsvc|igfxCUIService1.0.0.0|ICCS|cphs|LMS|jhi_service|Intel(R) Capability Licensing Service TCP IP Interface|Intel(R) Capability Licensing Service Interface|WinHttpAutoProxySvc|SysMain|MpsSvc|WSearch|WinDefend|gupdate|gupdatem|UxSms|BstHdUpdaterSvc|defragsvc|Browser|upnphost|Schedule|TabletInputService|Wlansvc|bthserv|srservice|uxsms|WZCSVC|SharedAccess","|")
For $i=1 to UBound($sListService)-1
    $sService=$sListService[$i]
      GUICtrlSetData($Progress1,$i*3)
    ConsoleWrite(">! Stoping service: "&$sService&@CRLF)
    RunWait('"'&@ComSpec&'" /c sc config "'&$sService&'" start= Disabled',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c sc stop "'&$sService&'"',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c net stop "'&$sService&'"',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c sc config Dhcp start= auto',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c net start Dhcp',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c wmic recoveros set AutoReboot = False',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c wmic recoveros set WriteToSystemLog = False',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c wmic recoveros set DebugInfoType = 0',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c schtasks /delete /tn * /f',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c bcdedit /timeout 0',@SystemDir,@SW_HIDE)
    ConsoleWrite($sService&" disabled."&@CRLF)

 Next


;-----------------------------VisualEffects
Local $sRegKey = "\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"
If @OSArch = "X64" Then
    $sRegKey = "HKCU64" & $sRegKey
Else
    $sRegKey = "HKCU" & $sRegKey
EndIf
RegWrite($sRegKey, "VisualFXSetting", "REG_DWORD", "2")

;-----------------------------ComputerRestore
Local $sRegKey = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey
EndIf
RegWrite($sRegKey, "RPSessionInterval", "REG_DWORD", "0")

;-----------------------------ComputerRestore
Local $sRegKey = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

    EndIf
RegDelete($sRegKey)

;-----------------------------ComputerRestore
Local $sRegKey = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

    EndIf
RegWrite($sRegKey)

;-----------------------------PagingFiles
Local $sRegKey = "\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "PagingFiles", "REG_MULTI_SZ", "C:\pagefile.sys 4096 4096")

;-----------------------------UAC
Local $sRegKey = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "EnableLUA", "REG_DWORD", "0")

;-----------------------------USB Root Hub Power Management
Local $sRegKey = "\HKLM\SYSTEM\CurrentControlSet\Services\USB"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "DisableSelectiveSuspend", "REG_DWORD", "1")

;-----------------------------Task Scheduler
Local $sRegKey = "\SYSTEM\CurrentControlSet\services\Schedule"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "Start", "REG_DWORD", "3")

;-----------------------------Msconfig

    $aRegKeys[0] = "IMJPMIG"
    $aRegKeys[1] = "CocCoc Update"
    $aRegKeys[2] = "Intel(R) Common User Interface"
    $aRegKeys[3] = "Java Platform SE Auto Updater"
    $aRegKeys[4] = "IgfxTray"
    $aRegKeys[5] = "HotKeysCmds"
    $aRegKeys[6] = "Vmware User process"
    $aRegKeys[7] = "ImScInst"
    $aRegKeys[8] = "hkcmd"
    $aRegKeys[9] = "igfxpers"
    $aRegKeys[10] = "StartCCC"
    $aRegKeys[11] = "USB3MON"
    $aRegKeys[12] = "CuHanhPlay"
    $aRegKeys[13] = "SynTPEnh"
    $aRegKeys[14] = "Quicktime Task"
    $aRegKeys[15] = "iTunesHelper"
    $aRegKeys[16] = "NvBackend"
    $aRegKeys[17] = "NvMctray"
    $aRegKeys[18] = "Persistence"
    $aRegKeys[19] = "SunJavaUpdateSched"
    $aRegKeys[20] = "ctfmon.exe"
    $aRegKeys[21] = "NvCpl"
    $aRegKeys[22] = "TINTSETP"
    $aRegKeys[23] = "jusched"
    $aRegKeys[24] = "CocCoc"
    $aRegKeys[25] = "IMEKRMIG"
    $aRegKeys[26] = "CCleaner Monitoring"
    $aRegKeys[27] = "Google Update"
    $aRegKeys[28] = "ShadowPlay"
    $aRegKeys[29] = "AppEx Accelerator UI"
    $aRegKeys[30] = "StartCN"
    $aRegKeys[31] = "DFX"
    $aRegKeys[32] = "Raptr"


    ; Loop to delete startup registry keys
    #requireAdmin
    For $g = 0 To UBound($aRegKeys) - 1
        RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        RegRead("HKLM64\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        If @error <> 0 Then
            ; do nothing
        Else
            For $r = 0 To UBound($aRegKeys) - 1
                RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                RegDelete("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                RegDelete("HKLM64\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                Sleep(100)
            Next
        EndIf
     Next
         ; Loop to delete startup registry keys
    For $g = 0 To UBound($aRegKeys) - 1
        RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        If @error <> 0 Then
            ; do nothing
        Else
            For $r = 0 To UBound($aRegKeys) - 1
                RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                RegDelete("HKCU64\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                Sleep(100)
            Next
        EndIf
     Next
     SplashOff()
;-----------------------------MsgBox
MsgBox($MB_SYSTEMMODAL, "Hoàn thành", "Hoàn thành !")
Case $msconfig
    Run(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MSCONFIG.EXE",""))
    __Run("msconfig")

Func __Run($s_program, $s_workdir = "", $i_show = @SW_SHOW, $i_opt_flag = 0)

    If @OSArch = "X86" Then
        Return Run($s_program, $s_workdir, $i_show, $i_opt_flag)
    EndIf

    Local $t_int = DllStructCreate("int")
    Local $p_int = DllStructGetPtr($t_int)

    DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "ptr", $p_int)
    Local $i_pid = Run($s_program, $s_workdir, $i_show, $i_opt_flag)
    DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection", "ptr", $p_int)

    Return $i_pid
 EndFunc
 ;--------------- Device Manager----------
 Case $driver
    Run(@ComSpec & " /c " & 'devmgmt.msc', "", @SW_HIDE)
 ;----------------Check Disk-------------
 Case $chkdsk
    Run(@ComSpec & " /c " & 'cmd.exe', "",  @SW_SHOW)
    ;-------3DP Chip
 Case $chip
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/3DPChip.exe", @TempDir & "\3DPChip.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  Do
       Sleep(250)
    Until InetGetInfo($Download, $INET_DOWNLOADCOMPLETE)
ShellExecute(@tempdir & "\3DPChip.exe")
    ;--------Info hardware
 Case $hwinfo
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/Speccy.exe", @TempDir & "\Speccy.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  Do
       Sleep(250)
    Until InetGetInfo($Download, $INET_DOWNLOADCOMPLETE)
ShellExecute(@tempdir & "\Speccy.exe")
;--------Test Cpu & VGA
 Case $testcpu
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/ORTHOS.exe", @TempDir & "\ORTHOS.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
 Sleep (250)
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/worker.dll", @TempDir & "\worker.dll", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  Do
       Sleep(500)
    Until InetGetInfo($Download, $INET_DOWNLOADCOMPLETE)
ShellExecute(@tempdir & "\ORTHOS.exe")
Case $GUI_EVENT_CLOSE
If FileExists($TempDir & "CheckDisk.exe") Then
FileDelete($TempDir & "CheckDisk.exe")
EndIf
If FileExists($TempDir & "3DP_Chip.exe") Then
FileDelete($TempDir & "3DP_Chip.exe")
EndIf
If FileExists($TempDir & "Speccy.exe") Then
FileDelete($TempDir & "Speccy.exe")
EndIf
If FileExists($TempDir & "ORTHOS.exe") Then
FileDelete($TempDir & "ORTHOS.exe")
EndIf
If FileExists($TempDir & "worker.dll") Then
FileDelete($TempDir & "worker.dll")
EndIf
Exit
EndSwitch
WEnd
@OSArch


If possible, help you support yourselves . Thank you

Sorry for the english is not my native language
Link to comment
Share on other sites

  • Moderators

@sukendn your code runs, but barely; I see a number of issues right off the bat. I would highly suggest that you download the full version of SciTE so you can run CTRL+F5 on your script and resolve the issues. Once you do this, I think the resolution of your other issues with come much easier.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

The console output shows you these errors:

>Running AU3Check (3.3.14.2)  from:C:\Program Files\AutoIt3  input:C:\Users\Bert\AutoIt3.My\Temp\aa.au3
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(298,9) : warning: $FW6: possibly used before declaration.
If $FW6 =
~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(483,1) : error: missing EndSwitch.
Func
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(45,25) : REF: missing EndSwitch.
      Switch GUIGetMsg()
~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(483,1) : error: missing Wend.
Func
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(44,1) : REF: missing Wend.
While
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(499,2) : error: syntax error
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(499,2) : error: Statement cannot be just an expression.
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(499,14) : error: Statement cannot be just an expression.
 Case $driver
~~~~~~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(502,2) : error: syntax error
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(502,2) : error: Statement cannot be just an expression.
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(502,14) : error: Statement cannot be just an expression.
 Case $chkdsk
~~~~~~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(505,2) : error: syntax error
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(505,2) : error: Statement cannot be just an expression.
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(505,12) : error: Statement cannot be just an expression.
 Case $chip
~~~~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(512,2) : error: syntax error
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(512,2) : error: Statement cannot be just an expression.
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(512,14) : error: Statement cannot be just an expression.
 Case $hwinfo
~~~~~~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(519,2) : error: syntax error
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(519,2) : error: Statement cannot be just an expression.
 Case
~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(519,15) : error: Statement cannot be just an expression.
 Case $testcpu
~~~~~~~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(527,1) : error: syntax error
Case
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(527,1) : error: Statement cannot be just an expression.
Case
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(527,22) : error: Statement cannot be just an expression.
Case $GUI_EVENT_CLOSE
~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(544,1) : error: syntax error
EndSwitch
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(544,1) : error: Statement cannot be just an expression.
EndSwitch
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(545,1) : error: Statement cannot be just an expression.
WEnd
^
"C:\Users\Bert\AutoIt3.My\Temp\aa.au3"(546,1) : error: Statement cannot be just an expression.
@OSArch
^
C:\Users\Bert\AutoIt3.My\Temp\aa.au3 - 24 error(s), 1 warning(s)
!>12:16:51 AU3Check ended. Press F4 to jump to next error.rc:2
+>12:16:51 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 1.705

A general advice: func in func is not allowed in AutoIt. After solved this problem, solve the others (if there are some rest).

Link to comment
Share on other sites

  • Developers
1 hour ago, AutoBert said:

The console output shows you these errors:

Only when the full SciTE4AutoIt3 is installed, else F5 will simply run AutoIt3.exe. 

@sukendn , as suggested by @JLogan3o13, you need to download and install the full version of SciTE4AutoIt3 to enable au3check to run automatically and displaying potential errors.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hey guys , after several hours of tinkering , I 've revised code . The help you check me. Thanks

 

#include <ProgressConstants.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>
#Include <WinAPI.au3>
#include <Array.au3>
#include <ComboConstants.au3>
#include <StaticConstants.au3>
#include <Process.au3>
#include <ScrollBarConstants.au3>
#include <GuiEdit.au3>
 #include <InetConstants.au3>
 #include <ListviewConstants.au3>

Dim $adrivearray[100], $Var = False, $TempDir = @TempDir & "\"
Dim $aRegKeys[33]
Dim $drivearray[100]
Dim $MyServices
Dim $MyServicesList
$Form1 = GUICreate("Optimize v2.2.0 by OSTEAM | Áp dụng cho Windows 7 & WindowsXP", 611, 497, 190, 125)
$ListView1 = GUICtrlCreateListView(" | Service|Status | ", 8, 8, 460, 450, $LVS_NOSORTHEADER+$LVS_SINGLESEL,$LVS_EX_GRIDLINES )
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 25)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 200)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150)
$opt = GUICtrlCreateButton("Optimize", 470, 68, 133, 59)
$msconfig = GUICtrlCreateButton("Msconfig", 470, 131, 133, 59)
$driver = GUICtrlCreateButton("Device Manager", 470, 193, 133, 59)
$chkdsk = GUICtrlCreateButton("Check Disk", 470, 255, 133, 59)
$chip = GUICtrlCreateButton("3D Chip", 470, 316, 133, 59)
$hwinfo = GUICtrlCreateButton(" Hardware", 470, 377, 133, 59)
$testcpu = GUICtrlCreateButton("TEST CPU - VGA ", 470, 437, 133, 59)
$ktra = GUICtrlCreateButton("Check Services", 470, 7, 133, 59)
$Progress1 = GUICtrlCreateProgress(8, 460, 460, 33)
GUISetState(@SW_SHOW, $Form1)

      $MyServices = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
      $MyServicesList = $MyServices.ExecQuery("SELECT * FROM Win32_Service")

While 1
      Switch GUIGetMsg()

Case $ktra
     SplashTextOn("Thông báo", "Đang kiểm tra....", 400, 60, -1, -1, 1, "Tahoma", 24)
   ;----Windows Update---------------------
$myServiceQuery = "Windows Update"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" &  $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
;----Computer Browser-----
$myServiceQuery = "Computer Browser"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Bluetooth Support Service-----
$myServiceQuery = "Bluetooth Support Service"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----DHCP Client-----
$myServiceQuery = "DHCP Client"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Google Update Service (gupdate)-----
$myServiceQuery = "Google Update Service (gupdate)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Google Update Service (gupdatem)-----
$myServiceQuery = "Google Update Service (gupdatem)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Print Spooler-----
$myServiceQuery = "Print Spooler"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Skype Update-----
$myServiceQuery = "Skype Update"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Disk Defragmenter-----
$myServiceQuery = "Disk Defragmenter"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Desktop Window Manager Session Manager-----
$myServiceQuery = "Desktop Window Manager Session Manager"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Task Scheduler-----
$myServiceQuery = "Task Scheduler"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
    ;----UPnP Device Host-----
$myServiceQuery = "UPnP Device Host"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
      ;----Windows Defender-----
$myServiceQuery = "Windows Defender"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
          ;----Windows Firewall XP-----
$myServiceQuery = "Windows Firewall/Internet Connection Sharing (ICS)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
      ;----Windows Firewall-----
$myServiceQuery = "Windows Firewall"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
      ;----Windows Search-----
$myServiceQuery = "Windows Search"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----WLAN AutoConfig-----
$myServiceQuery = "WLAN AutoConfig"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Automatic Updates WinXP-----
$myServiceQuery = "Automatic Updates"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Wireless Zero Configuration WinXP-----
$myServiceQuery = "Wireless Zero Configuration"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----Windows FireWall/Internet Connection Sharing(ICS) WinXP-----
$myServiceQuery = "Windows FireWall/Internet Connection Sharing(ICS)"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;----QoS RSUP WinXP------
$myServiceQuery = "QoS RSUP"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;----Superfetch------
$myServiceQuery = "Superfetch"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;------WinHTTP Web Proxy Auto-Discovery Service
     $myServiceQuery = "WinHTTP Web Proxy Auto-Discovery Service"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
         ;------System Restore Xp
     $myServiceQuery = "System Restore Service"
    For $MyServices in $MyServicesList
        If $MyServices.DisplayName = $myServiceQuery Then
           GUICtrlCreateListViewItem("|" & $MyServices.DisplayName & "|" & $MyServices.State & "|" & "Services", $ListView1)
        EndIf
     Next
     ;------Visual Effects
$FW = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting")
If $FW = 0 Then
   $FW = "Let Windows choose what's best for my computer "
 EndIf
If $FW = 1 Then
   $FW = "Adjust for best appearance"
EndIf
If $FW = 2 Then
   $FW = "Adjust for best Performance "
EndIf
If $FW = 3 Then
   $FW = "Custom"
EndIf
GUICtrlCreateListViewItem("|" & "Visual Effects" & "|" & $FW & "|" & "System", $ListView1)

;---------PagingFiles--------
$FW1 = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management", "PagingFiles")
If $FW1 = "?:\pagefile.sys" Then
   $FW1 = "Automatically manage paging file size for all drivers"
EndIf
If $FW1 = "c:\pagefile.sys 4096 4096" Then
   $FW1 = "Custom Size :C:\4096 4096"
EndIf
If $FW1 = "c:\pagefile.sys 0 0" Then
   $FW1 = "System manged size"
EndIf
If $FW1 = "" Then
   $FW1 = "C:\None"
EndIf
 GUICtrlCreateListViewItem("|" & "Paging Files" & "|" & $FW1 & "|" & "System", $ListView1)

;---------Automatically restart----
$FW2 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl", "AutoReboot")
If $FW2 = 0 Then
   $FW2 = "Disable"
EndIf
If $FW2 = 1 Then
   $FW2 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "Automatically restart" & "|" & $FW2 & "|" & "System", $ListView1)
;---------Write debugging infomation----
$FW4 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl", "CrashDumpEnabled")
If $FW4 = 0 Then
   $FW4 = "(None)"
EndIf
If $FW4 = 3 Then
   $FW4 = "Small memory dump (256KB)"
EndIf
If $FW4 = 2 Then
   $FW4 = "Kernel memory dump"
EndIf
GUICtrlCreateListViewItem("|" & "Write debugging infomation" & "|" & $FW4 & "|" & "System", $ListView1)
;---------Write an event to the system log----
$FW5 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl", "LogEvent")
If @OSArch = "X64" Then
   EndIf
If $FW5 = 0 Then
   $FW5 = "Disable"
EndIf
If $FW5 = 1 Then
   $FW5 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "Write an event to the system log" & "|" & $FW5 & "|" & "System", $ListView1)
;---------ComputerRestore----
If @OSVersion = "WIN_7" Then
$FW3 = RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore", "RPSessionInterval")

If @OSArch = "X64" Then
   EndIf
If $FW3 = 0 Then
   $FW3 = "Disable"
EndIf
If $FW3 = 1 Then
   $FW3 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "System Restore" & "|" & $FW3 & "|" & "System", $ListView1)
EndIf
;---------ComputerRestore XP----
If @OSVersion = "WIN_XP" Then
$FW6 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore", "DisableSR")
If $FW6 = 0 Then
   $FW6 = "Disable"
EndIf
If $FW6 = 1 Then
   $FW6 = "Enable"
EndIf
GUICtrlCreateListViewItem("|" & "System Restore" & "|" & $FW6 & "|" & "System", $ListView1)
EndIf
SplashOff()
       ;--------------------
    Case $opt
       SplashTextOn("Thông báo", "Đang Optimize....", 400, 60, -1, -1, 1, "Tahoma", 24)
  Local $sService,$sCMD,$xCMD,$vCMD,$sListService=StringSplit("wuauserv|AMD External Events Utility|AMD FUEL Service|amdacpusrsvc|NVSvc|FontCache3.0.0.0|WPFFontCache_v0400|NvNetworkService|GfExperienceService|NvStreamSvc|WajaIntEn Monitor|PnkBstrA|AMD External Events Utility|odserv|idsvc|MozillaMaintenance|Stereo Service|nvsvc|igfxCUIService1.0.0.0|ICCS|cphs|LMS|jhi_service|Intel(R) Capability Licensing Service TCP IP Interface|Intel(R) Capability Licensing Service Interface|WinHttpAutoProxySvc|SysMain|MpsSvc|WSearch|WinDefend|gupdate|gupdatem|UxSms|BstHdUpdaterSvc|defragsvc|Browser|upnphost|Schedule|TabletInputService|Wlansvc|bthserv|srservice|uxsms|WZCSVC|SharedAccess","|")
For $i=1 to UBound($sListService)-1
    $sService=$sListService[$i]
      GUICtrlSetData($Progress1,$i*3)
    ConsoleWrite(">! Stoping service: "&$sService&@CRLF)
    RunWait('"'&@ComSpec&'" /c sc config "'&$sService&'" start= Disabled',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c sc stop "'&$sService&'"',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c net stop "'&$sService&'"',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c sc config Dhcp start= auto',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c net start Dhcp',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c wmic recoveros set AutoReboot = False',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c wmic recoveros set WriteToSystemLog = False',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c wmic recoveros set DebugInfoType = 0',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c schtasks /delete /tn * /f',@SystemDir,@SW_HIDE)
    RunWait('"'&@ComSpec&'" /c bcdedit /timeout 0',@SystemDir,@SW_HIDE)
    ConsoleWrite($sService&" disabled."&@CRLF)

 Next


;-----------------------------VisualEffects
Local $sRegKey = "\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects"
If @OSArch = "X64" Then
    $sRegKey = "HKCU64" & $sRegKey
Else
    $sRegKey = "HKCU" & $sRegKey
EndIf
RegWrite($sRegKey, "VisualFXSetting", "REG_DWORD", "2")

;-----------------------------ComputerRestore
Local $sRegKey = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey
EndIf
RegWrite($sRegKey, "RPSessionInterval", "REG_DWORD", "0")

;-----------------------------ComputerRestore
Local $sRegKey = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

    EndIf
RegDelete($sRegKey)

;-----------------------------ComputerRestore
Local $sRegKey = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

    EndIf
RegWrite($sRegKey)

;-----------------------------PagingFiles
Local $sRegKey = "\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "PagingFiles", "REG_MULTI_SZ", "C:\pagefile.sys 4096 4096")

;-----------------------------UAC
Local $sRegKey = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "EnableLUA", "REG_DWORD", "0")

;-----------------------------USB Root Hub Power Management
Local $sRegKey = "\HKLM\SYSTEM\CurrentControlSet\Services\USB"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "DisableSelectiveSuspend", "REG_DWORD", "1")

;-----------------------------Task Scheduler
Local $sRegKey = "\SYSTEM\CurrentControlSet\services\Schedule"
If @OSArch = "X64" Then
    $sRegKey = "HKLM64" & $sRegKey
Else
    $sRegKey = "HKLM" & $sRegKey

EndIf
RegWrite($sRegKey, "Start", "REG_DWORD", "3")

;-----------------------------Msconfig

    $aRegKeys[0] = "IMJPMIG"
    $aRegKeys[1] = "CocCoc Update"
    $aRegKeys[2] = "Intel(R) Common User Interface"
    $aRegKeys[3] = "Java Platform SE Auto Updater"
    $aRegKeys[4] = "IgfxTray"
    $aRegKeys[5] = "HotKeysCmds"
    $aRegKeys[6] = "Vmware User process"
    $aRegKeys[7] = "ImScInst"
    $aRegKeys[8] = "hkcmd"
    $aRegKeys[9] = "igfxpers"
    $aRegKeys[10] = "StartCCC"
    $aRegKeys[11] = "USB3MON"
    $aRegKeys[12] = "CuHanhPlay"
    $aRegKeys[13] = "SynTPEnh"
    $aRegKeys[14] = "Quicktime Task"
    $aRegKeys[15] = "iTunesHelper"
    $aRegKeys[16] = "NvBackend"
    $aRegKeys[17] = "NvMctray"
    $aRegKeys[18] = "Persistence"
    $aRegKeys[19] = "SunJavaUpdateSched"
    $aRegKeys[20] = "ctfmon.exe"
    $aRegKeys[21] = "NvCpl"
    $aRegKeys[22] = "TINTSETP"
    $aRegKeys[23] = "jusched"
    $aRegKeys[24] = "CocCoc"
    $aRegKeys[25] = "IMEKRMIG"
    $aRegKeys[26] = "CCleaner Monitoring"
    $aRegKeys[27] = "Google Update"
    $aRegKeys[28] = "ShadowPlay"
    $aRegKeys[29] = "AppEx Accelerator UI"
    $aRegKeys[30] = "StartCN"
    $aRegKeys[31] = "DFX"
    $aRegKeys[32] = "Raptr"


    ; Loop to delete startup registry keys
    #requireAdmin
    For $g = 0 To UBound($aRegKeys) - 1
        RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        RegRead("HKLM64\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        If @error <> 0 Then
            ; do nothing
        Else
            For $r = 0 To UBound($aRegKeys) - 1
                RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                RegDelete("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                RegDelete("HKLM64\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                Sleep(100)
            Next
        EndIf
     Next
         ; Loop to delete startup registry keys
    For $g = 0 To UBound($aRegKeys) - 1
        RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        RegRead("HKCU64\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$g])
        If @error <> 0 Then
            ; do nothing
        Else
            For $r = 0 To UBound($aRegKeys) - 1
                RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                RegDelete("HKCU64\Software\Microsoft\Windows\CurrentVersion\Run", $aRegKeys[$r])
                Sleep(100)
            Next
        EndIf
     Next
     SplashOff()
;-----------------------------MsgBox
MsgBox($MB_SYSTEMMODAL, "Hoàn thành", "Hoàn thành !")
;---------------------------
Case $msconfig
#requireadmin
DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
ShellExecute('msconfig.exe', -4) ; << 4 = which tab to display
DllCall("kernel32.dll", "int", "Wow64EnableWow64FsRedirection", "int", 1)
RegDelete("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "MSConfig") ; << stops the message after reboot
 ;--------------- Device Manager----------
 Case $driver
    Run(@ComSpec & " /c " & 'devmgmt.msc', "", @SW_HIDE)
 ;----------------Check Disk-------------
 Case $chkdsk
    Run(@ComSpec & " /c " & 'cmd.exe', "",  @SW_SHOW)
    ;-------3DP Chip
 Case $chip
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/3DPChip.exe", @TempDir & "\3DPChip.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  Do
       Sleep(250)
    Until InetGetInfo($Download, $INET_DOWNLOADCOMPLETE)
ShellExecute(@tempdir & "\3DPChip.exe")
    ;--------Info hardware
 Case $hwinfo
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/Speccy.exe", @TempDir & "\Speccy.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  Do
       Sleep(250)
    Until InetGetInfo($Download, $INET_DOWNLOADCOMPLETE)
ShellExecute(@tempdir & "\Speccy.exe")
;--------Test Cpu & VGA
 Case $testcpu
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/ORTHOS.exe", @TempDir & "\ORTHOS.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
 Sleep (250)
$Download=InetGet("https://googledrive.com/host/0B8kF-2k17yfIaEFpT2YzWHlRRms/worker.dll", @TempDir & "\worker.dll", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  Do
       Sleep(500)
    Until InetGetInfo($Download, $INET_DOWNLOADCOMPLETE)
ShellExecute(@tempdir & "\ORTHOS.exe")
Case $GUI_EVENT_CLOSE
If FileExists($TempDir & "CheckDisk.exe") Then
FileDelete($TempDir & "CheckDisk.exe")
EndIf
If FileExists($TempDir & "3DP_Chip.exe") Then
FileDelete($TempDir & "3DP_Chip.exe")
EndIf
If FileExists($TempDir & "Speccy.exe") Then
FileDelete($TempDir & "Speccy.exe")
EndIf
If FileExists($TempDir & "ORTHOS.exe") Then
FileDelete($TempDir & "ORTHOS.exe")
EndIf
If FileExists($TempDir & "worker.dll") Then
FileDelete($TempDir & "worker.dll")
EndIf
Exit
EndSwitch
WEnd

 

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