; NVIDIA Display Driver uninstaller
call Uninstall

[UninstallSilent]
Set ForceNoReboot=yes
call UninstallSilentReboot

[UninstallSilentReboot]
Set Silent=yes
call Uninstall
Delreg {UninstRegkey}\NVIDIA Display Driver
del {current Script}
del {Current Parser Path}

[Uninstall]
set DelCmd=delbootquiet
if {LeaveDriverStoreCache}=No then set DelCmd=del
killapp nvCplUI.exe
StopService NVSvc, 129
SysCallAndWait MsiExec /x{3D3E663D-4E7E-4577-A560-7ECDDD45548A} /quiet /norestart
SysCallAndWait MsiExec /x{275E55FA-1CB3-4B53-924B-3B43AA701FB6} /quiet /norestart
del {sysdir}\pvsonydll.dll
del {syswow64dir}\pvsonydll.dll
SysCallAndWait MsiExec /x{F4469132-EA9F-444A-BFFB-323C7413E951} /quiet /norestart
SysCallAndWait MsiExec /x{4C0A8D65-4286-4B58-87FE-18AD24289285} /quiet /norestart
SysCallAndWait MsiExec /x{71807498-D8E2-41C6-84CD-8ED7A076B6EC} /quiet /norestart
;need to support uninstall nview in old and new location
SysCallAndWait {syswow64dir}\nViewSetup -s -uninstall
SysCallAndWait {programfilesdir}\NVIDIA Corporation\nview\nViewSetup -s -uninstall
enumregcmd HKLM\SYSTEM\CurrentControlSet\Control\Video\{*},call EnumVideoKeys
CheckPath INFCHECK={windir}\Inf\{InfPath}
if {INFCHECK}=FALSE then enumregcmd HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\{*},call CheckNVIDIAKeys
if {INFCHECK}=FALSE then CheckPath INFCHECK={windir}\Inf\{InfPath}
if {INFCHECK}=TRUE then GetInfGUID GUIDName={InfPath}

RemoveDeviceEx pci,VEN_10DE,Display
if {LeaveDriverStoreCache}=No then if {INFCHECK}=TRUE then RemoveDriverStore {windir}\Inf\{InfPath}

call UpdatusUninstall
call StereoVisionUninstall
call CleanUp
if {LeaveDriverStoreCache}=No then call HackReboot

[HackReboot]
; Hack to trigger a reboot
Copy {current Script},{sysdir}\deleteme.txt
DelBoot {sysdir}\deleteme.txt

[CleanUp]
ClassSweep {GUIDName},D3D;_;OGL;LastSelectedProfile;CurrentProfile;CustomDisplay;LimitVideoPresentSources;DisplayLessPolicy;SplitAdapterRenderDevice;RMOPSB
del {windir}\nvidia icons\Portal_32x32.ico
del {windir}\nvidia icons\Portal_48x48.ico
GetFolderPath Desktop=25
del {Desktop}\Play Portal Now.lnk
Del {pgmdir}\nvModes.dat
Del {pgmdir}\nvModes.001
Del {pgmdir}\nvUnsupRes.dat


set NVIDIADriverFound=FALSE
enumregcmd HKLM\SYSTEM\CurrentControlSet\Control\Video\{*},call EnumVideoKeys
if {InBoxDriverFound}=TRUE then call LeaveInBox
if {NVIDIADriverFound}=FALSE then call DeleteAll

set NVIDIADriverFound=FALSE
enumregcmd HKLM\SYSTEM\CurrentControlSet\Control\Video\{*},call EnumVideoKeysForDelete


[EnumVideoKeysForDelete]
set Found0000=FALSE
set Service
set MyBaseKey={Current Root Key}\{Current Reg Key}
enumregcmd {MyBaseKey}\{*},call CheckNVIDIAKeys
if {Service}%nv then if {Found0000}=FALSE then DelReg {Current Root Key}\{Current Reg Key}

[EnumVideoKeys]
set MyBaseKey={Current Root Key}\{Current Reg Key}
enumregcmd {MyBaseKey}\{*},call CheckNVIDIAKeys

