::Delete Marvell drivers installed by DriverPacks.
::by fearless (updatedByAcheron)
::Requires MarvellCleanup.inf

:: WARNING: This script will indescriminately delete Marvell mass storage drivers
:: MV61XXMM, MV64XXMM, and MVXXMM.  
:: Referenced in this DriverPack by DPs_Fnshr (DPs_BASE or SAD3) via MassStorage.ini settings.

@Echo Off
TITLE MarvellCleanup by fearless (updatedByAcheron)
Setlocal EnableExtensions
Set name=%~n0
Set iniRoot=\Registry\Machine
Set regRoot=HKLM
Set key=\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_
Set subkey=0000 Control
Set subkey2=0000 LogConf
Set iniPerms="[1 8 17]"
Set initmp="%temp%\%name%.ini"
Set regdelarg=%iniRoot% %regRoot% %key% %iniPerms%
Call :regdel %regdelarg% MV61XXMM %subkey%
Call :regdel %regdelarg% MV61XXMM %subkey2%
Call :regdel %regdelarg% MV64XXMM %subkey%
Call :regdel %regdelarg% MV64XXMM %subkey2% 
Call :regdel %regdelarg% MVXXMM %subkey%
Call :regdel %regdelarg% MVXXMM %subkey2%
Del %initmp%
Pushd "%~dp0"
rundll32 setupapi,InstallHinfSection DefaultInstall 132 .\%name%.inf
Popd
goto :EOF

:regdel
::Use regini to give Administrators full control then delete the key.
Echo.%1%3%5 %~4>%initmp%
If "%~6" NEQ "" Echo.%1%3%5\%6 %~4>>%initmp% 
If "%~7" NEQ "" Echo.%1%3%5\%6\%7 %~4>>%initmp% 
If "%~8" NEQ "" Echo.%1%3%5\%6\%7\%8 %~4>>%initmp% 
If "%~9" NEQ "" Echo.%1%3%5\%6\%7\%8\%9 %~4>>%initmp% 
regini %initmp%
Reg Delete %2%3%5 /f
