Search code examples
registryinno-setup

Registry aren't fully deleting when uninstalling


Inno Setup isn't deleting the full registry key. Here is what I have done:

[Registry]
Root: HKLM; SubKey: SOFTWARE\EA Games\Need for Speed Most Wanted-2012; ValueType: string; ValueName: GDFBinary; ValueData: {app}\GDFBinary_en_US.dll; Flags: uninsdeletekey
Root: HKLM; SubKey: SOFTWARE\EA Games\Need for Speed Most Wanted-2012; ValueType: string; ValueName: DisplayName; ValueData: Need for Speed Most Wanted-2012; Flags: uninsdeletekey
Root: HKLM; SubKey: SOFTWARE\EA Games\Need for Speed Most Wanted-2012; ValueType: string; ValueName: Locale; ValueData: en_US; Flags: uninsdeletekey
Root: HKLM; SubKey: SOFTWARE\EA Games\Need for Speed Most Wanted-2012; ValueType: string; ValueName: Install Dir; ValueData: {app}; Flags: uninsdeletekey

These part isn't deleting when uninstalling: \EA Games\Need for Speed Most Wanted-2012 folder in registry

Root: HKLM; SubKey: SOFTWARE\EA Games\Need for Speed Most Wanted-2012 

(Need for Speed Most Wanted-2012 game is only for hint).

Anybody please help.


Solution

  • Your code, as it is, automatically deletes the HKLM\SOFTWARE\EA Games\Need for Speed Most Wanted-2012. The HKLM\SOFTWARE\EA Games is not deleted.

    If you want to delete even the HKLM\SOFTWARE\EA Games, you have to add an explicit code for it:

    Root: HKLM; SubKey: SOFTWARE\EA Games; Flags: uninsdeletekeyifempty
    

    (This should be placed before your other entries).

    The entry will delete only empty key SOFTWARE\EA Games. If other subkeys are created (not by the installer), the key won't be deleted. If you want to delete the EA Games key unconditionally, replace uninsdeletekeyifempty with uninsdeletekey.