@echo off rem rem This script will cleanup after Windows Setup (dpinst.exe) rem which may leave Registry keys and Directories after rem Sangoma Driver is uninstalled. The script is envoked rem by Setup.exe and should NOT be used directly (at rem command line). rem rem Version: 1.1 rem Date April 14, 2010 rem Author: David Rokhvarg set WP_CURRENT_DIR=%cd% set WP_LOG_FILE=%windir%\system32\drivers\wanpipelog.txt set FOUND_DIRS=0 set IS_XP=0 rem echo WP_CURRENT_DIR is %WP_CURRENT_DIR% rem echo WP_LOG_FILE is %WP_LOG_FILE% rem ============================================================= rem Registry cleanup rem ============================================================= rem Output of both stdout and stderr will be redirected to nul. set GUID_DEVCLASS_SANGOMA_ADAPTER_STR={680D0063-63ED-4E66-A2CC-6F54CB331CF5} reg delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\%GUID_DEVCLASS_SANGOMA_ADAPTER_STR% /f > nul 2>&1 rem ============================================================= rem Driver Store cleanup rem ============================================================= set XP_DriverStoreDir=%windir%\system32\DRVSTORE set Vista_DriverStoreDir=%windir%\system32\DriverStore\FileRepository rem rem Detect which directory exist and based on it we'll know the OS: XP or Vista rem Output of both stdout and stderr will be redirected to nul rem because user is NOT interested in full directory list being rem printed to stdout. rem dir %Vista_DriverStoreDir% > nul 2>&1 if errorlevel 1 (set IS_XP=1) set WpDriverStoreDir=%Vista_DriverStoreDir% if %IS_XP%==1 (set WpDriverStoreDir=%XP_DriverStoreDir%) rem This is only for testing, comment it out rem set WpDriverStoreDir=%WP_CURRENT_DIR% rem set WpDriverStoreDir=J:\development\tmp\DriverStore echo %DATE% %TIME% >> %WP_LOG_FILE% echo Searching Driver Store... >> %WP_LOG_FILE% echo Driver Store Directory: %WpDriverStoreDir% >> %WP_LOG_FILE% rem ============================================================= set SEARCH_DIR=%WpDriverStoreDir%\sngbus.inf_* if %IS_XP%==1 (set SEARCH_DIR=%WpDriverStoreDir%\sngbus_*) for /d %%d in (%SEARCH_DIR%) do (call :delete_dir_function %%d) goto delete_sdladrv_dirs rem ============================================================= :delete_sdladrv_dirs set SEARCH_DIR=%WpDriverStoreDir%\sdladrv.inf_* if %IS_XP%==1 (set SEARCH_DIR=%WpDriverStoreDir%\sdladrv_*) for /d %%d in (%SEARCH_DIR%) do (call :delete_dir_function %%d) goto delete_sprotocol_dirs rem ============================================================= :delete_sprotocol_dirs set SEARCH_DIR=%WpDriverStoreDir%\sprotocol.inf_* if %IS_XP%==1 (set SEARCH_DIR=%WpDriverStoreDir%\sprotocol_*) for /d %%d in (%SEARCH_DIR%) do (call :delete_dir_function %%d) goto delete_netsango_dirs rem ============================================================= :delete_netsango_dirs set SEARCH_DIR=%WpDriverStoreDir%\netsango.inf_* if %IS_XP%==1 (set SEARCH_DIR=%WpDriverStoreDir%\netsango_*) for /d %%d in (%SEARCH_DIR%) do (call :delete_dir_function %%d) goto check_dirs_found :check_dirs_found if %FOUND_DIRS%==1 goto finished_removing_directories goto no_dirs_found :delete_dir_function echo Warning: Removing Directory: %1 >> %WP_LOG_FILE% rmdir /s /q %1 >> %WP_LOG_FILE% set FOUND_DIRS=1 goto :eof :finished_removing_directories echo Finished removing directories! >> %WP_LOG_FILE% goto end :no_dirs_found echo No Sangoma-related directories found. >> %WP_LOG_FILE% goto end :end