[CheckNVIDIAKeys]
set DriverDesc=FOOBAR
GetReg DriverDesc={Current Root Key}\{Current Reg Key}\DriverDesc
if {DriverDesc}%NVIDIA then set NVIDIADriverFound=TRUE
if {DriverDesc}%NVIDIA then if {DriverDesc}%Microsoft then set InBoxDriverFound=TRUE
if {DriverDesc}%NVIDIA then GetReg InfPath={Current Root Key}\{Current Reg Key}\InfPath
if {DriverDesc}%NVIDIA then GetReg Version={Current Root Key}\{Current Reg Key}\DriverVersion
if {DriverDesc}%NVIDIA then GetReg CoInstaller={Current Root Key}\{Current Reg Key}\Uninstall\CoInstaller
GetReg Service={Current Root Key}\{Current Reg Key}\Service
if {Current Reg Key}%0000 then set Found0000=TRUE


[DeleteAll]
{DelCmd} {sysdir}\nvapi.dll
{DelCmd} {sysdir}\nvapi64.dll
{DelCmd} {sysdir}\nvd3dum.dll
{DelCmd} {sysdir}\nvd3dumx.dll
{DelCmd} {sysdir}\nvdecodemft.dll
{DelCmd} {sysdir}\nvencodemft.dll
{DelCmd} {sysdir}\nViewSetup.exe
del {sysdir}\drivers\nvlddmkm.sys
del {sysdir}\drivers\nvbridge.kmd

{DelCmd} {syswow64dir}\nvapi.dll
{DelCmd} {syswow64dir}\nvd3dum.dll
call LeaveInBox

DelReg HKCR\VirtualStore\MACHINE\SOFTWARE\NVIDIA Corporation\Global
DelRegE HKCR\VirtualStore\MACHINE\SOFTWARE\NVIDIA Corporation
Delreg {UninstRegkey}\NVIDIA Display Driver
DelReg HKLM\Software\NVIDIA Corporation\NVAPI
DelReg HKLM\SYSTEM\{*ControlSet}\Services\nv\NVAPI
DelReg HKLM\SYSTEM\{*ControlSet}\Services\nvlddmkm\NVAPI
DelReg HKLM\SYSTEM\{*ControlSet}\Services\nvlddmkm

[LeaveInBox]
call UninstallSysdirSedona
call UninstallPFSedona
if {NVCPLRSServersPresent}=0 then if {NVCPLRS2ServersPresent}=0 then if {NVCPL2RSServersPresent}=0 then call UninstallSedonaHelp

UninstallService NVSvc

del {sysdir}\nvwgf2um.dll
{DelCmd} {sysdir}\nvwgf2umx.dll
{DelCmd} {sysdir}\nvmctray.dll
del {sysdir}\nvoglv32.dll
del {sysdir}\nvoglv64.dll
del {sysdir}\nvsvc.dll
del {sysdir}\nvsvcr.dll
del {sysdir}\nvsvc64.dll
del {sysdir}\nvmccs.dll
del {sysdir}\nvmccsrs.dll
del {sysdir}\nvvsvc.exe
del {sysdir}\nvcolor.exe
del {sysdir}\nvapps.xml
del {sysdir}\nvwsapps.xml
del {sysdir}\nvcoproc.bin
{DelCmd} {sysdir}\nvcod.dll
{DelCmd} {sysdir}\nvcodins.dll
{DelCmd} {sysdir}\nvcodh.dll
{DelCmd} {sysdir}\nvcodhins.dll
{DelCmd} {sysdir}\nvudisp.exe
{DelCmd} {sysdir}\{CoInstaller}
del {sysdir}\nvcuda.dll
del {sysdir}\nvcuvenc.dll
del {sysdir}\nvcuvid.dll
Del {sysdir}\nvRegDev.dll
{DelCmd} {sysdir}\nvtmmhyb.dll
del {wrkdir}\nvapps.xml
del {wrkdir}\coproc.dat
del {wrkdir}\nvwsapps.xml
del {pgmdir}\NVIDIA Corporation\Display\HybridUserAppList.xml
del {wrkdir}\NvStarted
del {wrkdir}\NvSetnative
{DelCmd} {sysdir}\nvinit.dll
{DelCmd} {sysdir}\nvinitx.dll
del {sysdir}\nvumdshim.dll
del {sysdir}\nvumdshimx.dll
{DelCmd} {sysdir}\nvoglnv32.dll
Set current file
DirAndApply {sysdir}\nv\*.*,del {current file}
del {sysdir}\nv
{DelCmd} {sysdir}\nvcompiler.dll
{DelCmd} {sysdir}\opencl.dll

