#!/bin/sh
#
# ieuninstall.sh
# Uninstalling Internet Explorer from wine
#
# Copyright 2008 Konstantin Kondratyuk <kondratyuk@etersoft.ru>

TO_DELETE=" \
actxprxy.dll \
advapi32.dll \
advpack.dll \
atl.dll \
bindfile.dll \
browselc.dll \
browseui.dll \
browsewm.dll \
comctl32.dll \
cool.dll \
corpol.dll \
crypt32.dll \
cryptdlg.dll \
cryptext.dll \
cryptnet.dll \
cryptui.dll \
csseqchk.dll \
digest.dll \
dssbase.dll \
dwintl.dll \
dxtmsft.dll \
dxtrans.dll \
enhsig.dll \
hhsetup.dll \
hlink.dll \
hmmapi.dll \
ie4.dll \
iedkcs32.dll \
iemigrat.dll \
iepeers.dll \
iernonce.dll \
iesetup.dll \
imagehlp.dll \
imgutil.dll \
inetcplc.dll \
initpki.dll \
inseng.dll \
instrsa.dll \
instsch.dll \
itircl.dll \
itss.dll \
jobexec.dll \
jsproxy.dll \
jsru.dll \
licmgr10.dll \
migrate.dll \
mlang.dll \
mmutilse.dll \
mscat32.dll \
msconv97.dll \
mscrlrev.dll \
msencode.dll \
mshtml.dll \
mshtmled.dll \
mshtmler.dll \
msoss.dll \
msratelc.dll \
msrating.dll \
mssetup.dll \
mssign32.dll \
mssip32.dll \
mstime.dll \
msxmla.dll \
msxml.dll \
msxmlr.dll \
occache.dll \
pngfilt.dll \
psbase.dll \
pstorec.dll \
pstorerc.dll \
rnaph.dll \
rsabase.dll \
rsaenh.dll \
rsasig.dll \
schannel.dll \
scoru.dll \
scrrnru.dll \
sendmail.dll \
shd401lc.dll \
shdoc401.dll \
shdoclc.dll \
shdocvw.dll \
shfolder.dll \
shlwapi.dll \
softpub.dll \
thumbvw.dll \
triedit.dll \
url.dll \
urlmon.dll \
vbsru.dll \
vgx.dll \
wininet.dll \
wintrust.dll \
wldap32.dll \
wshcon.dll \
wshru.dll \
xenroll.dll"

if [ "$(whoami)" = "root" ] ; then echo "Error: you are root"; exit; fi
if [ -z "$WINEPREFIX" ] ; then WINEPREFIX="$HOME/.wine" ; fi

CROOT="$WINEPREFIX/dosdevices/c:"

# Attention message
echo "ATTENTION: wine --update will be started, you can lose some your options"
echo -n "Wish to continue? (y/n) "
read answer
if [ ! $answer == "y" ] ; then
    echo "Uninstall has been cancelled"
    exit
fi

# Deleting
echo "Deleting..."
rm -f "$CROOT/Program Files/Internet Explorer/iexplore.exe"
rm -rf "$CROOT/windows/downloads/ie6"
for i in $TO_DELETE; do
    rm -f "$CROOT/windows/system32/$i"
done

# Removing iexplore.exe defaults
wine regedit /D 'HKEY_USERS\S-1-5-21-0-0-0-1000\Software\Wine\AppDefaults\iexplore.exe'

# Updating
wine --update
