本帖最后由 仙乃日 于 2010-7-12 10:26 编辑 #include <SetupApi.au3>
Remove_residual_drive()
Func Remove_residual_drive()
Local $root, $x, $hDevs, $tDevInfo, $ID1, $service, $Group, $Type, $EnID
$root = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root"
RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_PCIIDE", 1)
If @error = 0 Then
$EnID = "Root\LEGACY_PCIIDE\0000"
MsgBox(64, "", $EnID)
_SetupDiCreateDeviceDevs($EnID, $hDevs, $tDevInfo)
_SetupDiRemoveDevice($hDevs, $tDevInfo, True)
_SetupDiDestroyDeviceInfoList($hDevs)
EndIf
$x = 1
While 1
$ID1 = RegEnumKey($root, $x)
If @error <> 0 Then ExitLoop
If StringInStr($ID1, "LEGACY") Then
$service = StringTrimLeft($ID1, 7)
$Type = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & $service, "Type")
If $Type = 1 Then
$Group = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" & $service, "Group")
If $Group = "SCSI Miniport" Then
$EnID = "Root" & $ID1 & "\0000"
MsgBox(64, "", $EnID)
_SetupDiCreateDeviceDevs($EnID, $hDevs, $tDevInfo)
_SetupDiRemoveDevice($hDevs, $tDevInfo, True)
_SetupDiDestroyDeviceInfoList($hDevs)
EndIf
EndIf
EndIf
$x += 1
WEnd
EndFunc ;==>Remove_residual_drive
只能卸载一部份的残留驱动。 |