del {syswow64dir}\nvwgf2um.dll
del {syswow64dir}\nvcuda.dll
del {syswow64dir}\nvcuvenc.dll
del {syswow64dir}\nvoglv32.dll
del {syswow64dir}\nvapps.xml
del {syswow64dir}\nvwsapps.xml
del {syswow64dir}\nvcuvid.dll
del {syswow64dir}\nvinit.dll
del {syswow64dir}\nvinitx.dll
del {syswow64dir}\nvumdshim.dll
del {syswow64dir}\nvumdshimx.dll
del {syswow64dir}\nvoglnv64.dll
{DelCmd} {syswow64dir}\nvcompiler.dll
{DelCmd} {syswow64dir}\opencl.dll
del {syswow64dir}\nvsvc64.dll
Set current file
DirAndApply {syswow64dir}\nv\*.*,del {current file}
del {syswow64dir}\nv

del {ProgramFilesDir}\NVIDIA Corporation\NVSMI\nvidia-smi.exe
del {ProgramFilesDir}\NVIDIA Corporation\NVSMI
del {ProgramFilesDir}\NVIDIA Corporation

DelReg HKLM\Software\NVIDIA Corporation\Global\NvCplApi
DelReg HKCU\Software\NVIDIA Corporation\Global\NvCplApi
DelReg HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global\NvCplApi
DelReg HKLM\Software\NVIDIA Corporation\Global\NVHotkey
DelReg HKCU\Software\NVIDIA Corporation\Global\NVHotkey
DelReg HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global\NVHotkey
DelReg HKLM\Software\NVIDIA Corporation\Global\NVTweak
DelReg HKCU\Software\NVIDIA Corporation\Global\NVTweak
DelReg HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global\NVTweak
DelReg HKLM\Software\NVIDIA Corporation\Global\MediaCenterTray
DelReg HKLM\Software\NVIDIA Corporation\Global\Hybrid\Action
DelReg HKLM\Software\NVIDIA Corporation\Global\Hybrid
DelReg HKLM\Software\NVIDIA Corporation\Global\NvSvc
DelReg HKCU\Software\NVIDIA Corporation\Global\NvSvc
DelReg HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global\MediaCenterTray
DelReg HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global\Hybrid\Action
DelReg HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global\Hybrid
DelReg HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global\NvSvc
DelReg HKLM\Software\NVIDIA Corporation\Global\CoProcManager\Displayname
DelReg HKLM\Software\NVIDIA Corporation\Global\CoProcManager\NotifyBalloon
DelReg HKLM\Software\NVIDIA Corporation\Global\CoProcManager\CoprocCRC
DelReg HKLM\Software\NVIDIA Corporation\Global\CoProcManager\NvAppsCRC
DelReg HKLM\Software\NVIDIA Corporation\Global\CoProcManager
DelReg HKLM\SOFTWARE\Wow6432Node\NVIDIA Corporation\Global\CoprocManager
DelReg HKCU\Software\NVIDIA Corporation\Global\CoProcManager\AutoDownload
DelReg HKCU\Software\NVIDIA Corporation\Global\CoProcManager\ShowContextMenu
DelReg HKCU\Software\NVIDIA Corporation\Global\CoProcManager\OptimusOverlay
DelReg HKCU\Software\NVIDIA Corporation\Global\CoProcManager\RefreshElapseTime
Set RegPath=HKCU\Software\NVIDIA Corporation\Global\CoProcManager\Hotplug\{*}
EnumRegNamesCmd {RegPath},DelReg {RegPath}\{Current Reg Name}
DelReg HKCU\Software\NVIDIA Corporation\Global\CoProcManager\Hotplug
DelReg HKCU\Software\NVIDIA Corporation\Global\CoProcManager
DelReg HKLM\Software\NVIDIA Corporation\Global\Startup
DelReg HKLM\Software\NVIDIA Corporation\Global\PersistenceIdentifier
DelRegE HKCU\Software\NVIDIA Corporation\Global
DelRegE HKLM\Software\NVIDIA Corporation\Global
DelRegE HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation\Global
DelReg HKLM\Software\NVIDIA Corporation\Installer
DelReg HKLM\Software\NVIDIA Corporation\nvDelFiles
delreg HKLM\Software\Microsoft\Windows\CurrentVersion\Run\NvMediaCenter
delreg HKLM\Software\Microsoft\Windows\CurrentVersion\Run\NvCplDaemon
delreg HKLM\Software\Microsoft\Windows\CurrentVersion\Run\NvSvc
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\NVHotkey
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\NVDeployClient
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\NVRotateSysTray
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\NvCplCleanup
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\NvExportOEMDefaults
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\NvCplDaemon
delreg HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\DontShowMeThisDialogAgain\RestoreProfile
delreg HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\DontShowMeThisDialogAgain\RestoreGlobals
DelReg HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\NVIDIA Display Control Panel
DelRegE HKCU\Software\NVIDIA Corporation
DelRegE HKLM\Software\NVIDIA Corporation
DelRegE HKCU\Software\Classes\VirtualStore\MACHINE\Software\NVIDIA Corporation


