root / tmp / org.txm.setups / nsis-2.5 / Include / Library.nsh @ 3106
Historique | Voir | Annoter | Télécharger (20,31 ko)
1 | 2961 | mdecorde | # |
---|---|---|---|
2 | 2961 | mdecorde | # Library.nsh |
3 | 2961 | mdecorde | # |
4 | 2961 | mdecorde | # A system for the installation and uninstallation of dynamic |
5 | 2961 | mdecorde | # link libraries (DLL) and type libraries (TLB). Using this |
6 | 2961 | mdecorde | # system you can handle the complete setup with one single |
7 | 2961 | mdecorde | # line of code: |
8 | 2961 | mdecorde | # |
9 | 2961 | mdecorde | # * File copying |
10 | 2961 | mdecorde | # * File copying on reboot |
11 | 2961 | mdecorde | # * Version checks |
12 | 2961 | mdecorde | # * Registration and unregistration |
13 | 2961 | mdecorde | # * Registration and unregistration on reboot |
14 | 2961 | mdecorde | # * Shared DLL counting |
15 | 2961 | mdecorde | # * Windows File Protection checks |
16 | 2961 | mdecorde | # |
17 | 2961 | mdecorde | # For more information, read appendix B in the documentation. |
18 | 2961 | mdecorde | # |
19 | 2961 | mdecorde | |
20 | 2961 | mdecorde | !verbose push |
21 | 2961 | mdecorde | !verbose 3 |
22 | 2961 | mdecorde | |
23 | 2961 | mdecorde | !ifndef LIB_INCLUDED |
24 | 2961 | mdecorde | |
25 | 2961 | mdecorde | !define LIB_INCLUDED |
26 | 2961 | mdecorde | |
27 | 2961 | mdecorde | !ifndef SHCNE_ASSOCCHANGED |
28 | 2961 | mdecorde | !define SHCNE_ASSOCCHANGED 0x08000000 |
29 | 2961 | mdecorde | !endif |
30 | 2961 | mdecorde | !ifndef SHCNF_IDLIST |
31 | 2961 | mdecorde | !define SHCNF_IDLIST 0x0000 |
32 | 2961 | mdecorde | !endif |
33 | 2961 | mdecorde | |
34 | 2961 | mdecorde | !define REGTOOL_VERSION v3 |
35 | 2961 | mdecorde | !define REGTOOL_KEY NSIS.Library.RegTool.${REGTOOL_VERSION} |
36 | 2961 | mdecorde | |
37 | 2961 | mdecorde | !include LogicLib.nsh |
38 | 2961 | mdecorde | !include x64.nsh |
39 | 2961 | mdecorde | |
40 | 2961 | mdecorde | ### GetParent macro, don't pass $1 or $2 as INTPUT or OUTPUT |
41 | 2961 | mdecorde | !macro __InstallLib_Helper_GetParent INPUT OUTPUT |
42 | 2961 | mdecorde | |
43 | 2961 | mdecorde | # Copied from FileFunc.nsh |
44 | 2961 | mdecorde | |
45 | 2961 | mdecorde | StrCpy ${OUTPUT} ${INPUT} |
46 | 2961 | mdecorde | |
47 | 2961 | mdecorde | Push $1 |
48 | 2961 | mdecorde | Push $2 |
49 | 2961 | mdecorde | |
50 | 2961 | mdecorde | StrCpy $2 ${OUTPUT} 1 -1 |
51 | 2961 | mdecorde | StrCmp $2 '\' 0 +3 |
52 | 2961 | mdecorde | StrCpy ${OUTPUT} ${OUTPUT} -1 |
53 | 2961 | mdecorde | goto -3 |
54 | 2961 | mdecorde | |
55 | 2961 | mdecorde | StrCpy $1 0 |
56 | 2961 | mdecorde | IntOp $1 $1 - 1 |
57 | 2961 | mdecorde | StrCpy $2 ${OUTPUT} 1 $1 |
58 | 2961 | mdecorde | StrCmp $2 '\' +2 |
59 | 2961 | mdecorde | StrCmp $2 '' 0 -3 |
60 | 2961 | mdecorde | StrCpy ${OUTPUT} ${OUTPUT} $1 |
61 | 2961 | mdecorde | |
62 | 2961 | mdecorde | Pop $2 |
63 | 2961 | mdecorde | Pop $1 |
64 | 2961 | mdecorde | |
65 | 2961 | mdecorde | !macroend |
66 | 2961 | mdecorde | |
67 | 2961 | mdecorde | ### Initialize session id (GUID) |
68 | 2961 | mdecorde | !macro __InstallLib_Helper_InitSession |
69 | 2961 | mdecorde | |
70 | 2961 | mdecorde | !ifndef __InstallLib_SessionGUID_Defined |
71 | 2961 | mdecorde | |
72 | 2961 | mdecorde | !define __InstallLib_SessionGUID_Defined |
73 | 2961 | mdecorde | |
74 | 2961 | mdecorde | Var /GLOBAL __INSTALLLLIB_SESSIONGUID |
75 | 2961 | mdecorde | |
76 | 2961 | mdecorde | !endif |
77 | 2961 | mdecorde | |
78 | 2961 | mdecorde | !define __InstallLib_Helper_InitSession_Label "Library_${__FILE__}${__LINE__}" |
79 | 2961 | mdecorde | |
80 | 2961 | mdecorde | StrCmp $__INSTALLLLIB_SESSIONGUID '' 0 "${__InstallLib_Helper_InitSession_Label}" |
81 | 2961 | mdecorde | |
82 | 2961 | mdecorde | System::Call 'ole32::CoCreateGuid(g .s)' |
83 | 2961 | mdecorde | Pop $__INSTALLLLIB_SESSIONGUID |
84 | 2961 | mdecorde | |
85 | 2961 | mdecorde | "${__InstallLib_Helper_InitSession_Label}:" |
86 | 2961 | mdecorde | |
87 | 2961 | mdecorde | !undef __InstallLib_Helper_InitSession_Label |
88 | 2961 | mdecorde | |
89 | 2961 | mdecorde | !macroend |
90 | 2961 | mdecorde | |
91 | 2961 | mdecorde | ### Add a RegTool entry to register after reboot |
92 | 2961 | mdecorde | !macro __InstallLib_Helper_AddRegToolEntry mode filename tempdir |
93 | 2961 | mdecorde | |
94 | 2961 | mdecorde | Push $R0 |
95 | 2961 | mdecorde | Push $R1 |
96 | 2961 | mdecorde | Push $R2 |
97 | 2961 | mdecorde | Push $R3 |
98 | 2961 | mdecorde | |
99 | 2961 | mdecorde | ;------------------------ |
100 | 2961 | mdecorde | ;Copy the parameters |
101 | 2961 | mdecorde | |
102 | 2961 | mdecorde | Push "${filename}" |
103 | 2961 | mdecorde | Push "${tempdir}" |
104 | 2961 | mdecorde | |
105 | 2961 | mdecorde | Pop $R2 ; temporary directory |
106 | 2961 | mdecorde | Pop $R1 ; file name to register |
107 | 2961 | mdecorde | |
108 | 2961 | mdecorde | ;------------------------ |
109 | 2961 | mdecorde | ;Initialize session id |
110 | 2961 | mdecorde | |
111 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_InitSession |
112 | 2961 | mdecorde | |
113 | 2961 | mdecorde | ;------------------------ |
114 | 2961 | mdecorde | ;Advance counter |
115 | 2961 | mdecorde | |
116 | 2961 | mdecorde | StrCpy $R0 0 |
117 | 2961 | mdecorde | ReadRegDWORD $R0 HKLM "Software\${REGTOOL_KEY}\$__INSTALLLLIB_SESSIONGUID" "count" |
118 | 2961 | mdecorde | IntOp $R0 $R0 + 1 |
119 | 2961 | mdecorde | WriteRegDWORD HKLM "Software\${REGTOOL_KEY}\$__INSTALLLLIB_SESSIONGUID" "count" "$R0" |
120 | 2961 | mdecorde | |
121 | 2961 | mdecorde | ;------------------------ |
122 | 2961 | mdecorde | ;Setup RegTool |
123 | 2961 | mdecorde | |
124 | 2961 | mdecorde | ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "${REGTOOL_KEY}" |
125 | 2961 | mdecorde | StrCpy $R3 $R3 -4 1 |
126 | 2961 | mdecorde | IfFileExists $R3 +3 |
127 | 2961 | mdecorde | |
128 | 2961 | mdecorde | File /oname=$R2\${REGTOOL_KEY}.$__INSTALLLLIB_SESSIONGUID.exe "${NSISDIR}\Bin\RegTool.bin" |
129 | 2961 | mdecorde | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \ |
130 | 2961 | mdecorde | "${REGTOOL_KEY}" '"$R2\${REGTOOL_KEY}.$__INSTALLLLIB_SESSIONGUID.exe" /S' |
131 | 2961 | mdecorde | |
132 | 2961 | mdecorde | ;------------------------ |
133 | 2961 | mdecorde | ;Add RegTool entry |
134 | 2961 | mdecorde | |
135 | 2961 | mdecorde | WriteRegStr HKLM "Software\${REGTOOL_KEY}\$__INSTALLLLIB_SESSIONGUID" "$R0.file" "$R1" |
136 | 2961 | mdecorde | WriteRegStr HKLM "Software\${REGTOOL_KEY}\$__INSTALLLLIB_SESSIONGUID" "$R0.mode" "${mode}" |
137 | 2961 | mdecorde | |
138 | 2961 | mdecorde | Pop $R3 |
139 | 2961 | mdecorde | Pop $R2 |
140 | 2961 | mdecorde | Pop $R1 |
141 | 2961 | mdecorde | Pop $R0 |
142 | 2961 | mdecorde | |
143 | 2961 | mdecorde | !macroend |
144 | 2961 | mdecorde | |
145 | 2961 | mdecorde | ### Get library version |
146 | 2961 | mdecorde | !macro __InstallLib_Helper_GetVersion TYPE FILE |
147 | 2961 | mdecorde | |
148 | 2961 | mdecorde | !tempfile LIBRARY_TEMP_NSH |
149 | 2961 | mdecorde | |
150 | 2961 | mdecorde | !ifdef NSIS_WIN32_MAKENSIS |
151 | 2961 | mdecorde | |
152 | 2961 | mdecorde | !execute '"${NSISDIR}\Bin\LibraryLocal.exe" "${TYPE}" "${FILE}" "${LIBRARY_TEMP_NSH}"' |
153 | 2961 | mdecorde | |
154 | 2961 | mdecorde | !else |
155 | 2961 | mdecorde | |
156 | 2961 | mdecorde | !execute 'LibraryLocal "${TYPE}" "${FILE}" "${LIBRARY_TEMP_NSH}"' |
157 | 2961 | mdecorde | |
158 | 2961 | mdecorde | !if ${TYPE} == 'T' |
159 | 2961 | mdecorde | |
160 | 2961 | mdecorde | !warning "LibraryLocal currently supports TypeLibs version detection on Windows only" |
161 | 2961 | mdecorde | |
162 | 2961 | mdecorde | !endif |
163 | 2961 | mdecorde | |
164 | 2961 | mdecorde | !endif |
165 | 2961 | mdecorde | |
166 | 2961 | mdecorde | !include "${LIBRARY_TEMP_NSH}" |
167 | 2961 | mdecorde | !delfile "${LIBRARY_TEMP_NSH}" |
168 | 2961 | mdecorde | !undef LIBRARY_TEMP_NSH |
169 | 2961 | mdecorde | |
170 | 2961 | mdecorde | !macroend |
171 | 2961 | mdecorde | |
172 | 2961 | mdecorde | ### Install library |
173 | 2961 | mdecorde | !macro InstallLib libtype shared install localfile destfile tempbasedir |
174 | 2961 | mdecorde | |
175 | 2961 | mdecorde | !verbose push |
176 | 2961 | mdecorde | !verbose 3 |
177 | 2961 | mdecorde | |
178 | 2961 | mdecorde | Push $R0 |
179 | 2961 | mdecorde | Push $R1 |
180 | 2961 | mdecorde | Push $R2 |
181 | 2961 | mdecorde | Push $R3 |
182 | 2961 | mdecorde | Push $R4 |
183 | 2961 | mdecorde | Push $R5 |
184 | 2961 | mdecorde | |
185 | 2961 | mdecorde | ;------------------------ |
186 | 2961 | mdecorde | ;Define |
187 | 2961 | mdecorde | |
188 | 2961 | mdecorde | !define INSTALLLIB_UNIQUE "${__FILE__}${__LINE__}" |
189 | 2961 | mdecorde | |
190 | 2961 | mdecorde | !define INSTALLLIB_LIBTYPE_${libtype} |
191 | 2961 | mdecorde | !define INSTALLLIB_LIBTYPE_SET INSTALLLIB_LIBTYPE_${libtype} |
192 | 2961 | mdecorde | !define INSTALLLIB_SHARED_${shared} |
193 | 2961 | mdecorde | !define INSTALLLIB_SHARED_SET INSTALLLIB_SHARED_${shared} |
194 | 2961 | mdecorde | !define INSTALLLIB_INSTALL_${install} |
195 | 2961 | mdecorde | !define INSTALLLIB_INSTALL_SET INSTALLLIB_INSTALL_${install} |
196 | 2961 | mdecorde | |
197 | 2961 | mdecorde | ;------------------------ |
198 | 2961 | mdecorde | ;Validate |
199 | 2961 | mdecorde | |
200 | 2961 | mdecorde | !ifndef INSTALLLIB_LIBTYPE_DLL & INSTALLLIB_LIBTYPE_REGDLL & INSTALLLIB_LIBTYPE_TLB & \ |
201 | 2961 | mdecorde | INSTALLLIB_LIBTYPE_REGDLLTLB & INSTALLLIB_LIBTYPE_REGEXE |
202 | 2961 | mdecorde | !error "InstallLib: Incorrect setting for parameter: libtype" |
203 | 2961 | mdecorde | !endif |
204 | 2961 | mdecorde | |
205 | 2961 | mdecorde | !ifndef INSTALLLIB_INSTALL_REBOOT_PROTECTED & INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED & \ |
206 | 2961 | mdecorde | INSTALLLIB_INSTALL_NOREBOOT_PROTECTED & INSTALLLIB_INSTALL_NOREBOOT_NOTPROTECTED |
207 | 2961 | mdecorde | !error "InstallLib: Incorrect setting for parameter: install" |
208 | 2961 | mdecorde | !endif |
209 | 2961 | mdecorde | |
210 | 2961 | mdecorde | ;------------------------ |
211 | 2961 | mdecorde | ;x64 settings |
212 | 2961 | mdecorde | |
213 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
214 | 2961 | mdecorde | |
215 | 2961 | mdecorde | ${DisableX64FSRedirection} |
216 | 2961 | mdecorde | |
217 | 2961 | mdecorde | !endif |
218 | 2961 | mdecorde | |
219 | 2961 | mdecorde | ;------------------------ |
220 | 2961 | mdecorde | ;Copy the parameters used on run-time to a variable |
221 | 2961 | mdecorde | ;This allows the usage of variables as parameter |
222 | 2961 | mdecorde | |
223 | 2961 | mdecorde | StrCpy $R4 "${destfile}" |
224 | 2961 | mdecorde | StrCpy $R5 "${tempbasedir}" |
225 | 2961 | mdecorde | |
226 | 2961 | mdecorde | ;------------------------ |
227 | 2961 | mdecorde | ;Shared library count |
228 | 2961 | mdecorde | |
229 | 2961 | mdecorde | !ifndef INSTALLLIB_SHARED_NOTSHARED |
230 | 2961 | mdecorde | |
231 | 2961 | mdecorde | StrCmp ${shared} "" 0 "installlib.noshareddllincrease_${INSTALLLIB_UNIQUE}" |
232 | 2961 | mdecorde | |
233 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
234 | 2961 | mdecorde | |
235 | 2961 | mdecorde | SetRegView 64 |
236 | 2961 | mdecorde | |
237 | 2961 | mdecorde | !endif |
238 | 2961 | mdecorde | |
239 | 2961 | mdecorde | ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R4 |
240 | 2961 | mdecorde | ClearErrors |
241 | 2961 | mdecorde | IntOp $R0 $R0 + 1 |
242 | 2961 | mdecorde | WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R4 $R0 |
243 | 2961 | mdecorde | |
244 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
245 | 2961 | mdecorde | |
246 | 2961 | mdecorde | SetRegView lastused |
247 | 2961 | mdecorde | |
248 | 2961 | mdecorde | !endif |
249 | 2961 | mdecorde | |
250 | 2961 | mdecorde | "installlib.noshareddllincrease_${INSTALLLIB_UNIQUE}:" |
251 | 2961 | mdecorde | |
252 | 2961 | mdecorde | !endif |
253 | 2961 | mdecorde | |
254 | 2961 | mdecorde | ;------------------------ |
255 | 2961 | mdecorde | ;Check Windows File Protection |
256 | 2961 | mdecorde | |
257 | 2961 | mdecorde | !ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_NOREBOOT_PROTECTED |
258 | 2961 | mdecorde | |
259 | 2961 | mdecorde | !define LIBRARY_DEFINE_DONE_LABEL |
260 | 2961 | mdecorde | |
261 | 2961 | mdecorde | System::Call "sfc::SfcIsFileProtected(i 0, w R4) i.R0" |
262 | 2961 | mdecorde | |
263 | 2961 | mdecorde | StrCmp $R0 "error" "installlib.notprotected_${INSTALLLIB_UNIQUE}" |
264 | 2961 | mdecorde | StrCmp $R0 "0" "installlib.notprotected_${INSTALLLIB_UNIQUE}" |
265 | 2961 | mdecorde | |
266 | 2961 | mdecorde | Goto "installlib.done_${INSTALLLIB_UNIQUE}" |
267 | 2961 | mdecorde | |
268 | 2961 | mdecorde | "installlib.notprotected_${INSTALLLIB_UNIQUE}:" |
269 | 2961 | mdecorde | |
270 | 2961 | mdecorde | !endif |
271 | 2961 | mdecorde | |
272 | 2961 | mdecorde | ;------------------------ |
273 | 2961 | mdecorde | ;Check file |
274 | 2961 | mdecorde | |
275 | 2961 | mdecorde | IfFileExists $R4 0 "installlib.copy_${INSTALLLIB_UNIQUE}" |
276 | 2961 | mdecorde | |
277 | 2961 | mdecorde | ;------------------------ |
278 | 2961 | mdecorde | ;Get version information |
279 | 2961 | mdecorde | |
280 | 2961 | mdecorde | !ifndef LIBRARY_IGNORE_VERSION |
281 | 2961 | mdecorde | |
282 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_GetVersion D "${LOCALFILE}" |
283 | 2961 | mdecorde | |
284 | 2961 | mdecorde | !ifdef LIBRARY_VERSION_FILENOTFOUND |
285 | 2961 | mdecorde | !error "InstallLib: The library ${LOCALFILE} could not be found." |
286 | 2961 | mdecorde | !endif |
287 | 2961 | mdecorde | |
288 | 2961 | mdecorde | !ifndef LIBRARY_VERSION_NONE |
289 | 2961 | mdecorde | |
290 | 2961 | mdecorde | !define LIBRARY_DEFINE_UPGRADE_LABEL |
291 | 2961 | mdecorde | !define LIBRARY_DEFINE_REGISTER_LABEL |
292 | 2961 | mdecorde | |
293 | 2961 | mdecorde | StrCpy $R0 ${LIBRARY_VERSION_HIGH} |
294 | 2961 | mdecorde | StrCpy $R1 ${LIBRARY_VERSION_LOW} |
295 | 2961 | mdecorde | |
296 | 2961 | mdecorde | GetDLLVersion $R4 $R2 $R3 |
297 | 2961 | mdecorde | |
298 | 2961 | mdecorde | !undef LIBRARY_VERSION_HIGH |
299 | 2961 | mdecorde | !undef LIBRARY_VERSION_LOW |
300 | 2961 | mdecorde | |
301 | 2961 | mdecorde | !ifndef INSTALLLIB_LIBTYPE_TLB & INSTALLLIB_LIBTYPE_REGDLLTLB |
302 | 2961 | mdecorde | |
303 | 2961 | mdecorde | IntCmpU $R0 $R2 0 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
304 | 2961 | mdecorde | IntCmpU $R1 $R3 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.register_${INSTALLLIB_UNIQUE}" \ |
305 | 2961 | mdecorde | "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
306 | 2961 | mdecorde | |
307 | 2961 | mdecorde | !else |
308 | 2961 | mdecorde | |
309 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_GetVersion T "${LOCALFILE}" |
310 | 2961 | mdecorde | |
311 | 2961 | mdecorde | !ifdef LIBRARY_VERSION_FILENOTFOUND |
312 | 2961 | mdecorde | !error "InstallLib: The library ${LOCALFILE} could not be found." |
313 | 2961 | mdecorde | !endif |
314 | 2961 | mdecorde | |
315 | 2961 | mdecorde | !ifndef LIBRARY_VERSION_NONE |
316 | 2961 | mdecorde | |
317 | 2961 | mdecorde | IntCmpU $R0 $R2 0 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
318 | 2961 | mdecorde | IntCmpU $R1 $R3 0 "installlib.register_${INSTALLLIB_UNIQUE}" \ |
319 | 2961 | mdecorde | "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
320 | 2961 | mdecorde | |
321 | 2961 | mdecorde | !else |
322 | 2961 | mdecorde | |
323 | 2961 | mdecorde | IntCmpU $R0 $R2 0 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
324 | 2961 | mdecorde | IntCmpU $R1 $R3 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.register_${INSTALLLIB_UNIQUE}" \ |
325 | 2961 | mdecorde | "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
326 | 2961 | mdecorde | |
327 | 2961 | mdecorde | !endif |
328 | 2961 | mdecorde | |
329 | 2961 | mdecorde | !endif |
330 | 2961 | mdecorde | |
331 | 2961 | mdecorde | !else |
332 | 2961 | mdecorde | |
333 | 2961 | mdecorde | !undef LIBRARY_VERSION_NONE |
334 | 2961 | mdecorde | |
335 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB |
336 | 2961 | mdecorde | |
337 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_GetVersion T "${LOCALFILE}" |
338 | 2961 | mdecorde | |
339 | 2961 | mdecorde | !endif |
340 | 2961 | mdecorde | |
341 | 2961 | mdecorde | !endif |
342 | 2961 | mdecorde | |
343 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB |
344 | 2961 | mdecorde | |
345 | 2961 | mdecorde | !ifndef LIBRARY_VERSION_NONE |
346 | 2961 | mdecorde | |
347 | 2961 | mdecorde | !ifndef LIBRARY_DEFINE_UPGRADE_LABEL |
348 | 2961 | mdecorde | |
349 | 2961 | mdecorde | !define LIBRARY_DEFINE_UPGRADE_LABEL |
350 | 2961 | mdecorde | |
351 | 2961 | mdecorde | !endif |
352 | 2961 | mdecorde | |
353 | 2961 | mdecorde | !ifndef LIBRARY_DEFINE_REGISTER_LABEL |
354 | 2961 | mdecorde | |
355 | 2961 | mdecorde | !define LIBRARY_DEFINE_REGISTER_LABEL |
356 | 2961 | mdecorde | |
357 | 2961 | mdecorde | !endif |
358 | 2961 | mdecorde | |
359 | 2961 | mdecorde | StrCpy $R0 ${LIBRARY_VERSION_HIGH} |
360 | 2961 | mdecorde | StrCpy $R1 ${LIBRARY_VERSION_LOW} |
361 | 2961 | mdecorde | |
362 | 2961 | mdecorde | TypeLib::GetLibVersion $R4 |
363 | 2961 | mdecorde | Pop $R3 |
364 | 2961 | mdecorde | Pop $R2 |
365 | 2961 | mdecorde | |
366 | 2961 | mdecorde | IntCmpU $R0 $R2 0 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
367 | 2961 | mdecorde | IntCmpU $R1 $R3 "installlib.register_${INSTALLLIB_UNIQUE}" "installlib.register_${INSTALLLIB_UNIQUE}" \ |
368 | 2961 | mdecorde | "installlib.upgrade_${INSTALLLIB_UNIQUE}" |
369 | 2961 | mdecorde | |
370 | 2961 | mdecorde | !undef LIBRARY_VERSION_HIGH |
371 | 2961 | mdecorde | !undef LIBRARY_VERSION_LOW |
372 | 2961 | mdecorde | |
373 | 2961 | mdecorde | !else |
374 | 2961 | mdecorde | |
375 | 2961 | mdecorde | !undef LIBRARY_VERSION_NONE |
376 | 2961 | mdecorde | |
377 | 2961 | mdecorde | !endif |
378 | 2961 | mdecorde | |
379 | 2961 | mdecorde | !endif |
380 | 2961 | mdecorde | |
381 | 2961 | mdecorde | !endif |
382 | 2961 | mdecorde | |
383 | 2961 | mdecorde | ;------------------------ |
384 | 2961 | mdecorde | ;Upgrade |
385 | 2961 | mdecorde | |
386 | 2961 | mdecorde | !ifdef LIBRARY_DEFINE_UPGRADE_LABEL |
387 | 2961 | mdecorde | |
388 | 2961 | mdecorde | !undef LIBRARY_DEFINE_UPGRADE_LABEL |
389 | 2961 | mdecorde | |
390 | 2961 | mdecorde | "installlib.upgrade_${INSTALLLIB_UNIQUE}:" |
391 | 2961 | mdecorde | |
392 | 2961 | mdecorde | !endif |
393 | 2961 | mdecorde | |
394 | 2961 | mdecorde | ;------------------------ |
395 | 2961 | mdecorde | ;Copy |
396 | 2961 | mdecorde | |
397 | 2961 | mdecorde | !ifdef INSTALLLIB_INSTALL_NOREBOOT_PROTECTED | INSTALLLIB_INSTALL_NOREBOOT_NOTPROTECTED |
398 | 2961 | mdecorde | |
399 | 2961 | mdecorde | "installlib.copy_${INSTALLLIB_UNIQUE}:" |
400 | 2961 | mdecorde | |
401 | 2961 | mdecorde | StrCpy $R0 $R4 |
402 | 2961 | mdecorde | Call ":installlib.file_${INSTALLLIB_UNIQUE}" |
403 | 2961 | mdecorde | |
404 | 2961 | mdecorde | !else |
405 | 2961 | mdecorde | |
406 | 2961 | mdecorde | !ifndef LIBRARY_DEFINE_REGISTER_LABEL |
407 | 2961 | mdecorde | |
408 | 2961 | mdecorde | !define LIBRARY_DEFINE_REGISTER_LABEL |
409 | 2961 | mdecorde | |
410 | 2961 | mdecorde | !endif |
411 | 2961 | mdecorde | |
412 | 2961 | mdecorde | !ifndef LIBRARY_DEFINE_DONE_LABEL |
413 | 2961 | mdecorde | |
414 | 2961 | mdecorde | !define LIBRARY_DEFINE_DONE_LABEL |
415 | 2961 | mdecorde | |
416 | 2961 | mdecorde | !endif |
417 | 2961 | mdecorde | |
418 | 2961 | mdecorde | ClearErrors |
419 | 2961 | mdecorde | |
420 | 2961 | mdecorde | StrCpy $R0 $R4 |
421 | 2961 | mdecorde | Call ":installlib.file_${INSTALLLIB_UNIQUE}" |
422 | 2961 | mdecorde | |
423 | 2961 | mdecorde | IfErrors 0 "installlib.register_${INSTALLLIB_UNIQUE}" |
424 | 2961 | mdecorde | |
425 | 2961 | mdecorde | SetOverwrite lastused |
426 | 2961 | mdecorde | |
427 | 2961 | mdecorde | ;------------------------ |
428 | 2961 | mdecorde | ;Copy on reboot |
429 | 2961 | mdecorde | |
430 | 2961 | mdecorde | GetTempFileName $R0 $R5 |
431 | 2961 | mdecorde | Call ":installlib.file_${INSTALLLIB_UNIQUE}" |
432 | 2961 | mdecorde | Rename /REBOOTOK $R0 $R4 |
433 | 2961 | mdecorde | |
434 | 2961 | mdecorde | ;------------------------ |
435 | 2961 | mdecorde | ;Register on reboot |
436 | 2961 | mdecorde | |
437 | 2961 | mdecorde | Call ":installlib.regonreboot_${INSTALLLIB_UNIQUE}" |
438 | 2961 | mdecorde | |
439 | 2961 | mdecorde | Goto "installlib.done_${INSTALLLIB_UNIQUE}" |
440 | 2961 | mdecorde | |
441 | 2961 | mdecorde | "installlib.copy_${INSTALLLIB_UNIQUE}:" |
442 | 2961 | mdecorde | StrCpy $R0 $R4 |
443 | 2961 | mdecorde | Call ":installlib.file_${INSTALLLIB_UNIQUE}" |
444 | 2961 | mdecorde | |
445 | 2961 | mdecorde | !endif |
446 | 2961 | mdecorde | |
447 | 2961 | mdecorde | ;------------------------ |
448 | 2961 | mdecorde | ;Register |
449 | 2961 | mdecorde | |
450 | 2961 | mdecorde | !ifdef LIBRARY_DEFINE_REGISTER_LABEL |
451 | 2961 | mdecorde | |
452 | 2961 | mdecorde | !undef LIBRARY_DEFINE_REGISTER_LABEL |
453 | 2961 | mdecorde | |
454 | 2961 | mdecorde | "installlib.register_${INSTALLLIB_UNIQUE}:" |
455 | 2961 | mdecorde | |
456 | 2961 | mdecorde | !endif |
457 | 2961 | mdecorde | |
458 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB | INSTALLLIB_LIBTYPE_REGEXE |
459 | 2961 | mdecorde | |
460 | 2961 | mdecorde | !ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED |
461 | 2961 | mdecorde | |
462 | 2961 | mdecorde | IfRebootFlag 0 "installlib.regnoreboot_${INSTALLLIB_UNIQUE}" |
463 | 2961 | mdecorde | |
464 | 2961 | mdecorde | Call ":installlib.regonreboot_${INSTALLLIB_UNIQUE}" |
465 | 2961 | mdecorde | |
466 | 2961 | mdecorde | Goto "installlib.registerfinish_${INSTALLLIB_UNIQUE}" |
467 | 2961 | mdecorde | |
468 | 2961 | mdecorde | "installlib.regnoreboot_${INSTALLLIB_UNIQUE}:" |
469 | 2961 | mdecorde | |
470 | 2961 | mdecorde | !endif |
471 | 2961 | mdecorde | |
472 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB |
473 | 2961 | mdecorde | |
474 | 2961 | mdecorde | TypeLib::Register $R4 |
475 | 2961 | mdecorde | |
476 | 2961 | mdecorde | !endif |
477 | 2961 | mdecorde | |
478 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_REGDLLTLB |
479 | 2961 | mdecorde | |
480 | 2961 | mdecorde | !ifndef LIBRARY_X64 |
481 | 2961 | mdecorde | |
482 | 2961 | mdecorde | RegDll $R4 |
483 | 2961 | mdecorde | |
484 | 2961 | mdecorde | !else |
485 | 2961 | mdecorde | |
486 | 2961 | mdecorde | ExecWait '"$SYSDIR\regsvr32.exe" /s "$R4"' |
487 | 2961 | mdecorde | |
488 | 2961 | mdecorde | !endif |
489 | 2961 | mdecorde | |
490 | 2961 | mdecorde | !endif |
491 | 2961 | mdecorde | |
492 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_REGEXE |
493 | 2961 | mdecorde | |
494 | 2961 | mdecorde | ExecWait '"$R4" /regserver' |
495 | 2961 | mdecorde | |
496 | 2961 | mdecorde | !endif |
497 | 2961 | mdecorde | |
498 | 2961 | mdecorde | !ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED |
499 | 2961 | mdecorde | |
500 | 2961 | mdecorde | "installlib.registerfinish_${INSTALLLIB_UNIQUE}:" |
501 | 2961 | mdecorde | |
502 | 2961 | mdecorde | !endif |
503 | 2961 | mdecorde | |
504 | 2961 | mdecorde | !endif |
505 | 2961 | mdecorde | |
506 | 2961 | mdecorde | !ifdef LIBRARY_SHELL_EXTENSION |
507 | 2961 | mdecorde | |
508 | 2961 | mdecorde | System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' |
509 | 2961 | mdecorde | |
510 | 2961 | mdecorde | !endif |
511 | 2961 | mdecorde | |
512 | 2961 | mdecorde | !ifdef LIBRARY_COM |
513 | 2961 | mdecorde | |
514 | 2961 | mdecorde | System::Call 'Ole32::CoFreeUnusedLibraries()' |
515 | 2961 | mdecorde | |
516 | 2961 | mdecorde | !endif |
517 | 2961 | mdecorde | |
518 | 2961 | mdecorde | ;------------------------ |
519 | 2961 | mdecorde | ;Done |
520 | 2961 | mdecorde | |
521 | 2961 | mdecorde | !ifdef LIBRARY_DEFINE_DONE_LABEL |
522 | 2961 | mdecorde | |
523 | 2961 | mdecorde | !undef LIBRARY_DEFINE_DONE_LABEL |
524 | 2961 | mdecorde | |
525 | 2961 | mdecorde | "installlib.done_${INSTALLLIB_UNIQUE}:" |
526 | 2961 | mdecorde | |
527 | 2961 | mdecorde | !endif |
528 | 2961 | mdecorde | |
529 | 2961 | mdecorde | Pop $R5 |
530 | 2961 | mdecorde | Pop $R4 |
531 | 2961 | mdecorde | Pop $R3 |
532 | 2961 | mdecorde | Pop $R2 |
533 | 2961 | mdecorde | Pop $R1 |
534 | 2961 | mdecorde | Pop $R0 |
535 | 2961 | mdecorde | |
536 | 2961 | mdecorde | ;------------------------ |
537 | 2961 | mdecorde | ;End |
538 | 2961 | mdecorde | |
539 | 2961 | mdecorde | Goto "installlib.end_${INSTALLLIB_UNIQUE}" |
540 | 2961 | mdecorde | |
541 | 2961 | mdecorde | ;------------------------ |
542 | 2961 | mdecorde | ;Extract |
543 | 2961 | mdecorde | |
544 | 2961 | mdecorde | !ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED |
545 | 2961 | mdecorde | |
546 | 2961 | mdecorde | SetOverwrite try |
547 | 2961 | mdecorde | |
548 | 2961 | mdecorde | !else |
549 | 2961 | mdecorde | |
550 | 2961 | mdecorde | SetOverwrite on |
551 | 2961 | mdecorde | |
552 | 2961 | mdecorde | !endif |
553 | 2961 | mdecorde | |
554 | 2961 | mdecorde | "installlib.file_${INSTALLLIB_UNIQUE}:" |
555 | 2961 | mdecorde | SetFileAttributes $R0 FILE_ATTRIBUTE_NORMAL |
556 | 2961 | mdecorde | ClearErrors |
557 | 2961 | mdecorde | File /oname=$R0 "${LOCALFILE}" |
558 | 2961 | mdecorde | Return |
559 | 2961 | mdecorde | |
560 | 2961 | mdecorde | SetOverwrite lastused |
561 | 2961 | mdecorde | |
562 | 2961 | mdecorde | ;------------------------ |
563 | 2961 | mdecorde | ;Register on reboot |
564 | 2961 | mdecorde | |
565 | 2961 | mdecorde | !ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED |
566 | 2961 | mdecorde | |
567 | 2961 | mdecorde | "installlib.regonreboot_${INSTALLLIB_UNIQUE}:" |
568 | 2961 | mdecorde | |
569 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_REGDLLTLB |
570 | 2961 | mdecorde | !ifndef LIBRARY_X64 |
571 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_AddRegToolEntry 'D' "$R4" "$R5" |
572 | 2961 | mdecorde | !else |
573 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_AddRegToolEntry 'DX' "$R4" "$R5" |
574 | 2961 | mdecorde | !endif |
575 | 2961 | mdecorde | !endif |
576 | 2961 | mdecorde | |
577 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB |
578 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_AddRegToolEntry 'T' "$R4" "$R5" |
579 | 2961 | mdecorde | !endif |
580 | 2961 | mdecorde | |
581 | 2961 | mdecorde | !ifdef INSTALLLIB_LIBTYPE_REGEXE |
582 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_AddRegToolEntry 'E' "$R4" "$R5" |
583 | 2961 | mdecorde | !endif |
584 | 2961 | mdecorde | |
585 | 2961 | mdecorde | Return |
586 | 2961 | mdecorde | |
587 | 2961 | mdecorde | !endif |
588 | 2961 | mdecorde | |
589 | 2961 | mdecorde | ;------------------------ |
590 | 2961 | mdecorde | ;End label |
591 | 2961 | mdecorde | |
592 | 2961 | mdecorde | "installlib.end_${INSTALLLIB_UNIQUE}:" |
593 | 2961 | mdecorde | |
594 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
595 | 2961 | mdecorde | |
596 | 2961 | mdecorde | ${EnableX64FSRedirection} |
597 | 2961 | mdecorde | |
598 | 2961 | mdecorde | !endif |
599 | 2961 | mdecorde | |
600 | 2961 | mdecorde | ;------------------------ |
601 | 2961 | mdecorde | ;Undefine |
602 | 2961 | mdecorde | |
603 | 2961 | mdecorde | !undef INSTALLLIB_UNIQUE |
604 | 2961 | mdecorde | |
605 | 2961 | mdecorde | !undef ${INSTALLLIB_LIBTYPE_SET} |
606 | 2961 | mdecorde | !undef INSTALLLIB_LIBTYPE_SET |
607 | 2961 | mdecorde | !undef ${INSTALLLIB_SHARED_SET} |
608 | 2961 | mdecorde | !undef INSTALLLIB_SHARED_SET |
609 | 2961 | mdecorde | !undef ${INSTALLLIB_INSTALL_SET} |
610 | 2961 | mdecorde | !undef INSTALLLIB_INSTALL_SET |
611 | 2961 | mdecorde | |
612 | 2961 | mdecorde | !verbose pop |
613 | 2961 | mdecorde | |
614 | 2961 | mdecorde | !macroend |
615 | 2961 | mdecorde | |
616 | 2961 | mdecorde | ### Uninstall library |
617 | 2961 | mdecorde | !macro UnInstallLib libtype shared uninstall file |
618 | 2961 | mdecorde | |
619 | 2961 | mdecorde | !verbose push |
620 | 2961 | mdecorde | !verbose 3 |
621 | 2961 | mdecorde | |
622 | 2961 | mdecorde | Push $R0 |
623 | 2961 | mdecorde | Push $R1 |
624 | 2961 | mdecorde | |
625 | 2961 | mdecorde | ;------------------------ |
626 | 2961 | mdecorde | ;Define |
627 | 2961 | mdecorde | |
628 | 2961 | mdecorde | !define UNINSTALLLIB_UNIQUE "${__FILE__}${__LINE__}" |
629 | 2961 | mdecorde | |
630 | 2961 | mdecorde | !define UNINSTALLLIB_LIBTYPE_${libtype} |
631 | 2961 | mdecorde | !define UNINSTALLLIB_LIBTYPE_SET UNINSTALLLIB_LIBTYPE_${libtype} |
632 | 2961 | mdecorde | !define UNINSTALLLIB_SHARED_${shared} |
633 | 2961 | mdecorde | !define UNINSTALLLIB_SHARED_SET UNINSTALLLIB_SHARED_${shared} |
634 | 2961 | mdecorde | !define UNINSTALLLIB_UNINSTALL_${uninstall} |
635 | 2961 | mdecorde | !define UNINSTALLLIB_UNINSTALL_SET UNINSTALLLIB_UNINSTALL_${uninstall} |
636 | 2961 | mdecorde | |
637 | 2961 | mdecorde | ;------------------------ |
638 | 2961 | mdecorde | ;Validate |
639 | 2961 | mdecorde | |
640 | 2961 | mdecorde | !ifndef UNINSTALLLIB_LIBTYPE_DLL & UNINSTALLLIB_LIBTYPE_REGDLL & UNINSTALLLIB_LIBTYPE_TLB & \ |
641 | 2961 | mdecorde | UNINSTALLLIB_LIBTYPE_REGDLLTLB & UNINSTALLLIB_LIBTYPE_REGEXE |
642 | 2961 | mdecorde | !error "UnInstallLib: Incorrect setting for parameter: libtype" |
643 | 2961 | mdecorde | !endif |
644 | 2961 | mdecorde | |
645 | 2961 | mdecorde | !ifndef UNINSTALLLIB_SHARED_NOTSHARED & UNINSTALLLIB_SHARED_SHARED |
646 | 2961 | mdecorde | !error "UnInstallLib: Incorrect setting for parameter: shared" |
647 | 2961 | mdecorde | !endif |
648 | 2961 | mdecorde | |
649 | 2961 | mdecorde | !ifndef UNINSTALLLIB_UNINSTALL_NOREMOVE & UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED & \ |
650 | 2961 | mdecorde | UNINSTALLLIB_UNINSTALL_REBOOT_NOTPROTECTED & UNINSTALLLIB_UNINSTALL_NOREBOOT_PROTECTED & \ |
651 | 2961 | mdecorde | UNINSTALLLIB_UNINSTALL_NOREBOOT_NOTPROTECTED |
652 | 2961 | mdecorde | !error "UnInstallLib: Incorrect setting for parameter: uninstall" |
653 | 2961 | mdecorde | !endif |
654 | 2961 | mdecorde | |
655 | 2961 | mdecorde | ;------------------------ |
656 | 2961 | mdecorde | ;x64 settings |
657 | 2961 | mdecorde | |
658 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
659 | 2961 | mdecorde | |
660 | 2961 | mdecorde | ${DisableX64FSRedirection} |
661 | 2961 | mdecorde | |
662 | 2961 | mdecorde | !endif |
663 | 2961 | mdecorde | |
664 | 2961 | mdecorde | ;------------------------ |
665 | 2961 | mdecorde | ;Copy the parameters used on run-time to a variable |
666 | 2961 | mdecorde | ;This allows the usage of variables as parameter |
667 | 2961 | mdecorde | |
668 | 2961 | mdecorde | StrCpy $R1 "${file}" |
669 | 2961 | mdecorde | |
670 | 2961 | mdecorde | ;------------------------ |
671 | 2961 | mdecorde | ;Shared library count |
672 | 2961 | mdecorde | |
673 | 2961 | mdecorde | !ifdef UNINSTALLLIB_SHARED_SHARED |
674 | 2961 | mdecorde | |
675 | 2961 | mdecorde | !define UNINSTALLLIB_DONE_LABEL |
676 | 2961 | mdecorde | |
677 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
678 | 2961 | mdecorde | |
679 | 2961 | mdecorde | SetRegView 64 |
680 | 2961 | mdecorde | |
681 | 2961 | mdecorde | !endif |
682 | 2961 | mdecorde | |
683 | 2961 | mdecorde | ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 |
684 | 2961 | mdecorde | StrCmp $R0 "" "uninstalllib.shareddlldone_${UNINSTALLLIB_UNIQUE}" |
685 | 2961 | mdecorde | |
686 | 2961 | mdecorde | IntOp $R0 $R0 - 1 |
687 | 2961 | mdecorde | IntCmp $R0 0 "uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE}" \ |
688 | 2961 | mdecorde | "uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE}" "uninstalllib.shareddllinuse_${UNINSTALLLIB_UNIQUE}" |
689 | 2961 | mdecorde | |
690 | 2961 | mdecorde | "uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE}:" |
691 | 2961 | mdecorde | DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 |
692 | 2961 | mdecorde | !ifndef UNINSTALLLIB_SHARED_SHAREDNOREMOVE |
693 | 2961 | mdecorde | Goto "uninstalllib.shareddlldone_${UNINSTALLLIB_UNIQUE}" |
694 | 2961 | mdecorde | !endif |
695 | 2961 | mdecorde | |
696 | 2961 | mdecorde | "uninstalllib.shareddllinuse_${UNINSTALLLIB_UNIQUE}:" |
697 | 2961 | mdecorde | WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0 |
698 | 2961 | mdecorde | |
699 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
700 | 2961 | mdecorde | |
701 | 2961 | mdecorde | SetRegView lastused |
702 | 2961 | mdecorde | |
703 | 2961 | mdecorde | !endif |
704 | 2961 | mdecorde | |
705 | 2961 | mdecorde | Goto "uninstalllib.done_${UNINSTALLLIB_UNIQUE}" |
706 | 2961 | mdecorde | |
707 | 2961 | mdecorde | "uninstalllib.shareddlldone_${UNINSTALLLIB_UNIQUE}:" |
708 | 2961 | mdecorde | |
709 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
710 | 2961 | mdecorde | |
711 | 2961 | mdecorde | SetRegView lastused |
712 | 2961 | mdecorde | |
713 | 2961 | mdecorde | !endif |
714 | 2961 | mdecorde | |
715 | 2961 | mdecorde | !endif |
716 | 2961 | mdecorde | |
717 | 2961 | mdecorde | ;------------------------ |
718 | 2961 | mdecorde | ;Remove |
719 | 2961 | mdecorde | |
720 | 2961 | mdecorde | !ifndef UNINSTALLLIB_UNINSTALL_NOREMOVE |
721 | 2961 | mdecorde | |
722 | 2961 | mdecorde | ;------------------------ |
723 | 2961 | mdecorde | ;Check Windows File Protection |
724 | 2961 | mdecorde | |
725 | 2961 | mdecorde | !ifdef UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED | UNINSTALLLIB_UNINSTALL_NOREBOOT_PROTECTED |
726 | 2961 | mdecorde | |
727 | 2961 | mdecorde | !ifndef UNINSTALLLIB_DONE_LABEL |
728 | 2961 | mdecorde | |
729 | 2961 | mdecorde | !define UNINSTALLLIB_DONE_LABEL |
730 | 2961 | mdecorde | |
731 | 2961 | mdecorde | !endif |
732 | 2961 | mdecorde | |
733 | 2961 | mdecorde | System::Call "sfc::SfcIsFileProtected(i 0, w $R1) i.R0" |
734 | 2961 | mdecorde | |
735 | 2961 | mdecorde | StrCmp $R0 "error" "uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}" |
736 | 2961 | mdecorde | StrCmp $R0 "0" "uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}" |
737 | 2961 | mdecorde | |
738 | 2961 | mdecorde | Goto "uninstalllib.done_${UNINSTALLLIB_UNIQUE}" |
739 | 2961 | mdecorde | |
740 | 2961 | mdecorde | "uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}:" |
741 | 2961 | mdecorde | |
742 | 2961 | mdecorde | !endif |
743 | 2961 | mdecorde | |
744 | 2961 | mdecorde | ;------------------------ |
745 | 2961 | mdecorde | ;Unregister |
746 | 2961 | mdecorde | |
747 | 2961 | mdecorde | !ifdef UNINSTALLLIB_LIBTYPE_REGDLL | UNINSTALLLIB_LIBTYPE_REGDLLTLB |
748 | 2961 | mdecorde | |
749 | 2961 | mdecorde | !ifndef LIBRARY_X64 |
750 | 2961 | mdecorde | |
751 | 2961 | mdecorde | UnRegDLL $R1 |
752 | 2961 | mdecorde | |
753 | 2961 | mdecorde | !else |
754 | 2961 | mdecorde | |
755 | 2961 | mdecorde | ExecWait '"$SYSDIR\regsvr32.exe" /s /u "$R1"' |
756 | 2961 | mdecorde | |
757 | 2961 | mdecorde | !endif |
758 | 2961 | mdecorde | |
759 | 2961 | mdecorde | !endif |
760 | 2961 | mdecorde | |
761 | 2961 | mdecorde | !ifdef UNINSTALLLIB_LIBTYPE_REGEXE |
762 | 2961 | mdecorde | |
763 | 2961 | mdecorde | ExecWait '"$R1" /unregserver' |
764 | 2961 | mdecorde | |
765 | 2961 | mdecorde | !endif |
766 | 2961 | mdecorde | |
767 | 2961 | mdecorde | !ifdef UNINSTALLLIB_LIBTYPE_TLB | UNINSTALLLIB_LIBTYPE_REGDLLTLB |
768 | 2961 | mdecorde | |
769 | 2961 | mdecorde | TypeLib::UnRegister $R1 |
770 | 2961 | mdecorde | |
771 | 2961 | mdecorde | !endif |
772 | 2961 | mdecorde | |
773 | 2961 | mdecorde | !ifdef LIBRARY_SHELL_EXTENSION |
774 | 2961 | mdecorde | |
775 | 2961 | mdecorde | System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' |
776 | 2961 | mdecorde | |
777 | 2961 | mdecorde | !endif |
778 | 2961 | mdecorde | |
779 | 2961 | mdecorde | !ifdef LIBRARY_COM |
780 | 2961 | mdecorde | |
781 | 2961 | mdecorde | System::Call 'Ole32::CoFreeUnusedLibraries()' |
782 | 2961 | mdecorde | |
783 | 2961 | mdecorde | !endif |
784 | 2961 | mdecorde | |
785 | 2961 | mdecorde | ;------------------------ |
786 | 2961 | mdecorde | ;Delete |
787 | 2961 | mdecorde | |
788 | 2961 | mdecorde | Delete $R1 |
789 | 2961 | mdecorde | |
790 | 2961 | mdecorde | !ifdef UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED | UNINSTALLLIB_UNINSTALL_REBOOT_NOTPROTECTED |
791 | 2961 | mdecorde | |
792 | 2961 | mdecorde | ${If} ${FileExists} $R1 |
793 | 2961 | mdecorde | # File is in use, can't just delete. |
794 | 2961 | mdecorde | # Move file to another location before using Delete /REBOOTOK. This way, if |
795 | 2961 | mdecorde | # the user installs a new version of the DLL, it won't be deleted after |
796 | 2961 | mdecorde | # reboot. See bug #1097642 for more information on this. |
797 | 2961 | mdecorde | |
798 | 2961 | mdecorde | # Try moving to $TEMP. |
799 | 2961 | mdecorde | GetTempFileName $R0 |
800 | 2961 | mdecorde | Delete $R0 |
801 | 2961 | mdecorde | Rename $R1 $R0 |
802 | 2961 | mdecorde | |
803 | 2961 | mdecorde | ${If} ${FileExists} $R1 |
804 | 2961 | mdecorde | # Still here, delete temporary file, in case the file was copied |
805 | 2961 | mdecorde | # and not deleted. This happens when moving from network drives, |
806 | 2961 | mdecorde | # for example. |
807 | 2961 | mdecorde | Delete $R0 |
808 | 2961 | mdecorde | |
809 | 2961 | mdecorde | # Try moving to directory containing the file. |
810 | 2961 | mdecorde | !insertmacro __InstallLib_Helper_GetParent $R1 $R0 |
811 | 2961 | mdecorde | GetTempFileName $R0 $R0 |
812 | 2961 | mdecorde | Delete $R0 |
813 | 2961 | mdecorde | Rename $R1 $R0 |
814 | 2961 | mdecorde | |
815 | 2961 | mdecorde | ${If} ${FileExists} $R1 |
816 | 2961 | mdecorde | # Still here, delete temporary file. |
817 | 2961 | mdecorde | Delete $R0 |
818 | 2961 | mdecorde | |
819 | 2961 | mdecorde | # Give up moving, simply Delete /REBOOTOK the file. |
820 | 2961 | mdecorde | StrCpy $R0 $R1 |
821 | 2961 | mdecorde | ${EndIf} |
822 | 2961 | mdecorde | ${EndIf} |
823 | 2961 | mdecorde | |
824 | 2961 | mdecorde | # Delete the moved file. |
825 | 2961 | mdecorde | Delete /REBOOTOK $R0 |
826 | 2961 | mdecorde | ${EndIf} |
827 | 2961 | mdecorde | |
828 | 2961 | mdecorde | !endif |
829 | 2961 | mdecorde | |
830 | 2961 | mdecorde | !endif |
831 | 2961 | mdecorde | |
832 | 2961 | mdecorde | ;------------------------ |
833 | 2961 | mdecorde | ;Done |
834 | 2961 | mdecorde | |
835 | 2961 | mdecorde | !ifdef UNINSTALLLIB_DONE_LABEL |
836 | 2961 | mdecorde | |
837 | 2961 | mdecorde | !undef UNINSTALLLIB_DONE_LABEL |
838 | 2961 | mdecorde | |
839 | 2961 | mdecorde | "uninstalllib.done_${UNINSTALLLIB_UNIQUE}:" |
840 | 2961 | mdecorde | |
841 | 2961 | mdecorde | !endif |
842 | 2961 | mdecorde | |
843 | 2961 | mdecorde | !ifdef LIBRARY_X64 |
844 | 2961 | mdecorde | |
845 | 2961 | mdecorde | ${EnableX64FSRedirection} |
846 | 2961 | mdecorde | |
847 | 2961 | mdecorde | !endif |
848 | 2961 | mdecorde | |
849 | 2961 | mdecorde | Pop $R1 |
850 | 2961 | mdecorde | Pop $R0 |
851 | 2961 | mdecorde | |
852 | 2961 | mdecorde | ;------------------------ |
853 | 2961 | mdecorde | ;Undefine |
854 | 2961 | mdecorde | |
855 | 2961 | mdecorde | !undef UNINSTALLLIB_UNIQUE |
856 | 2961 | mdecorde | |
857 | 2961 | mdecorde | !undef ${UNINSTALLLIB_LIBTYPE_SET} |
858 | 2961 | mdecorde | !undef UNINSTALLLIB_LIBTYPE_SET |
859 | 2961 | mdecorde | !undef ${UNINSTALLLIB_SHARED_SET} |
860 | 2961 | mdecorde | !undef UNINSTALLLIB_SHARED_SET |
861 | 2961 | mdecorde | !undef ${UNINSTALLLIB_UNINSTALL_SET} |
862 | 2961 | mdecorde | !undef UNINSTALLLIB_UNINSTALL_SET |
863 | 2961 | mdecorde | |
864 | 2961 | mdecorde | !verbose pop |
865 | 2961 | mdecorde | |
866 | 2961 | mdecorde | !macroend |
867 | 2961 | mdecorde | |
868 | 2961 | mdecorde | !endif |
869 | 2961 | mdecorde | |
870 | 2961 | mdecorde | !verbose pop |