Code : Tout sélectionner
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=admintool.ico
#AutoIt3Wrapper_outfile=pcadminstool.exe
#AutoIt3Wrapper_Res_Language=1036
#AutoIt3Wrapper_Res_File_Add=Win7.png, rt_rcdata, WINSEVEN
#AutoIt3Wrapper_Res_File_Add=WinOld.png, rt_rcdata, WINOLD
#AutoIt3Wrapper_Res_File_Add=AutreOS.png, rt_rcdata, AUTREOS
#AutoIt3Wrapper_Res_File_Add=WinXP.png, rt_rcdata, WINXP
#AutoIt3Wrapper_Res_File_Add=WinVista.png, rt_rcdata, WINVISTA
#AutoIt3Wrapper_Res_File_Add=WinServer.png, rt_rcdata, WINSERVER
#AutoIt3Wrapper_Res_File_Add=USB.png, rt_rcdata, USB
#AutoIt3Wrapper_Res_File_Add=HDD.png, rt_rcdata, HDD
#AutoIt3Wrapper_Res_File_Add=Disk.png, rt_rcdata, DISK
#AutoIt3Wrapper_Res_File_Add=WiFi.png, rt_rcdata, WIFI
#AutoIt3Wrapper_Res_File_Add=Processus.png, rt_rcdata, PROCESSUS
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include "Fonctions.au3"
#include "usbEvent.au3"
#include "resources.au3"
#include "Wifi33b.au3"
#include "UDF_Graphique3D.au3"
#Region ### START Koda GUI section ### Form=C:\Users\Romain\Documents\PC Admin Tool\GUI.kxf
Global $version_show = 0.2
Global $version = 0.2
RegWrite("HKLM\Software\PC Admin's Tool","version","REG_SZ",$version)
FileDelete("update.ini")
Global $versionreg = RegRead("HKLM\Software\PC Admin's Tool","version")
InetGet("http://rl77luc.kodingen.com/pat/update.ini",@ScriptDir & "\update.ini",1)
Global $versionupd = IniRead("update.ini","PCAdmTool","version","")
Global $typeupd = IniRead("update.ini","PCAdmTool","maj","")
If ($versionupd > $versionreg) Then
If ($typeupd = "majeur") Then
MsgBox(48,"Mise à jour disponible","Une nouvelle mise à jour est disponible !" & @CRLF & "Cette mise à jour est une mise à jour importante." & @CRLF & "Votre version : " & $versionreg & @CRLF & "Version disponible : " & $versionupd)
Else
MsgBox(64,"Mise à jour disponible","Une nouvelle mise à jour est disponible !" & @CRLF & "Cette mise à jour est une mise à jour mineure." & @CRLF & "Votre version : " & $versionreg & @CRLF & "Version disponible : " & $versionupd)
EndIf
EndIf
$ram = MemGetStats()
Global $sys = @SystemDir
Global $disksys = StringMid($sys,1,2)
Global $Form1 = GUICreate("PC Admin Tool " & $version_show, 986, 386, 192, 124)
Global $Group1 = GUICtrlCreateGroup("Gestion disque système (" & $disksys & " )", 8, 8, 401, 113)
Global $Label1 = GUICtrlCreateLabel("Espace libre :", 24, 32, 68, 17)
Global $diskfree = DriveSpaceFree($disksys)
Global $gbfree = round($diskfree / 1000, 1)
Global $disktotal = DriveSpaceTotal($disksys)
Global $gbtotal = round($disktotal / 1000, 1)
Global $gboccup = $gbtotal - $gbfree
Global $nomdisk = DriveGetLabel($disksys)
Global $sysfile = DriveGetFileSystem($disksys)
If $nomdisk = "" Then
$nomdisk = "Disque local"
EndIf
Global $percentdisk = $gbfree * 100 / $gbtotal
Global $percentoccupb = $percentdisk - 100
Global $percentoccup = round($percentoccupb - $percentoccupb * 2,2)
Global $Label2 = GUICtrlCreateLabel($gbfree & " GB", 96, 32, 46, 17)
Global $Label3 = GUICtrlCreateLabel("Espace total :", 24, 48, 69, 17)
Global $Label4 = GUICtrlCreateLabel($gbtotal & " GB", 96, 48, 46, 17)
Global $Label5 = GUICtrlCreateLabel("Espace occupé : ", 168, 32, 88, 17)
Global $Label6 = GUICtrlCreateLabel($gboccup & " GB", 256, 32, 46, 17)
Global $Label7 = GUICtrlCreateLabel("Nom du disque :", 168, 48, 84, 17)
Global $Label8 = GUICtrlCreateLabel($nomdisk, 256, 48, 75, 37)
Global $Label9 = GUICtrlCreateLabel("Système de fichiers : ", 24, 64, 104, 17)
Global $Label10 = GUICtrlCreateLabel($sysfile, 128, 64, 47, 17)
Global $Progress1 = GUICtrlCreateProgress(24, 88, 369, 17, $PBS_SMOOTH)
Global $Pic1 = PngGuiCreatePic("HDD.png", 344, 24)
_ResourceSetImageToCtrl($Pic1, "HDD")
Global $Pic2 = PngGUICreatePic("Disk.png", 345, 152)
_ResourceSetImageToCtrl($Pic2, "DISK")
GuiCtrlSetData($Progress1,$percentoccup)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group2 = GUICtrlCreateGroup("Détections disques", 8, 128, 401, 89)
Global $Button1 = GUICtrlCreateButton("Disques durs", 24, 152, 153, 25, $WS_GROUP)
Global $Button2 = GUICtrlCreateButton("Disques amovibles", 184, 152, 153, 25, $WS_GROUP)
Global $Button3 = GUICtrlCreateButton("Disques réseau", 24, 184, 153, 25, $WS_GROUP)
Global $Button4 = GUICtrlCreateButton("Lecteurs de CD", 184, 184, 153, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Button5 = GUICtrlCreateButton("A propos", 24, 352, 153, 25, $WS_GROUP)
Global $Group3 = GUICtrlCreateGroup("Système d'exploitation (OS)", 416, 8, 233, 113)
Global $Label11 = GUICtrlCreateLabel("Code de version :", 432, 32, 87, 17)
Global $Label12 = GUICtrlCreateLabel(@OSVersion, 520, 32, 41, 17)
Global $Label13 = GUICtrlCreateLabel("Type d'OS :", 432, 48, 87, 17)
Global $Label14 = GUICtrlCreateLabel(@OSType, 520, 48, 47, 17)
Global $Label15 = GUICtrlCreateLabel("Service Pack :", 432, 64, 86, 17)
Global $Label16 = GUICtrlCreateLabel(@OSServicePack, 520, 64, 75, 17)
Global $Label17 = GUICtrlCreateLabel("N° de version :", 432, 80, 86, 17)
Global $Label18 = GUICtrlCreateLabel(@OSBuild, 520, 80, 36, 17)
Global $Label19 = GUICtrlCreateLabel("Architecture :", 432, 96, 85, 17)
Global $Label20 = GUICtrlCreateLabel(Archi(), 520, 96, 58, 17)
If (@OSVersion = "WIN_XP") Then
Global $Pic3 = PngGuiCreatePic("WinXP.png", 600, 24)
_ResourceSetImageToCtrl($Pic3, "WINXP")
ElseIf (@OSVersion = "WIN_VISTA") Then
Global $Pic3 = PngGuiCreatePic("WinVista.png", 600, 24)
_ResourceSetImageToCtrl($Pic3, "WINVISTA")
ElseIf (@OSVersion = "WIN_7") Then
Global $Pic3 = PngGuiCreatePic("Win7.png", 600, 24)
_ResourceSetImageToCtrl($Pic3, "WINSEVEN")
ElseIf ((@OSVersion = "WIN_2003") OR (@OSVersion = "WIN_2008")) Then
Global $Pic3 = PngGuiCreatePic("WinServer.png", 600, 24)
_ResourceSetImageToCtrl($Pic3, "WINSERVER")
ElseIf ((@OSVersion = "WIN_95") OR (@OSVersion = "WIN_98") OR (@OSVersion = "WIN_ME") OR (@OSVersion = "WIN_2000") OR (@OSVersion = "WIN_NT4")) Then
Global $Pic3 = PngGuiCreatePic("WinOld.png", 600, 24)
_ResourceSetImageToCtrl($Pic3, "WINOLD")
Else
Global $Pic3 = PngGuiCreatePic("AutreOS.png", 600, 24)
_ResourceSetImageToCtrl($Pic3, "AUTREOS")
EndIf
Global $Pic4 = PngGuiCreatePic("USB.png", 600, 152)
_ResourceSetImageToCtrl($Pic4, "USB")
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group4 = GUICtrlCreateGroup("Contrôle des clés USB", 416, 128, 233, 89)
Global $Button6 = GUICtrlCreateButton("Activer le contrôle", 432, 152, 137, 25, $WS_GROUP)
Global $Button7 = GUICtrlCreateButton("Désactiver le contrôle", 432, 184, 137, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Button8 = GUICtrlCreateButton("Mise à jour", 184, 352, 153, 25, $WS_GROUP)
Global $Group5 = GUICtrlCreateGroup("Gestion WiFi", 656, 8, 321, 113)
Global $Label21 = GUICtrlCreateLabel("Carte réseau :", 672, 32, 70, 17)
Global $hClientHandle = _Wlan_OpenHandle()
Global $Enum = _Wlan_EnumInterfaces($hClientHandle)
If IsArray($Enum) Then
Global $Label22 = GUICtrlCreateLabel($Enum[0][1], 744, 32, 150, 27)
_Wlan_SetGlobalConstants($hClientHandle, $Enum[0][0])
_Wlan_Scan(-1, -1)
$AvailNet = _Wlan_GetAvailableNetworkList(-1, -1, 0)
$asProfileList = _Wlan_GetProfileList(-1, -1)
Global $Label22 = GUICtrlCreateLabel($Enum[0][1], 744, 32, 150, 27)
Global $Label23 = GUICtrlCreateLabel("Meilleur réseau : ", 672, 64, 84, 17)
Global $Label24 = GUICtrlCreateLabel($AvailNet[0][0], 752, 64, 100, 17)
Global $Label25 = GUICtrlCreateLabel("Connexion favorite :", 672, 80, 98, 17)
Global $Label26 = GUICtrlCreateLabel($asProfileList[0], 768, 80, 76, 17)
Else
Global $Label22 = GUICtrlCreateLabel("Indisponible", 744, 32, 150, 27)
;~ _Wlan_SetGlobalConstants($hClientHandle, $Enum[0][0])
;~ _Wlan_Scan(-1, -1)
;~ $AvailNet = _Wlan_GetAvailableNetworkList(-1, -1, 0)
;~ $asProfileList = _Wlan_GetProfileList(-1, -1)
Global $Label23 = GUICtrlCreateLabel("Meilleur réseau : ", 672, 64, 84, 17)
Global $Label24 = GUICtrlCreateLabel("Indisponible", 752, 64, 100, 17)
Global $Label25 = GUICtrlCreateLabel("Connexion favorite :", 672, 80, 98, 17)
Global $Label26 = GUICtrlCreateLabel("Indisponible", 768, 80, 76, 17)
EndIf
Global $Pic5 = PngGuiCreatePic("WiFi.png", 912, 24)
_ResourceSetImageToCtrl($Pic5, "WIFI")
Global $Label27 = GUICtrlCreateLabel("Adresse IP :", 672, 96, 61, 17)
Global $Label28 = GUICtrlCreateLabel(@IPAddress1, 732, 96, 90, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group6 = GUICtrlCreateGroup("Gestion des processus", 656, 128, 321, 121)
Global $List1 = GUICtrlCreateList("", 672, 152, 121, 84)
Global $ListProcess = ProcessList()
for $i = 3 to $ListProcess[0][0]
GuiCtrlSetData($List1, $ListProcess[$i][0])
next
Global $Pic6 = PngGuiCreatePic("Processus.png", 912, 144)
_ResourceSetImageToCtrl($Pic6, "PROCESSUS")
Global $Button9 = GUICtrlCreateButton("Tuer le processus", 800, 152, 105, 25, $WS_GROUP)
Global $Button10 = GUICtrlCreateButton("Pause", 800, 184, 49, 25, $WS_GROUP)
Global $Button11 = GUICtrlCreateButton("Reprise", 856, 184, 49, 25, $WS_GROUP)
Global $Button12 = GUICtrlCreateButton("Actualiser", 800, 216, 105, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Button13 = GUICtrlCreateButton("Notes de version", 344, 352, 153, 25, $WS_GROUP)
Global $Group7 = GUICtrlCreateGroup("Mémoire vive (RAM)", 8, 224, 641, 121)
Global $Label29 = GUICtrlCreateLabel("Mémoire disponible : ", 24, 248, 103, 17)
Global $Label30 = GUICtrlCreateLabel(Round($ram[1] / 1000000,0) & " Go", 128, 248, 85, 17)
Global $Label31 = GUICtrlCreateLabel("Mémoire occupée :", 24, 264, 95, 17)
Global $Label32 = GUICtrlCreateLabel(Round($ram[1] / 1000000,0) - Round($ram[2] / 1000000,2) & " Go", 118, 264, 58, 17)
Global $Label33 = GUICtrlCreateLabel("Mémoire libre :", 24, 280, 72, 17)
Global $Label34 = GUICtrlCreateLabel(Round($ram[2] / 1000000,2) & " Go", 96, 280, 56, 17)
Global $Graph = _GUICtrlCreateGraphic3D($Form1, 224, 237, 329, 100)
AdlibRegister("_UpdateRamStats", 750)
GUICtrlCreateGroup("", -99, -99, 1, 1)
If ($versionupd > $versionreg) Then
GuiCtrlSetState($Button8, $GUI_ENABLE)
Else
GuiCtrlSetState($Button8, $GUI_DISABLE)
EndIf
GUISetState(@SW_SHOW, $Form1)
#EndRegion ### END Koda GUI section ###
_GUICtrlAjouterValeur($Graph, 50)
_GUICtrlAjouterValeur($Graph, 20)
_GUICtrlAjouterValeur($Graph, 30)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_DetectDrive("FIXED")
Case $Button2
_DetectDrive("REMOVABLE")
Case $Button3
_DetectDrive("NETWORK")
$var = DriveGetDrive("NETWORK")
MsgBox(0,"Disques","" & $var[0] & "")
Case $Button4
_DetectDrive("CDROM")
Case $Button5
MsgBox(64, "A propos", "PC Admin's Tool " & $version & @CRLF & "Codé par RL77LUC." & @CRLF & "2011, RL77LUC Corp.")
Case $Button6
_USBEvent_Start("SignaleUSB")
Case $Button7
_USBEvent_Stop()
Case $Button8
Run("ModuleMAJ.exe")
Exit
Case $Button9
$processus = GuiCtrlRead($List1)
_NTKill($processus)
Sleep(300)
Global $ListProcess = ProcessList()
for $i = 3 to $ListProcess[0][0]
GuiCtrlSetData($List1, $ListProcess[$i][0])
next
Case $Button10
$processus = GuiCtrlRead($List1)
_NTProcess("NtSuspendProcess",$processus)
Sleep(300)
Global $ListProcess = ProcessList()
for $i = 3 to $ListProcess[0][0]
GuiCtrlSetData($List1, $ListProcess[$i][0])
next
Case $Button11
$processus = GuiCtrlRead($List1)
_NTProcess("NtResumeProcess",$processus)
Sleep(300)
Global $ListProcess = ProcessList()
for $i = 3 to $ListProcess[0][0]
GuiCtrlSetData($List1, $ListProcess[$i][0])
next
Case $Button12
Global $ListProcess = ProcessList()
for $i = 3 to $ListProcess[0][0]
GuiCtrlSetData($List1, $ListProcess[$i][0])
next
Case $Button13
If Not FileExists("Changelog.exe") Then
InetGet("http://rl77luc.kodingen.com/pat/Changelog.exe","Changelog.exe")
If Not FileExists("Changelog.exe") Then
MsgBox(16,"Changelog indisponible","Il est actuellement impossible de télécharger le module de notes de version.")
EndIf
Else
Run("Changelog.exe")
EndIf
EndSwitch
WEnd
Func _DetectDrive($type)
$var = DriveGetDrive($type)
If NOT @error Then
MsgBox(4096,"Disques", "Trouvé " & $var[0] & " disques")
For $i = 1 to $var[0]
MsgBox(4096,"Disque " & $i, "Disque " & $i & " : ''" & $var[$i] & "''")
Next
EndIf
EndFunc
Func _UpdateRamStats()
$ram = MemGetStats()
GuiCtrlSetData($label32, Round($ram[1] / 1000000,0) - Round($ram[2] / 1000000,2) & " Go")
GuiCtrlSetData($label34, Round($ram[2] / 1000000,2) & " Go")
EndFunc