1 | ; Copyright (c) uib gmbh (www.uib.de)
|
---|
2 | ; This sourcecode is owned by uib gmbh
|
---|
3 | ; and published under the Terms of the General Public License.
|
---|
4 | ; credits: http://www.opsi.org/en/credits/
|
---|
5 |
|
---|
6 |
|
---|
7 | Set $MsiId32$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
|
---|
8 | Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe"
|
---|
9 |
|
---|
10 | Set $MsiId64$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
|
---|
11 | Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe"
|
---|
12 |
|
---|
13 | if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
---|
14 | Message "Uninstalling " + $ProductId$ + " 32 Bit..."
|
---|
15 |
|
---|
16 | if FileExists($UninstallProgram32$)
|
---|
17 | comment "Uninstall program found, starting uninstall"
|
---|
18 | Winbatch_uninstall_32
|
---|
19 | sub_check_exitcode
|
---|
20 | endif
|
---|
21 |
|
---|
22 | if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "")
|
---|
23 | comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
|
---|
24 | Winbatch_uninstall_msi_32
|
---|
25 | sub_check_exitcode
|
---|
26 | endif
|
---|
27 |
|
---|
28 | comment "Delete files"
|
---|
29 | Files_uninstall_32 /32Bit
|
---|
30 | comment "Cleanup registry"
|
---|
31 | Registry_uninstall /32Bit
|
---|
32 | endif
|
---|
33 |
|
---|
34 | if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
---|
35 | Message "Uninstalling " + $ProductId$ + " 64 Bit..."
|
---|
36 |
|
---|
37 | if FileExists($UninstallProgram64$)
|
---|
38 | comment "Uninstall program found, starting uninstall"
|
---|
39 | Winbatch_uninstall_64
|
---|
40 | sub_check_exitcode
|
---|
41 | endif
|
---|
42 |
|
---|
43 | if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "")
|
---|
44 | comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall"
|
---|
45 | Winbatch_uninstall_msi_64
|
---|
46 | sub_check_exitcode
|
---|
47 | endif
|
---|
48 |
|
---|
49 | comment "Delete files"
|
---|
50 | Files_uninstall_64 /64Bit
|
---|
51 | comment "Cleanup registry"
|
---|
52 | Registry_uninstall /64Bit
|
---|
53 | endif
|
---|
54 |
|
---|
55 | comment "Delete program shortcuts"
|
---|
56 | LinkFolder_uninstall
|
---|
57 |
|
---|
58 | [Winbatch_uninstall_32]
|
---|
59 | ; Choose one of the following examples as basis for program uninstall
|
---|
60 | ;
|
---|
61 | ; === Nullsoft Scriptable Install System ================================================================
|
---|
62 | ; "$UninstallProgram32$" /S
|
---|
63 | ;
|
---|
64 | ; === Inno Setup ========================================================================================
|
---|
65 | ; "$UninstallProgram32$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
|
---|
66 |
|
---|
67 |
|
---|
68 | [Winbatch_uninstall_msi_32]
|
---|
69 | msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress
|
---|
70 |
|
---|
71 | [Files_uninstall_32]
|
---|
72 | ; Example for recursively deleting the installation directory (don't forget the trailing backslash):
|
---|
73 | ;
|
---|
74 | ; delete -sf "$InstallDir32$\"
|
---|
75 |
|
---|
76 | [Winbatch_uninstall_64]
|
---|
77 | ; Choose one of the following examples as basis for program uninstall
|
---|
78 | ;
|
---|
79 | ; === Nullsoft Scriptable Install System ================================================================
|
---|
80 | ; "$UninstallProgram64$" /S
|
---|
81 | ;
|
---|
82 | ; === Inno Setup ========================================================================================
|
---|
83 | ; "$UninstallProgram64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
|
---|
84 |
|
---|
85 |
|
---|
86 | [Winbatch_uninstall_msi_64]
|
---|
87 | msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress
|
---|
88 |
|
---|
89 | [Files_uninstall_64]
|
---|
90 | ; Example for recursively deleting the installation directory (don't forget the trailing backslash):
|
---|
91 | ;
|
---|
92 | ; delete -sf "$InstallDir64$\"
|
---|
93 |
|
---|
94 | [Registry_uninstall]
|
---|
95 | ; Example of deleting a registry key:
|
---|
96 | ;
|
---|
97 | ; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
98 |
|
---|
99 | [LinkFolder_uninstall]
|
---|
100 | ; Example of deleting a folder from AllUsers startmenu:
|
---|
101 | ;
|
---|
102 | ; set_basefolder common_programs
|
---|
103 | ; delete_subfolder $ProductId$
|
---|
104 | ;
|
---|
105 | ; Example of deleting a shortcut from AllUsers desktop:
|
---|
106 | ;
|
---|
107 | ; set_basefolder common_desktopdirectory
|
---|
108 | ; set_subfolder ""
|
---|
109 | ; delete_element $ProductId$
|
---|
110 |
|
---|
111 | [Sub_check_exitcode]
|
---|
112 | comment "Test for installation success via exit code"
|
---|
113 | set $ExitCode$ = getLastExitCode
|
---|
114 | ; informations to exit codes see
|
---|
115 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
116 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
117 | if ($ExitCode$ = "0")
|
---|
118 | comment "Looks good: setup program gives exitcode zero"
|
---|
119 | else
|
---|
120 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
121 | if ($ExitCode$ = "1605")
|
---|
122 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
123 | comment "Uninstall of a not installed product failed - no problem"
|
---|
124 | else
|
---|
125 | if ($ExitCode$ = "1641")
|
---|
126 | comment "looks good: setup program gives exitcode 1641"
|
---|
127 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
128 | else
|
---|
129 | if ($ExitCode$ = "3010")
|
---|
130 | comment "looks good: setup program gives exitcode 3010"
|
---|
131 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
132 | else
|
---|
133 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
134 | isFatalError
|
---|
135 | endif
|
---|
136 | endif
|
---|
137 | endif
|
---|
138 | endif
|
---|
139 |
|
---|