|
楼主 |
发表于 2008-12-19 10:19:03
|
显示全部楼层
wmi 不能在PE环境下运行啦
所以还是需要dll的。。。 0 0
我用wmi 的确能读取到,但一些环境的确不能运行dll 所以 还请居士大大帮下忙
WMI 部分
[au3]Func GetPartionMsg()
$1 = 0
$2 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum", "Count")
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colDiskDrives = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive")
For $objDrive In $colDiskDrives ;这里对硬盘的查询是倒序的,所以生成的“Partition.ini”中的硬盘也是倒序罗列的,这就要求主界面初始化 ListView 时最好倒序读取“Partition.ini”中的字段名。
$strDeviceID = StringReplace($objDrive.DeviceID, "\", "\\")
$colPartitions = $objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & _
$strDeviceID & """} WHERE AssocClass = " & _
"Win32_DiskDriveToDiskPartition")
For $objPartition In $colPartitions
$colLogicalDisks = $objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _
$objPartition.DeviceID & """} WHERE AssocClass = " & _
"Win32_LogicalDiskToPartition")
For $objLogicalDisk In $colLogicalDisks
$1 = $1 + 1
;IniWrite(@AppDataDir & "\Ghost\97sky.ini", "HardDisk" & $2 & "_" & $objDrive.Caption, $objLogicalDisk.DeviceID, $objDrive.Index + 1 & ':' & $1)
IniWrite(@AppDataDir & "\Ghost\97sky.ini", "DiskList", $objLogicalDisk.DeviceID, $objDrive.Index + 1 & ':' & $1)
Next
Next
$2 = $2 - 1
$1 = 0
Next
ToolTip("")
EndFunc [/au3]
生成ini文件后 在读取
[au3]For $i = 1 To $var[0]
$fq = IniReadSection(@AppDataDir & "\Ghost\97sky.ini", $var[$i])
_ArraySort($fq)
If @error Then MsgBox(0, '', @error)
For $2 = 1 To $fq[0][0]
;_ArrayAdd($AllDrive[1],
$ac = DriveGetType($fq[$2][0] & "\")
$aas = DriveGetFileSystem($fq[$2][0] & "\")
$aad = Round(DriveSpaceTotal($fq[$2][0] & "\") / 1024, 2)
$aab = Round(DriveSpaceFree($fq[$2][0] & "\") / 1024, 2)
If $fq[$2][0] = @HomeDrive Then
$fq[$2][0] = $fq[$2][0] & "(系统)"
$itemX = GUICtrlCreateListViewItem($fq[$2][0] & "|" & $fq[$2][1] & "|" & $aas & "|" & $aad & "|" & $aab, $List1)
GUICtrlSetImage(-1, @AppDataDir & "\08.ico", 19)
Else
If $ac = "Removable" Then
$fq[$2][0] = $fq[$2][0] & "(U盘)"
$abcd = GUICtrlCreateListViewItem($fq[$2][0] & "|" & $fq[$2][1] & "|" & $aas & "|" & $aad & "|" & $aab, $List1)
GUICtrlSetImage(-1, @AppDataDir & "\005.ico", 19)
Else
$abcd = GUICtrlCreateListViewItem($fq[$2][0] & "|" & $fq[$2][1] & "|" & $aas & "|" & $aad & "|" & $aab, $List1)
GUICtrlSetImage(-1, @AppDataDir & "\32.ico", 19)
EndIf
EndIf
Next
Next[/au3]
[ 本帖最后由 lele9013 于 2008-12-19 10:47 编辑 ] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|