1 ;--------------------------------
\r
4 !define VERSION_MAJOR 9
\r
5 !define VERSION_MINOR 20
\r
6 !define VERSION_POSTFIX_FULL ""
\r
9 !define VERSION_SYS_POSTFIX_FULL " for Windows IA-64"
\r
11 !define VERSION_SYS_POSTFIX_FULL " for Windows x64"
\r
14 !define VERSION_SYS_POSTFIX_FULL ""
\r
16 !define NAME_FULL "7-Zip ${VERSION_MAJOR}.${VERSION_MINOR}${VERSION_POSTFIX_FULL}${VERSION_SYS_POSTFIX_FULL}"
\r
17 !define VERSION_POSTFIX ""
\r
20 !define VERSION_SYS_POSTFIX "-ia64"
\r
22 !define VERSION_SYS_POSTFIX "-x64"
\r
25 !define VERSION_SYS_POSTFIX ""
\r
30 !define FM_LINK "7-Zip File Manager.lnk"
\r
31 !define HELP_LINK "7-Zip Help.lnk"
\r
33 !define CLSID_CONTEXT_MENU {23170F69-40C1-278A-1000-000100020000}
\r
35 #!define NO_COMPRESSION
\r
37 !include "Library.nsh"
\r
40 ;--------------------------------
\r
45 BrandingText "www.7-zip.org"
\r
46 OutFile "..\7z${VERSION_MAJOR}${VERSION_MINOR}${VERSION_POSTFIX}${VERSION_SYS_POSTFIX}.exe"
\r
48 ;Folder selection page
\r
49 InstallDir "$PROGRAMFILES\7-Zip"
\r
51 ;Get install folder from registry if available
\r
52 InstallDirRegKey HKLM "Software\7-Zip" "Path"
\r
55 !ifndef NO_COMPRESSION
\r
56 SetCompressor /solid lzma
\r
57 ; SetCompressorFilter 1
\r
59 SetCompressorDictSize 8
\r
61 SetCompressorDictSize 4
\r
68 ;--------------------------------
\r
71 ;--------------------------------
\r
74 !define MUI_ABORTWARNING
\r
76 ;--------------------------------
\r
79 #!insertmacro MUI_PAGE_LICENSE "License.txt"
\r
80 !insertmacro MUI_PAGE_DIRECTORY
\r
81 !insertmacro MUI_PAGE_INSTFILES
\r
82 !insertmacro MUI_PAGE_FINISH
\r
84 !insertmacro MUI_UNPAGE_CONFIRM
\r
85 !insertmacro MUI_UNPAGE_INSTFILES
\r
86 !insertmacro MUI_UNPAGE_FINISH
\r
88 ;--------------------------------
\r
91 !insertmacro MUI_LANGUAGE "English"
\r
93 ;--------------------------------
\r
96 ;These files should be inserted before other files in the data block
\r
97 ;Keep these lines before any File command
\r
98 ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
\r
100 !insertmacro MUI_RESERVEFILE_LANGDLL
\r
102 ;--------------------------------
\r
103 ;Installer Sections
\r
107 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\7zFMn.exe"
\r
110 # delete old unwanted files
\r
111 Delete $INSTDIR\7zFMn.exe
\r
112 Delete $INSTDIR\7zgn.exe
\r
113 Delete $INSTDIR\7zn.exe
\r
114 Delete $INSTDIR\7zan.exe
\r
115 Delete $INSTDIR\7zC.sfx
\r
116 Delete $INSTDIR\7-zipn.dll
\r
117 Delete $INSTDIR\7zipDoc.txt
\r
118 Delete $INSTDIR\file_id.diz
\r
120 Delete $INSTDIR\Codecs\7zAES.dll
\r
121 Delete $INSTDIR\Codecs\AES.dll
\r
122 Delete $INSTDIR\Codecs\Branch.dll
\r
123 Delete $INSTDIR\Codecs\BZip2.dll
\r
124 Delete $INSTDIR\Codecs\Copy.dll
\r
125 Delete $INSTDIR\Codecs\Deflate.dll
\r
126 Delete $INSTDIR\Codecs\Implode.dll
\r
127 Delete $INSTDIR\Codecs\LZMA.dll
\r
128 Delete $INSTDIR\Codecs\PPMD.dll
\r
129 Delete $INSTDIR\Codecs\Rar29.dll
\r
130 Delete $INSTDIR\Codecs\Swap.dll
\r
132 RMDir $INSTDIR\Codecs
\r
134 Delete $INSTDIR\Formats\7z.dll
\r
135 Delete $INSTDIR\Formats\arj.dll
\r
136 Delete $INSTDIR\Formats\bz2.dll
\r
137 Delete $INSTDIR\Formats\cab.dll
\r
138 Delete $INSTDIR\Formats\chm.dll
\r
139 Delete $INSTDIR\Formats\cpio.dll
\r
140 Delete $INSTDIR\Formats\deb.dll
\r
141 Delete $INSTDIR\Formats\gz.dll
\r
142 Delete $INSTDIR\Formats\iso.dll
\r
143 Delete $INSTDIR\Formats\lzh.dll
\r
144 Delete $INSTDIR\Formats\nsis.dll
\r
145 Delete $INSTDIR\Formats\rar.dll
\r
146 Delete $INSTDIR\Formats\rpm.dll
\r
147 Delete $INSTDIR\Formats\split.dll
\r
148 Delete $INSTDIR\Formats\tar.dll
\r
149 Delete $INSTDIR\Formats\z.dll
\r
150 Delete $INSTDIR\Formats\zip.dll
\r
152 RMDir $INSTDIR\Formats
\r
154 Delete $INSTDIR\Lang\no.txt
\r
157 SetOutPath "$INSTDIR"
\r
180 SetOutPath $INSTDIR\Lang
\r
262 SetOutPath $INSTDIR
\r
264 # delete "current user" menu items
\r
266 Delete "$SMPROGRAMS\7-Zip\${FM_LINK}"
\r
267 Delete "$SMPROGRAMS\7-Zip\${HELP_LINK}"
\r
268 RMDir "$SMPROGRAMS\7-Zip"
\r
270 # set "all users" mode
\r
272 SetShellVarContext all
\r
274 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED 7-zip.dll $INSTDIR\7-zip.dll $INSTDIR
\r
278 # create start menu icons
\r
279 SetOutPath $INSTDIR # working directory
\r
280 CreateDirectory $SMPROGRAMS\7-Zip
\r
282 CreateShortcut "$SMPROGRAMS\7-Zip\${FM_LINK}" $INSTDIR\7zFM.exe
\r
283 CreateShortcut "$SMPROGRAMS\7-Zip\${HELP_LINK}" $INSTDIR\7-zip.chm
\r
285 IfErrors 0 noScErrors
\r
287 SetShellVarContext current
\r
289 CreateDirectory $SMPROGRAMS\7-Zip
\r
290 CreateShortcut "$SMPROGRAMS\7-Zip\${FM_LINK}" $INSTDIR\7zFM.exe
\r
291 CreateShortcut "$SMPROGRAMS\7-Zip\${HELP_LINK}" $INSTDIR\7-zip.chm
\r
295 # store install folder
\r
296 WriteRegStr HKLM "Software\7-Zip" "Path" $INSTDIR
\r
297 WriteRegStr HKCU "Software\7-Zip" "Path" $INSTDIR
\r
299 # write reg entries
\r
300 WriteRegStr HKCR "CLSID\${CLSID_CONTEXT_MENU}" "" "7-Zip Shell Extension"
\r
301 WriteRegStr HKCR "CLSID\${CLSID_CONTEXT_MENU}\InprocServer32" "" "$INSTDIR\7-zip.dll"
\r
302 WriteRegStr HKCR "CLSID\${CLSID_CONTEXT_MENU}\InprocServer32" "ThreadingModel" "Apartment"
\r
305 WriteRegStr HKCR "*\shellex\ContextMenuHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}"
\r
306 WriteRegStr HKCR "Directory\shellex\ContextMenuHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}"
\r
307 ; WriteRegStr HKCR "Folder\shellex\ContextMenuHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}"
\r
309 WriteRegStr HKCR "Directory\shellex\DragDropHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}"
\r
310 WriteRegStr HKCR "Drive\shellex\DragDropHandlers\7-Zip" "" "${CLSID_CONTEXT_MENU}"
\r
312 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${CLSID_CONTEXT_MENU}" "7-Zip Shell Extension"
\r
314 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe" "" "$INSTDIR\7zFM.exe"
\r
315 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe" "Path" "$INSTDIR"
\r
317 # create uninstaller
\r
318 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "DisplayName" "${NAME_FULL}"
\r
319 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "UninstallString" '"$INSTDIR\Uninstall.exe"'
\r
320 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "NoModify" 1
\r
321 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip" "NoRepair" 1
\r
322 WriteUninstaller $INSTDIR\Uninstall.exe
\r
324 DeleteRegValue HKCR "CLSID\${CLSID_CONTEXT_MENU}\InprocServer32" "InprocServer32"
\r
327 ExecWait 'regsvr32 /s "$INSTDIR\7-zip.dll"'
\r
333 ;--------------------------------
\r
334 ;Installer Functions
\r
339 !insertmacro MUI_LANGDLL_DISPLAY
\r
344 ;--------------------------------
\r
345 ;Uninstaller Section
\r
347 Section "Uninstall"
\r
349 ExecWait 'regsvr32 /u /s "$INSTDIR\7-zip.dll"'
\r
353 Delete $INSTDIR\descript.ion
\r
354 Delete $INSTDIR\History.txt
\r
355 Delete $INSTDIR\License.txt
\r
356 Delete $INSTDIR\copying.txt
\r
357 Delete $INSTDIR\readme.txt
\r
358 Delete $INSTDIR\7zip_pad.xml
\r
360 Delete /REBOOTOK $INSTDIR\7-zip.dll
\r
361 Delete $INSTDIR\7zFM.exe
\r
362 Delete $INSTDIR\7z.exe
\r
364 Delete $INSTDIR\7za.exe
\r
366 Delete $INSTDIR\7zg.exe
\r
368 Delete $INSTDIR\7z.sfx
\r
369 Delete $INSTDIR\7zCon.sfx
\r
370 Delete $INSTDIR\7zC.sfx
\r
372 Delete $INSTDIR\7-zip.chm
\r
374 Delete $INSTDIR\7z.dll
\r
376 Delete $INSTDIR\Lang\en.ttt
\r
377 Delete $INSTDIR\Lang\af.txt
\r
378 Delete $INSTDIR\Lang\ar.txt
\r
379 Delete $INSTDIR\Lang\ast.txt
\r
380 Delete $INSTDIR\Lang\az.txt
\r
381 Delete $INSTDIR\Lang\ba.txt
\r
382 Delete $INSTDIR\Lang\be.txt
\r
383 Delete $INSTDIR\Lang\bg.txt
\r
384 Delete $INSTDIR\Lang\bn.txt
\r
385 Delete $INSTDIR\Lang\br.txt
\r
386 Delete $INSTDIR\Lang\ca.txt
\r
387 Delete $INSTDIR\Lang\cs.txt
\r
388 Delete $INSTDIR\Lang\cy.txt
\r
389 Delete $INSTDIR\Lang\da.txt
\r
390 Delete $INSTDIR\Lang\de.txt
\r
391 Delete $INSTDIR\Lang\el.txt
\r
392 Delete $INSTDIR\Lang\eo.txt
\r
393 Delete $INSTDIR\Lang\es.txt
\r
394 Delete $INSTDIR\Lang\et.txt
\r
395 Delete $INSTDIR\Lang\eu.txt
\r
396 Delete $INSTDIR\Lang\ext.txt
\r
397 Delete $INSTDIR\Lang\fa.txt
\r
398 Delete $INSTDIR\Lang\fi.txt
\r
399 Delete $INSTDIR\Lang\fr.txt
\r
400 Delete $INSTDIR\Lang\fur.txt
\r
401 Delete $INSTDIR\Lang\fy.txt
\r
402 Delete $INSTDIR\Lang\gl.txt
\r
403 Delete $INSTDIR\Lang\gu.txt
\r
404 Delete $INSTDIR\Lang\he.txt
\r
405 Delete $INSTDIR\Lang\hi.txt
\r
406 Delete $INSTDIR\Lang\hr.txt
\r
407 Delete $INSTDIR\Lang\hu.txt
\r
408 Delete $INSTDIR\Lang\hy.txt
\r
409 Delete $INSTDIR\Lang\id.txt
\r
410 Delete $INSTDIR\Lang\io.txt
\r
411 Delete $INSTDIR\Lang\is.txt
\r
412 Delete $INSTDIR\Lang\it.txt
\r
413 Delete $INSTDIR\Lang\ja.txt
\r
414 Delete $INSTDIR\Lang\ka.txt
\r
415 Delete $INSTDIR\Lang\kk.txt
\r
416 Delete $INSTDIR\Lang\ko.txt
\r
417 Delete $INSTDIR\Lang\ku.txt
\r
418 Delete $INSTDIR\Lang\ku-ckb.txt
\r
419 Delete $INSTDIR\Lang\lt.txt
\r
420 Delete $INSTDIR\Lang\lv.txt
\r
421 Delete $INSTDIR\Lang\mk.txt
\r
422 Delete $INSTDIR\Lang\mn.txt
\r
423 Delete $INSTDIR\Lang\mr.txt
\r
424 Delete $INSTDIR\Lang\ms.txt
\r
425 Delete $INSTDIR\Lang\ne.txt
\r
426 Delete $INSTDIR\Lang\nl.txt
\r
427 Delete $INSTDIR\Lang\nb.txt
\r
428 Delete $INSTDIR\Lang\nn.txt
\r
429 Delete $INSTDIR\Lang\pa-in.txt
\r
430 Delete $INSTDIR\Lang\pl.txt
\r
431 Delete $INSTDIR\Lang\ps.txt
\r
432 Delete $INSTDIR\Lang\pt.txt
\r
433 Delete $INSTDIR\Lang\pt-br.txt
\r
434 Delete $INSTDIR\Lang\ro.txt
\r
435 Delete $INSTDIR\Lang\ru.txt
\r
436 Delete $INSTDIR\Lang\sa.txt
\r
437 Delete $INSTDIR\Lang\si.txt
\r
438 Delete $INSTDIR\Lang\sk.txt
\r
439 Delete $INSTDIR\Lang\sl.txt
\r
440 Delete $INSTDIR\Lang\sq.txt
\r
441 Delete $INSTDIR\Lang\sr.txt
\r
442 Delete $INSTDIR\Lang\sr-spc.txt
\r
443 Delete $INSTDIR\Lang\sr-spl.txt
\r
444 Delete $INSTDIR\Lang\sv.txt
\r
445 Delete $INSTDIR\Lang\ta.txt
\r
446 Delete $INSTDIR\Lang\th.txt
\r
447 Delete $INSTDIR\Lang\tr.txt
\r
448 Delete $INSTDIR\Lang\tt.txt
\r
449 Delete $INSTDIR\Lang\ug.txt
\r
450 Delete $INSTDIR\Lang\uk.txt
\r
451 Delete $INSTDIR\Lang\uz.txt
\r
452 Delete $INSTDIR\Lang\va.txt
\r
453 Delete $INSTDIR\Lang\vi.txt
\r
454 Delete $INSTDIR\Lang\vr.txt
\r
455 Delete $INSTDIR\Lang\zh-cn.txt
\r
456 Delete $INSTDIR\Lang\zh-tw.txt
\r
458 RMDir $INSTDIR\Lang
\r
460 Delete $INSTDIR\Uninstall.exe
\r
464 # delete start menu entires
\r
466 SetShellVarContext all
\r
470 Delete "$SMPROGRAMS\7-Zip\${FM_LINK}"
\r
471 Delete "$SMPROGRAMS\7-Zip\${HELP_LINK}"
\r
472 RMDir "$SMPROGRAMS\7-Zip"
\r
474 # IfErrors 0 noScErrors
\r
476 SetShellVarContext current
\r
478 Delete "$SMPROGRAMS\7-Zip\${FM_LINK}"
\r
479 Delete "$SMPROGRAMS\7-Zip\${HELP_LINK}"
\r
480 RMDir "$SMPROGRAMS\7-Zip"
\r
485 # delete registry entries
\r
487 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
\r
488 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe"
\r
490 DeleteRegKey HKLM "Software\7-Zip"
\r
491 DeleteRegKey HKCU "Software\7-Zip"
\r
493 DeleteRegKey HKCR "CLSID\${CLSID_CONTEXT_MENU}"
\r
495 DeleteRegKey HKCR "*\shellex\ContextMenuHandlers\7-Zip"
\r
496 DeleteRegKey HKCR "Directory\shellex\ContextMenuHandlers\7-Zip"
\r
497 DeleteRegKey HKCR "Folder\shellex\ContextMenuHandlers\7-Zip"
\r
499 DeleteRegKey HKCR "Directory\shellex\DragDropHandlers\7-Zip"
\r
500 DeleteRegKey HKCR "Folder\shellex\DragDropHandlers\7-Zip"
\r
502 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" "${CLSID_CONTEXT_MENU}"
\r
504 DeleteRegKey HKCR "7-Zip.001"
\r
505 DeleteRegKey HKCR "7-Zip.7z"
\r
506 DeleteRegKey HKCR "7-Zip.arj"
\r
507 DeleteRegKey HKCR "7-Zip.bz2"
\r
508 DeleteRegKey HKCR "7-Zip.bzip2"
\r
509 DeleteRegKey HKCR "7-Zip.tbz"
\r
510 DeleteRegKey HKCR "7-Zip.tbz2"
\r
511 DeleteRegKey HKCR "7-Zip.cab"
\r
512 DeleteRegKey HKCR "7-Zip.cpio"
\r
513 DeleteRegKey HKCR "7-Zip.deb"
\r
514 DeleteRegKey HKCR "7-Zip.dmg"
\r
515 DeleteRegKey HKCR "7-Zip.gz"
\r
516 DeleteRegKey HKCR "7-Zip.gzip"
\r
517 DeleteRegKey HKCR "7-Zip.hfs"
\r
518 DeleteRegKey HKCR "7-Zip.iso"
\r
519 DeleteRegKey HKCR "7-Zip.lha"
\r
520 DeleteRegKey HKCR "7-Zip.lzh"
\r
521 DeleteRegKey HKCR "7-Zip.lzma"
\r
522 DeleteRegKey HKCR "7-Zip.rar"
\r
523 DeleteRegKey HKCR "7-Zip.rpm"
\r
524 DeleteRegKey HKCR "7-Zip.split"
\r
525 DeleteRegKey HKCR "7-Zip.swm"
\r
526 DeleteRegKey HKCR "7-Zip.tar"
\r
527 DeleteRegKey HKCR "7-Zip.taz"
\r
528 DeleteRegKey HKCR "7-Zip.tgz"
\r
529 DeleteRegKey HKCR "7-Zip.tpz"
\r
530 DeleteRegKey HKCR "7-Zip.wim"
\r
531 DeleteRegKey HKCR "7-Zip.xar"
\r
532 DeleteRegKey HKCR "7-Zip.z"
\r
533 DeleteRegKey HKCR "7-Zip.zip"
\r