#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_outfile=本地硬盘信息.exe
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <SetupApi.au3>
Dim $hDevs, $tDevIfInfo, $tDevInfo, $sDevicePath, $iMask
Dim $sDescr, $iIndex, $tBuffer, $iPhysSize, $sResult
$tBuffer = DllStructCreate("int64 PhysicalSize")
$iMask = bitOR($DIGCF_PRESENT, $DIGCF_DEVICEINTERFACE)
$hDevs = _SetupDiGetClassDevs($iMask, $GUID_DEVINTERFACE_DISK)
$iMask = bitOR($GENERIC_READ, $GENERIC_WRITE)
While _SetupDiEnumDeviceInterfaces($hDevs, 0, $GUID_DEVINTERFACE_DISK, $iIndex, $tDevIfInfo)
$iIndex += 1
$sDevicePath = _SetupDiGetDeviceInterfaceDetail($hDevs, $tDevIfInfo, $tDevInfo)
$sDescr = _SetupDiGetDeviceRegistryProperty($hDevs, $tDevInfo, 0xC)
If $sDescr = "" Then
$sDescr = _SetupDiGetDeviceRegistryProperty($hDevs, $tDevInfo, 0)
EndIf
$hFile = _CM_Create_File($sDevicePath, $iMask, 3, 0, 3, 0)
_CM_Device_IO_Control($hFile, 0x7405C, 0, 0, $tBuffer, 8)
_CM_Close_Handle($hFile)
$iPhysSize = DllStructGetData($tBuffer, "PhysicalSize") / 1024 / 1024
$sResult &= $sDescr & @Tab & Round($iPhysSize/954, 1) & " GB" & @CRLF
WEnd
_SetupDiApiBufferFree($tBuffer)
_SetupDiApiBufferFree($tDevInfo)
_SetupDiApiBufferFree($tDevIfInfo)
_SetupDiDestroyDeviceInfoList($hDevs)
IniWrite(@ScriptDir & "\空间.txt", "本地硬盘信息" , "", $sResult )
$cppf = DriveGetDrive("FIXED")
$sum=0
If Not @error Then
For $i = 1 To $cppf[0]
Local $pf,$dif
$begin = TimerInit()
$pf = $cppf[$i]
$kj = DriveSpaceTotal($pf & "") /954
$dif = TimerDiff($begin)
$kjz=Int($kj)
IniWrite(@ScriptDir & "\空间.txt", "磁盘空间" , $pf & "盘 全部空间为: ", $kjz &"GB")
$sum=$sum+$kj
Next
$sum1=Int($sum)
IniWrite(@ScriptDir & "\空间.txt", "磁盘空间" , "全部空间为: ", $sum1 &"GB")
EndIf
TrayTip("单击确定查看详细数据!","详细数据在此程序目录下的空间.txt中!",30,1)
$var=Msgbox(0, "本地硬盘信息:", $sResult)
If $var=1 Then
ShellExecute("空间.txt","",@ScriptDir)
EndIf