GetReg DLL_Str = HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
if {DLL_Str}={sysdir}\nvinit.dll then set DLL_Str = 
if {DLL_Str}={sysdir}\nvinitx.dll then set DLL_Str = 
RmString DLL_Str = {DLL_Str} (-) ",{sysdir}\nvinit.dll"
RmString DLL_Str = {DLL_Str} (-) ",{sysdir}\nvinitx.dll"
Setreg HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs={DLL_Str}

GetReg DLL_Str = HKLM\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
if {DLL_Str}={syswow64dir}\nvinit.dll then set DLL_Str = 
RmString DLL_Str = {DLL_Str} (-) ",{syswow64dir}\nvinit.dll"
Setreg HKLM\Software\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs={DLL_Str}

[UninstallSedonaHelp]
Set current file
DirAndApply {windir}\help\nvcpl\nvst3*.chm,del {current file}
Set current file
DirAndApply {windir}\help\nvcpl\nvcpl*.cab,del {current file}
Set current file
DirAndApply {windir}\help\nvcpl\nvcpl*.chm,del {current file}
Set current file
DirAndApply {windir}\help\nvcpl\nvdsp*.chm,del {current file}
Set current file
DirAndApply {windir}\help\nvcpl\nv3d*.chm,del {current file}
Set current file
DirAndApply {windir}\help\nvcpl\nvmob*.chm,del {current file}
Set current file
DirAndApply {windir}\help\nvcpl\nvwks*.chm,del {current file}
Set current file
del {windir}\help\nvcpl

[UninstallSysdirSedona]
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvshext.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nv3dappshext.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvcpl.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvsvs.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvsvsr.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvmccs.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvmccss.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvdisps.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvgames.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvmobls.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvvitvs.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvwss.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvsvc.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvsvc64.dll
SysCallAndWait {sysdir}\regsvr32.exe /s /u {sysdir}\nvvsvc.exe

{DelCmd} {sysdir}\nvshext.dll
{DelCmd} {sysdir}\nv3dappshext.dll
{DelCmd} {sysdir}\nv3dappshextr.dll

del {sysdir}\nvcpl.dll
del {sysdir}\nvdisps.dll
del {sysdir}\nvgames.dll
del {sysdir}\nvmccss.dll
del {sysdir}\nvmccs.dll
del {sysdir}\nvmobls.dll
del {sysdir}\nvvitvs.dll
del {sysdir}\nvwss.dll
{DelCmd} {sysdir}\nvhotkey.dll
del {sysdir}\oemdspif.dll
del {sysdir}\nvsvs.dll
del {sysdir}\nvsvsr.dll
del {sysdir}\NvPVEnc.ax
del {sysdir}\nvdispsr.dll
del {sysdir}\nvgamesr.dll
del {sysdir}\nvmccssr.dll
del {sysdir}\nvmoblsr.dll
del {sysdir}\nvvitvsr.dll
del {sysdir}\nvwssr.dll
del {sysdir}\easyUpdatusAPIU.dll
del {sysdir}\easyUpdatusAPIU64.dll

DirAndApply {wrkdir}\*.NVP,del {current file}

