./echo "*****Removing services*****"
./nmserver -remove
./machd -remove
./echo "*****Cleaning Registry Entries*****"
./DelRegKey HKEY_CLASSES_ROOT ".api"
./DelRegKey HKEY_CLASSES_ROOT ".btsubmit"
./DelRegKey HKEY_CLASSES_ROOT ".C"
./DelRegKey HKEY_CLASSES_ROOT ".eomodel"
./DelRegKey HKEY_CLASSES_ROOT ".eomodel~"
./DelRegKey HKEY_CLASSES_ROOT ".eomodeld"
./DelRegKey HKEY_CLASSES_ROOT ".eomodeld~"
./DelRegKey HKEY_CLASSES_ROOT ".H"
./DelRegKey HKEY_CLASSES_ROOT ".M"
./DelRegKey HKEY_CLASSES_ROOT ".nib"
./DelRegKey HKEY_CLASSES_ROOT ".nib~"
./DelRegKey HKEY_CLASSES_ROOT ".palette"
./DelRegKey HKEY_CLASSES_ROOT ".project"
./DelRegKey HKEY_CLASSES_ROOT ".rtf"
#./DelRegKey HKEY_CLASSES_ROOT ".rtfd"
./DelRegKey HKEY_CLASSES_ROOT ".rtfd"
./DelRegKey HKEY_CLASSES_ROOT ".wbpalette"
./DelRegKey HKEY_CLASSES_ROOT ".wo"
./DelRegKey HKEY_CLASSES_ROOT ".wod"
./DelRegKey HKEY_CLASSES_ROOT ".woo"
./DelRegKey HKEY_CLASSES_ROOT ".wos"
./DelRegKey HKEY_CLASSES_ROOT "BugNeXT.btsubmit"
./DelRegKey HKEY_CLASSES_ROOT "CLSID\{9C1DC960-3A7F-11ce-98FC-0020AF30B8FD}"
./DelRegKey HKEY_CLASSES_ROOT "CLSID\{DA29EF90-D8F9-11CE-AB25-00AA00684718}"
./DelRegKey HKEY_CLASSES_ROOT "EOModeler.eomodel"
./DelRegKey HKEY_CLASSES_ROOT "EOModeler.eomodel~"
./DelRegKey HKEY_CLASSES_ROOT "EOModeler.eomodeld"
./DelRegKey HKEY_CLASSES_ROOT "EOModeler.eomodeld~"
./DelRegKey HKEY_CLASSES_ROOT "InterfaceBuilder.nib"
./DelRegKey HKEY_CLASSES_ROOT "InterfaceBuilder.nib~"
./DelRegKey HKEY_CLASSES_ROOT "InterfaceBuilder.palette"
./DelRegKey HKEY_CLASSES_ROOT "NEXTORB.OLE"
./DelRegKey HKEY_CLASSES_ROOT "NEXTORB.OLE.Client"
./DelRegKey HKEY_CLASSES_ROOT "NEXTORB.OLE.Server"
./DelRegKey HKEY_CLASSES_ROOT "ProjectBuilder.C"
./DelRegKey HKEY_CLASSES_ROOT "ProjectBuilder.H"
./DelRegKey HKEY_CLASSES_ROOT "ProjectBuilder.M"
./DelRegKey HKEY_CLASSES_ROOT "ProjectBuilder.project"
./DelRegKey HKEY_CLASSES_ROOT "ProjectBuilder.wos"
./DelRegKey HKEY_CLASSES_ROOT "TextEdit.rtf"
./DelRegKey HKEY_CLASSES_ROOT "TextEdit.rtfd"
./DelRegKey HKEY_CLASSES_ROOT "WebObjectsBuilder.api"
./DelRegKey HKEY_CLASSES_ROOT "WebObjectsBuilder.wbpalette"
./DelRegKey HKEY_CLASSES_ROOT "WebObjectsBuilder.wo"
./DelRegKey HKEY_CLASSES_ROOT "WebObjectsBuilder.wod"
./DelRegKey HKEY_CLASSES_ROOT "WebObjectsBuilder.woo"
./DelRegKey HKEY_CURRENT_USER "Software\NeXT"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\NeXT"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\BugNeXT.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Console.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\EOModeler.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\FileMerge.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\InterfaceBuilder.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\ProjectBuilder.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\TextEdit.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WebObjectsBuilder.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Yap.exe"
./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NeXT_Mach_Daemon"
./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Services\NeXT_Netname_Server"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Enum\Root\LEGACY_NEXT_MACH_DAEMON"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Enum\Root\LEGACY_NEXT_NETNAME_SERVER"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet001\Services\NeXT_Mach_Daemon"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet001\Services\NeXT_Netname_Server"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet001\Enum\Root\LEGACY_NEXT_MACH_DAEMON"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet001\Enum\Root\LEGACY_NEXT_NETNAME_SERVER"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet002\Services\NeXT_Mach_Daemon"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet002\Services\NeXT_Netname_Server"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet002\Enum\Root\LEGACY_NEXT_MACH_DAEMON"
#./DelRegKey HKEY_LOCAL_MACHINE "SYSTEM\ControlSet002\Enum\Root\LEGACY_NEXT_NETNAME_SERVER"
./echo "*****Cleaning PATH environment variable*****"
CURRENT_PATH=`./Registry  HKEY_LOCAL_MACHINE "SYSTEM/CurrentControlSet/Control/Session Manager/Environment" Path`
NEW1_PATH=`./echo $CURRENT_PATH | ./sed -e 's/[^;]*[\\\/]Library[\\\/][^;]*//g'`
NEW2_PATH=`./echo $NEW1_PATH    | ./sed -e 's/[^;]*[\\\/]Developer[\\\/][^;]*//g'`
NEW3_PATH=`./echo $NEW2_PATH    | ./sed -e 's/[^;]*[\\\/]DEVELOPER[\\\/][^;]*//g'`
NEW4_PATH=`./echo $NEW3_PATH    | ./sed -e 's/[^;]*[\\\/]LIBRARY[\\\/][^;]*//g'`
NEW5_PATH=`./echo $NEW4_PATH    | ./sed -e 's/;;;*/;/g'`
NEW6_PATH=`./echo $NEW5_PATH    | ./sed -e 's/;$//'`
NEW_PATH=`./echo  $NEW6_PATH    | ./sed -e 's/^;//'`
./Setenv SYSTEM PATH="$NEW_PATH"
./echo "*****Cleaning LIB environment variable*****"
CURRENT_LIB=`./Registry  HKEY_LOCAL_MACHINE "SYSTEM/CurrentControlSet/Control/Session Manager/Environment" Lib`
NEW1_LIB=`./echo $CURRENT_LIB | ./sed -e 's/[^;]*[\\\/]Library[\\\/][^;]*//g'`
NEW2_LIB=`./echo $NEW1_LIB    | ./sed -e 's/[^;]*[\\\/]Developer[\\\/][^;]*//g'`
NEW3_LIB=`./echo $NEW2_LIB    | ./sed -e 's/[^;]*[\\\/]DEVELOPER[\\\/][^;]*//g'`
NEW4_LIB=`./echo $NEW3_LIB    | ./sed -e 's/[^;]*[\\\/]LIBRARY[\\\/][^;]*//g'`
NEW5_LIB=`./echo $NEW4_LIB    | ./sed -e 's/;;;*/;/g'`
NEW6_LIB=`./echo $NEW5_LIB    | ./sed -e 's/;$//'`
NEW_LIB=`./echo  $NEW6_LIB    | ./sed -e 's/^;//'`
./Setenv SYSTEM LIB="$NEW_LIB"
./echo "*****Done*****"
./echo "*****NOTE: Please ignore failures in opening the following keys:"
./echo "   HKEY_CLASSES_ROOT\CLSID\{9C1DC960-3A7F-11ce-98FC-0020AF30B8FD}"
./echo "   HKEY_CLASSES_ROOT\CLSID\{DA29EF90-D8F9-11CE-AB25-00AA00684718}"
./echo "   HKEY_CLASSES_ROOT\NEXTORB.OLE"
./echo "   HKEY_CLASSES_ROOT\NEXTORB.OLE.Client"
./echo "   HKEY_CLASSES_ROOT\NEXTORB.OLE.Server"
./echo "   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NeXT_Mach_Daemon"
./echo "   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NeXT_Netname_Server"
