; Delete Driver Store image
set HardwareIDKey=FOOBAR
set DriverKey=FOOBAR
enumregcmd HKLM\SYSTEM\CurrentControlSet\Enum\HDAudio\{*},call EnumHDAudioKeys

set DelCmd=delbootquiet
if {LeaveDriverStoreCache}=No then set DelCmd=delboot
; Delete co-installer files
{DelCmd} {sysdir}\nvcohda.dll
{DelCmd} {sysdir}\nvcohda6.dll

; Removing the device
if {LeaveDriverStoreCache}=No then RemoveDevice HDAUDIO,VEN_10DE,MEDIA

; Delete driver files
Del {sysdir}\nvapo32v.dll
Del {sysdir}\nvapo64v.dll
Del {sysdir}\nvhdap32.dll
Del {sysdir}\nvhdap64.dll
Del {sysdir}\Drivers\nvhda32.sys
Del {sysdir}\Drivers\nvhda32v.sys
Del {sysdir}\Drivers\nvhda64.sys
Del {sysdir}\Drivers\nvhda64v.sys

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

[CheckNVIDIAHDAudioKeys]
GetReg HardwareIDKey={Current Root Key}\{Current Reg Key}\HardwareID
if {HardwareIDKey}%VEN_10DE then GetReg DriverKey={Current Root Key}\{Current Reg Key}\Driver
if {HardwareIDKey}%VEN_10DE then call INFLookup


[INFLookup]
GetReg DriverDesc=HKLM\SYSTEM\CurrentControlSet\Control\Class\{DriverKey}\DriverDesc
if {DriverDesc}%NVIDIA then GetReg InfPath=HKLM\SYSTEM\CurrentControlSet\Control\Class\{DriverKey}\InfPath
CheckPath INFCHECK={windir}\Inf\{InfPath}
if {INFCHECK}=TRUE then call RunDpinst

[RunDpinst]
if {LeaveDriverStoreCache}=No then SysCallAndWait {sysdir}\dpinst.exe /u {windir}\Inf\{InfPath} /s