Set NVCPLRSServersPresent=0
EnumRegNamesCmd HKLM\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers, increment NVCPLRSServersPresent
EnumRegNamesCmd HKLM\Software\NVIDIA Corporation\Global\NVControlPanel\RegisteredServers, increment NVCPLRSServersPresent
if {NVCPLRSServersPresent}=0 then call UninstallSysdirSedonaClient

[UninstallPFSedona]
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvsvs.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvsvsr.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvmccs.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvmccss.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvdisps.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvgames.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvmobls.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvvitvs.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvwss.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvxdapix.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvxdbat.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvxdplcy.dll"
SysCallAndWait {sysdir}\regsvr32.exe /s /u "{ProgramFilesDir}\NVIDIA Corporation\Display\nvcplui.dll"
SysCallAndWait "{ProgramFilesDir}\NVIDIA Corporation\Display\nvxdsync.exe" /unregserver

SysCallAndWait "{ProgramFilesDir}\NVIDIA Corporation\Drs\dbInstaller.exe" -uninstall

del {ProgramFilesDir}\NVIDIA Corporation\Drs\dbInstaller.exe
del {ProgramFilesDir}\NVIDIA Corporation\Drs\nvdrsdb.bin
del {ProgramFilesDir}\NVIDIA Corporation\Drs

del {ProgramFilesDir}\NVIDIA Corporation\coprocmanager\detoured.dll 
del {ProgramFilesDirx86}\NVIDIA Corporation\coprocmanager\detoured.dll 
del {ProgramFilesDir}\NVIDIA Corporation\coprocmanager\nvd3d9wrap.dll
del {ProgramFilesDirx86}\NVIDIA Corporation\coprocmanager\nvd3d9wrap.dll
del {ProgramFilesDir}\NVIDIA Corporation\coprocmanager\nvd3d9wrapx.dll  
del {ProgramFilesDir}\NVIDIA Corporation\coprocmanager\nvdxgiwrap.dll
del {ProgramFilesDirx86}\NVIDIA Corporation\coprocmanager\nvdxgiwrap.dll
del {ProgramFilesDir}\NVIDIA Corporation\coprocmanager\nvdxgiwrapx.dll
del {ProgramFilesDir}\NVIDIA Corporation\coprocmanager
del {ProgramFilesDirx86}\NVIDIA Corporation\coprocmanager

del {ProgramFilesDir}\NVIDIA Corporation\Display\nvdisps.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvgames.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvmccss.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvmccs.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvmobls.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvvitvs.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvwss.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvsvs.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvsvsr.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvdispsr.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvgamesr.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvmccssr.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvmoblsr.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvvitvsr.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvwssr.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvxdapix.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvxdbat.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvxdplcy.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvcplui.dll
del {ProgramFilesDir}\NVIDIA Corporation\Display\nvxdsync.exe
del {ProgramFilesDir}\NVIDIA Corporation\Display
del {ProgramFilesDir}\NVIDIA Corporation
del {ProgramFilesDirx86}\NVIDIA Corporation

Set NVCPL2RSServersPresent=0
EnumRegNamesCmd HKLM\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers, increment NVCPL2RSServersPresent

Set NVCPLRS2ServersPresent=0
EnumRegNamesCmd HKLM\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers2, increment NVCPLRS2ServersPresent

if {NVCPLRS2ServersPresent}=1 then if {NVCPL2RSServersPresent}=0 then call CheckCPL2RSDummyServerGUID

if {NVCPLRS2ServersPresent}=0 then if {NVCPL2RSServersPresent}=0 then call UninstallPFSedonaClient

[CheckCPL2RSDummyServerGUID]
set DummyExists=NULL
GetReg DummyExists=HKLM\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers2\Dummy
if {DummyExists}={00000000-0000-0000-0000-000000000001} then set NVCPLRS2ServersPresent = 0


[UninstallSysdirSedonaClient]
del {sysdir}\nvcpl.exe
del {sysdir}\nvcplui.exe
del {sysdir}\nvcpl.cpl
del {sysdir}\nvcpluir.dll
del {sysdir}\nvexpbar.dll

