Le titre a tout dit
Gadget qui vient tout droit de la rubrique 'demande de scripts'
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#Include <Array.au3>
Global Const $MAX_DRIVERS = 1024
Global Const $MAX_DRIVER_NAME = 256
If @AutoItX64 Then
Global $LPVOID_SIZE = 8
Else
GLobal $LPVOID_SIZE = 4
EndIF
Global $tDriverArray = DllStructCreate("ptr[" & $MAX_DRIVERS & "]")
$iDriverCount = EnumDeviceDrivers()
Dim $array[1][3]
$n = 0
$total = 0
For $i=1 To $iDriverCount;-1
$driver = GetDeviceDriverBaseName(DllStructGetData($tDriverArray,1,$i))
$path = @systemdir & "\drivers\" & $driver
$company = FileGetVersion ($path, "CompanyName")
If $company = "" Then
$path = @systemdir & "\" & $driver
$company = FileGetVersion ($path, "CompanyName")
EndIf
If $company = "" Then
$path = "C" & StringRegExpReplace(GetDeviceDriverFileName(DllStructGetData($tDriverArray,1,$i)), '^(.*?)C', "")
$company = FileGetVersion ($path, "CompanyName")
EndIf
If not StringInStr($company, "Microsoft") Then
$n += 1
ReDim $array[$n][3]
$array[$n-1][0] = $driver
$array[$n-1][1] = $company
$array[$n-1][2] = Round(FileGetSize ($path)/1024) & " Ko"
$total += $array[$n-1][2]
EndIf
Next
ReDim $array[$n+2][3]
$array[$n+1][0] = $n & " drivers"
$array[$n+1][1] = "taille totale :"
$array[$n+1][2] = $total & " Ko"
_ArrayDisplay($array, "drivers système non Microsoft")
;-------------------------------------------------------------------------
Func EnumDeviceDrivers()
Local $tDriverNeeded = DllStructCreate("dword")
Local $Ret = DllCall("psapi.dll","int","EnumDeviceDrivers", _
"ptr",DllStructGetPtr($tDriverArray), _
"dword",DllStructGetSize($tDriverArray), _
"ptr",DllStructGetPtr($tDriverNeeded))
If @error OR NOT $Ret[0] Then
MsgBox(16,"PSAPI.DLL","Error calling EnumDeviceDrivers")
Exit
EndIf
Return DllStructGetData($tDriverNeeded,1)/$LPVOID_SIZE
EndFUnc
Func GetDeviceDriverBaseName(Const $pDriver)
Local $tDriverName = DllStructCreate("char[" & $MAX_DRIVER_NAME & "]")
Local $Ret = DllCall("psapi.dll","int","GetDeviceDriverBaseName", _
"ptr",$pDriver, _
"ptr",DllStructGetPtr($tDriverName), _
"dword",DllStructGetSize($tDriverName))
If @error OR NOT $Ret[0] Then
Return SetError(1,0,"")
EndIf
Return DllStructGetData($tDriverName,1)
EndFUnc
Func GetDeviceDriverFileName(Const $hDriver)
Local $tDriverPath = DllStructCreate("wchar[" & $MAX_DRIVERS & "]")
Local $Ret = DllCall('psapi.dll', 'int', 'GetDeviceDriverFileNameW', _
'ptr', $hDriver, _
'ptr', DllStructGetPtr($tDriverPath), _
'dword', DllStructGetSize($tDriverPath)) ;1024)
If (@error) Or (Not $Ret[0]) Then
Return SetError(1, 0, '')
EndIf
Return DllStructGetData($tDriverPath, 1)
EndFunc