本帖最后由 sanmoking 于 2009-10-25 02:04 编辑 $fini = @TempDir&"\d.ini"
_test()
_last()
FileDelete($fini)
Func _test()
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colDiskDrives = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive")
For $objDrive In $colDiskDrives
$strDeviceID = StringReplace($objDrive.DeviceID, "", "\")
$colPartitions = $objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & $strDeviceID & """} WHERE AssocClass = Win32_DiskDriveToDiskPartition")
IniWrite ($fini, "磁盘","磁盘列表",IniRead($fini, "磁盘","磁盘列表","")&StringRight ($strDeviceID,1))
IniWrite ($fini, "磁盘","HD"&StringRight ($strDeviceID,1),$objDrive.Caption)
For $objPartition In $colPartitions
$colLogicalDisks = $objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & $objPartition.DeviceID & """} WHERE AssocClass = Win32_LogicalDiskToPartition")
For $objLogicalDisk In $colLogicalDisks
IniWrite ($fini, "磁盘",$objDrive.Caption,IniRead($fini, "磁盘",$objDrive.Caption,"")&StringReplace($objLogicalDisk.DeviceID, ":", ""))
Next
Next
Next
EndFunc
Func _last()
$dd = IniRead($fini,"磁盘","磁盘列表","")
$yingpanshu = StringLen($dd) ;磁盘数目
$ttt=""
for $i = 1 to $yingpanshu
$yingpanxuhao = "HD"&StringMid($dd,$i,1);磁盘序号
$yingpanname=IniRead($fini,"磁盘",$yingpanxuhao,"") ;磁盘名称
$yingpanfenqu=IniRead($fini,"磁盘",$yingpanname,"") ;磁盘
$fenqushumu=StringLen($yingpanfenqu);分区数目
$lastfenqu=StringRight ($yingpanfenqu,1);最后一个分区
$ttt=$ttt&"磁盘【"&$yingpanxuhao&":"&$yingpanname&"】上有【"&$yingpanfenqu&"】共"&$fenqushumu&"个分区,最后一个分区是【"&$lastfenqu&"】。"&@CRLF
Next
MsgBox(0,"一共发现"&$yingpanshu&"块磁盘","一共发现"&$yingpanshu&"块磁盘,其中:"&@CRLF&$ttt)
EndFunc
隐藏分区算吗?
pusofalse 发表于 2009-10-25 01:30
如果仅仅是隐藏了盘符而显不出来,在地址栏输入盘符还能打开的那种隐藏,是可以识别的;
但是直接删除了盘符的那种隐藏(比如利用磁盘管理器删除某个分区的盘符),就没办法通过盘符的字母来识别了,因为根本就没有那个盘符的字母(C:D:E:……)怎么来识别。。。。。 |