
@echo off
TITLE Creative Sound Blaster Audigy 5/Rx Driver UnInstallation
VER
ECHO Creative Sound Blaster Audigy 5/Rx Driver UnInstallation
DATE /T
TIME /T
SET /A UNINSTALLSTATUS = 0

:UNINSTALL64
ECHO UnInstalling 64bit drivers set ... 
echo "... %~dp0Support\I386\CTIOM32_SBA5Rx.exe"
"%~dp0Support\I386\CTIOM32_SBA5Rx.exe"

echo ...%~dp0Support\I386\CTIOM32.exe
"%~dp0Support\I386\CTIOM32.exe"

net stop audiosrv /y

echo ...%systemroot%\SysWOW64\killapps.exe
%systemroot%\SysWOW64\killapps.exe

echo ...%systemroot%\SysWOW64\UDAAIM64.exe /hidemsg /1: /u /s /g:{736EA663-603D-42fd-8C08-3209429F3C32}
%systemroot%\SysWOW64\UDAAIM64.exe /hidemsg /1: /u /s /g:{736EA663-603D-42fd-8C08-3209429F3C32}

echo ... regsvr32 /u /s %systemroot%\SysWOW64\CTDPROXY.dll
regsvr32 /u /s %systemroot%\SysWOW64\CTDPROXY.dll
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\SysWOW64\PIAPROXY.dll
regsvr32 /u /s %systemroot%\SysWOW64\PIAPROXY.dll
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\SysWOW64\CTDC0000.dll
regsvr32 /u /s %systemroot%\SysWOW64\CTDC0000.dll
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\SysWOW64\CTDC0001.dll
regsvr32 /u /s %systemroot%\SysWOW64\CTDC0001.dll
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\SysWOW64\CTDCIFCE.dll
regsvr32 /u /s %systemroot%\SysWOW64\CTDCIFCE.dll
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\SysWOW64\CTMMACTL.dll
regsvr32 /u /s %systemroot%\SysWOW64\CTMMACTL.dll
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\SysWOW64\UDAAPO32.DLL
regsvr32 /u /s %systemroot%\SysWOW64\UDAAPO32.DLL
rem timeout /T 1

rem echo ... regsvr32 /u /s %systemroot%\System32\PIAPROXY.dll
rem regsvr32 /u /s %systemroot%\System32\PIAPROXY.dll

echo ... regsvr32 /u /s %systemroot%\System32\CTDPXY64.dll
regsvr32 /u /s %systemroot%\System32\CTDPXY64.dll
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\System32\UDAAPO64.DLL
regsvr32 /u /s %systemroot%\System32\UDAAPO64.DLL
rem timeout /T 1

echo ... regsvr32 /u /s %systemroot%\System32\UDAPLD64.DLL
regsvr32 /u /s %systemroot%\System32\UDAPLD64.DLL
rem timeout /T 1

echo ... REGPLIB.exe /S /CLEAN
REGPLIB.exe /S /CLEAN

echo ...reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Creative Tech" /f
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Creative Tech" /f

echo ...reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" /v "CTHelper" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" /v "CTHelper" /f


rem del /F /Q %systemroot%\SysWOW64\CTDPROXY.dll
rem del /F /Q %systemroot%\SysWOW64\PIAPROXY.dll
rem del /F /Q %systemroot%\SysWOW64\CTDC00000.dll
rem del /F /Q %systemroot%\SysWOW64\CTDC00001.dll
rem del /F /Q %systemroot%\SysWOW64\CTDCIFCE.dll
rem del /F /Q %systemroot%\SysWOW64\CTMMACTL.dll
rem del /F /Q %systemroot%\SysWOW64\UDAAPO32.DLL

rem del /F /Q %systemroot%\SysWOW64\CT_OAL.dll
rem del /F /Q %systemroot%\SysWOW64\CT1MGM.ROM
rem del /F /Q %systemroot%\SysWOW64\CT2MGM.SF2
rem del /F /Q %systemroot%\SysWOW64\ctdaught.dat
rem del /F /Q %systemroot%\SysWOW64\ctdlang.dat
rem del /F /Q %systemroot%\SysWOW64\ctdnlstr.dat
rem del /F /Q %systemroot%\SysWOW64\ctasio.dll

rem del /F /Q %systemroot%\SysWOW64\kill.ini
rem del /F /Q %systemroot%\SysWOW64\killapps.exe
rem del /F /Q %systemroot%\SysWOW64\CTHELPER.exe

rem del /F /Q %systemroot%\System32\CTDPROXY.dll
rem del /F /Q %systemroot%\System32\PIAPROXY.dll
rem del /F /Q %systemroot%\System32\CTDPXY64.dll
rem del /F /Q %systemroot%\System32\UDAAPO64.DLL
rem del /F /Q %systemroot%\System32\UDAPLD64.DLL

rem del /F /Q %systemroot%\System32\regplib.exe
rem del /F /Q %systemroot%\System32\addcat.exe

rem del /F /Q %systemroot%\SysWOW64\regplib.exe
rem del /F /Q %systemroot%\SysWOW64\addcat.exe


rem %~dp0Support\I386\CTIOM32.exe

net start audiosrv /y

SET /A UNINSTALLSTATUS = 1
GOTO UNINSTALL_STATUS

:UNINSTALL_STATUS
IF %UNINSTALLSTATUS%==1 (GOTO UNINSTALLSUCCESS) ELSE (GOTO UNINSTALLFAIL)

:UNINSTALLSUCCESS
ECHO "+=====================================================================+"
ECHO "|                    UnInstallation Successful!                       |"
ECHO "|                                                                     |"
ECHO "+=====================================================================+"
GOTO END

:UNINSTALLFAIL
ECHO "+=====================================================================+"
ECHO "|                    UnInstallation Unsuccessful!                     |"
ECHO "|                                                                     |"
ECHO "|        In order to fully uninstall the device, please go to         |"
ECHO "|    Microsoft Device Manager to continue to uninstall the device     |"
ECHO "|        After which exit Microsoft Device Manager when done.         |"
ECHO "|                                                                     |"
ECHO "+=====================================================================+"
GOTO END

:END
ECHO "+======================================================================+"
ECHO "|                                                                      |"
ECHO "| Please remember to reboot your system in order for your changes      |"
ECHO "| to be effective.                                                     |"
ECHO "|                                                                      |"
ECHO "+======================================================================+"

:TOREBOOT
IF [%1]==[NOREBOOT_BAT] ( GOTO TONOREBOOTBAT )

echo Reboot? [Y/N]
set /p var=
IF /i %var%==y ( shutdown /r /f /t 0 ) else exit

:TONOREBOOTBAT
echo NO REBOOT BAT
:ENDEND
