Skip to content

Commit 3811d8c

Browse files
committed
Remove 'Multi Theft Auto: San Andreas All' registry key in uninstaller
Removes 'Multi Theft Auto: San Andreas All' registry key if 'Common' is the only registry key left.
1 parent 22f29f6 commit 3811d8c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Shared/installer/NSIS dirs/Include/Utils.nsh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@
2525
!macroend
2626

2727

28+
;----------------------------------------
29+
; Removes a registry key if there is only one subkey with particular name present.
30+
; IN ROOT_KEY: A root key like HKLM
31+
; IN GROUP_KEY: Any group key with subkeys
32+
; IN SUBKEY: Name of the subkey to check against
33+
;----------------------------------------
34+
!macro _RemoveRegistryGroupWithSingleKey ROOT_KEY GROUP_KEY SUBKEY
35+
Push $0
36+
EnumRegKey $0 ${ROOT_KEY} "${GROUP_KEY}" 0
37+
StrCmp $0 "${SUBKEY}" 0 +4
38+
EnumRegKey $0 ${ROOT_KEY} "${GROUP_KEY}" 1
39+
StrCmp $0 "" 0 +2
40+
DeleteRegKey ${ROOT_KEY} "${GROUP_KEY}"
41+
Pop $0
42+
!macroend
43+
!define RemoveRegistryGroupWithSingleKey `!insertmacro _RemoveRegistryGroupWithSingleKey`
44+
45+
2846
;----------------------------------------
2947
; In: FILENAME = filename
3048
; Out: MAJOR.MINOR.RELEASE.BUILD

Shared/installer/nightly.nsi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,8 @@ Section Uninstall
11431143
DeleteRegKey HKLM "SOFTWARE\Multi Theft Auto: San Andreas ${0.0}"
11441144
DeleteRegKey HKCU "SOFTWARE\Multi Theft Auto: San Andreas ${0.0}"
11451145
DeleteRegKey HKLM "SOFTWARE\Multi Theft Auto: San Andreas All\${0.0}"
1146-
; TODO if HKLM "SOFTWARE\Multi Theft Auto: San Andreas All\Common is the only one left, delete it
1146+
; Delete "SOFTWARE\Multi Theft Auto: San Andreas All" if "Common" is the only one left.
1147+
${RemoveRegistryGroupWithSingleKey} HKLM "SOFTWARE\Multi Theft Auto: San Andreas All" "Common"
11471148

11481149
${GameExplorer_RemoveGame} ${GUID}
11491150

0 commit comments

Comments
 (0)