|
| 1 | +SetCompressor /FINAL /SOLID lzma |
| 2 | + |
| 3 | +!include MUI2.nsh |
| 4 | +!include x64.nsh |
| 5 | + |
| 6 | +Unicode true |
| 7 | + |
| 8 | +Name "HashCheck" |
| 9 | +OutFile "HashCheckSetup.exe" |
| 10 | + |
| 11 | +RequestExecutionLevel admin |
| 12 | +ManifestSupportedOS all |
| 13 | + |
| 14 | +!define MUI_ICON ..\HashCheck.ico |
| 15 | +!define MUI_ABORTWARNING |
| 16 | + |
| 17 | +!insertmacro MUI_PAGE_WELCOME |
| 18 | +!define MUI_PAGE_CUSTOMFUNCTION_SHOW change_license_font |
| 19 | +!insertmacro MUI_PAGE_LICENSE "..\license.txt" |
| 20 | +!insertmacro MUI_PAGE_INSTFILES |
| 21 | +!insertmacro MUI_PAGE_FINISH |
| 22 | + |
| 23 | +; Change to a smaller monospace font to more nicely display the license |
| 24 | +; |
| 25 | +Function change_license_font |
| 26 | + FindWindow $0 "#32770" "" $HWNDPARENT |
| 27 | + CreateFont $1 "Lucida Console" "7" |
| 28 | + GetDlgItem $0 $0 1000 |
| 29 | + SendMessage $0 ${WM_SETFONT} $1 1 |
| 30 | +FunctionEnd |
| 31 | + |
| 32 | +; These are the same languages supported by HashCheck |
| 33 | +; |
| 34 | +!insertmacro MUI_LANGUAGE "English" ; the first language is the default |
| 35 | +!insertmacro MUI_LANGUAGE "TradChinese" |
| 36 | +!insertmacro MUI_LANGUAGE "SimpChinese" |
| 37 | +!insertmacro MUI_LANGUAGE "Czech" |
| 38 | +!insertmacro MUI_LANGUAGE "German" |
| 39 | +!insertmacro MUI_LANGUAGE "Greek" |
| 40 | +!insertmacro MUI_LANGUAGE "SpanishInternational" |
| 41 | +!insertmacro MUI_LANGUAGE "French" |
| 42 | +!insertmacro MUI_LANGUAGE "Italian" |
| 43 | +!insertmacro MUI_LANGUAGE "Japanese" |
| 44 | +!insertmacro MUI_LANGUAGE "Korean" |
| 45 | +!insertmacro MUI_LANGUAGE "Dutch" |
| 46 | +!insertmacro MUI_LANGUAGE "Polish" |
| 47 | +!insertmacro MUI_LANGUAGE "PortugueseBR" |
| 48 | +!insertmacro MUI_LANGUAGE "Portuguese" |
| 49 | +!insertmacro MUI_LANGUAGE "Romanian" |
| 50 | +!insertmacro MUI_LANGUAGE "Russian" |
| 51 | +!insertmacro MUI_LANGUAGE "Swedish" |
| 52 | +!insertmacro MUI_LANGUAGE "Turkish" |
| 53 | +!insertmacro MUI_LANGUAGE "Ukrainian" |
| 54 | + |
| 55 | +; With solid compression, files that are required before the |
| 56 | +; actual installation should be stored first in the data block, |
| 57 | +; because this will make the installer start faster. |
| 58 | +; |
| 59 | +!insertmacro MUI_RESERVEFILE_LANGDLL |
| 60 | + |
| 61 | +; The install script |
| 62 | +; |
| 63 | +Section |
| 64 | + |
| 65 | + GetTempFileName $0 |
| 66 | + File /oname=$0 ..\bin.x86-32\HashCheck.dll |
| 67 | + ExecWait 'regsvr32 /i /n /s "$0"' |
| 68 | + IfErrors abort_on_error |
| 69 | + Delete $0 |
| 70 | + |
| 71 | + ; One of these exists and is undeletable if and only if |
| 72 | + ; it was in use and therefore a reboot is now required |
| 73 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.0 |
| 74 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.1 |
| 75 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.2 |
| 76 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.3 |
| 77 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.4 |
| 78 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.5 |
| 79 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.6 |
| 80 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.7 |
| 81 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.8 |
| 82 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.9 |
| 83 | + |
| 84 | + ${If} ${RunningX64} |
| 85 | + ${DisableX64FSRedirection} |
| 86 | + |
| 87 | + File /oname=$0 ..\bin.x86-64\HashCheck.dll |
| 88 | + ExecWait 'regsvr32 /i /n /s "$0"' |
| 89 | + IfErrors abort_on_error |
| 90 | + Delete $0 |
| 91 | + |
| 92 | + ; One of these exists and is undeletable if and only if |
| 93 | + ; it was in use and therefore a reboot is now required |
| 94 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.0 |
| 95 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.1 |
| 96 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.2 |
| 97 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.3 |
| 98 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.4 |
| 99 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.5 |
| 100 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.6 |
| 101 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.7 |
| 102 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.8 |
| 103 | + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.9 |
| 104 | + |
| 105 | + ${EnableX64FSRedirection} |
| 106 | + ${EndIf} |
| 107 | + |
| 108 | + Return |
| 109 | + |
| 110 | + abort_on_error: |
| 111 | + MessageBox MB_ICONSTOP|MB_OK "An unexpected error occurred during installation" |
| 112 | + |
| 113 | +SectionEnd |
| 114 | + |
| 115 | +Function .onInit |
| 116 | + !insertmacro MUI_LANGDLL_DISPLAY |
| 117 | +FunctionEnd |
0 commit comments