DelReg HKLM\Software\NVIDIA Corporation\NVIDIA Control Panel
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers\Overrides
DelRegE HKLM\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel\InstalledClient
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel\HelpFile
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel\Client
DelRegE HKLM\Software\NVIDIA Corporation\NVControlPanel
DelRegE HKLM\Software\NVIDIA Corporation

DelReg HKCU\Software\NVIDIA Corporation\NVIDIA Control Panel
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers\Overrides
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers\DisplayPanelServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers\GamesConfigServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers\MobileServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers\Video_TVServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers\WorkStationServer
DelRegE HKCU\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\InstalledClient
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\HelpFile
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel\Client
DelRegE HKCU\Software\NVIDIA Corporation\NVControlPanel
DelRegE HKCU\Software\NVIDIA Corporation

del {CommonPrograms}\NVIDIA Corporation

[UninstallPFSedonaClient]
del {ProgramFilesDir}\NVIDIA Corporation\Control Panel Client\nvcplui.exe
del {ProgramFilesDir}\NVIDIA Corporation\Control Panel Client\nvcpluir.dll
del {ProgramFilesDir}\NVIDIA Corporation\Control Panel Client
del {ProgramFilesDir}\NVIDIA Corporation

DelReg HKLM\Software\NVIDIA Corporation\NVIDIA Control Panel
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers\Overrides
DelRegE HKLM\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel2\InstalledClient
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel2\HelpFile
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel2\Client
DelRegE HKLM\Software\NVIDIA Corporation\NVControlPanel2
DelReg HKLM\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers2\Dummy
DelRegE HKLM\Software\NVIDIA Corporation\NVControlPanel\RegisteredServers2
DelRegE HKLM\Software\NVIDIA Corporation\NVControlPanel
DelRegE HKLM\Software\NVIDIA Corporation

DelReg HKCU\Software\NVIDIA Corporation\NVIDIA Control Panel
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers\Overrides
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers\DisplayPanelServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers\GamesConfigServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers\MobileServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers\Video_TVServer
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers\WorkStationServer
DelRegE HKCU\Software\NVIDIA Corporation\NVControlPanel2\RegisteredServers
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\InstalledClient
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\HelpFile
DelReg HKCU\Software\NVIDIA Corporation\NVControlPanel2\Client
DelRegE HKCU\Software\NVIDIA Corporation\NVControlPanel2
DelRegE HKCU\Software\NVIDIA Corporation


DelReg HKCR\CLSID\{0bbca823-e77d-419e-9a44-5adec2c8eeb0}
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\ControlPanel\NameSpace\{0bbca823-e77d-419e-9a44-5adec2c8eeb0}
DelReg HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\don't load\nvcpl.cpl 

del {CommonPrograms}\NVIDIA Corporation

[UpdatusUninstall]
set UninstallCommand = foobar
set UninstallRegPath = HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
getreg UninstallCommand={UninstallRegPath}\NVIDIA.Updatus\UninstallString
if {UninstallCommand}=foobar then set UninstallRegPath = HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
if {UninstallCommand}=foobar then getreg UninstallCommand={UninstallRegPath}\NVIDIA.Updatus\UninstallString
getreg InstallPath={UninstallRegPath}\NVIDIA.Updatus\LogFile

RmString InstallPath = {InstallPath} (-) "setup.ilg"

if {UninstallCommand}%.exe then syscallandwait {UninstallCommand} -uninst -s -f1"{InstallPath}Setup.iss"
waitonregdel {UninstallRegPath}\NVIDIA.Updatus,,10000,12, echo Unable to uninstall Updatus installer

[StereoVisionUninstall]
set UninstallCommand = foobar
set StereoUninstallRegPath = HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\NVIDIAStereo
getreg UninstallCommand={StereoUninstallRegPath}\UninstallString
if {UninstallCommand}=foobar then set StereoUninstallRegPath = HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\NVIDIAStereo
if {UninstallCommand}=foobar then getreg UninstallCommand={StereoUninstallRegPath}\UninstallString

if {UninstallCommand}%.exe then RmString UninstallCommand = {UninstallCommand} (-) "/ask"

if {UninstallCommand}%.exe then syscallandwait {UninstallCommand} /silent
waitonregdel {StereoUninstallRegPath},,10000,12, echo Unable to uninstall Stereo Vision
