From fb67c7f68b5d065a238e04bd0feb103ce75050e7 Mon Sep 17 00:00:00 2001 From: Christopher Gurnee Date: Sun, 7 Dec 2014 14:24:11 -0500 Subject: [PATCH] add binary installer --- .gitignore | 1 + installer/HashCheck.nsi | 117 ++++++++++++++++++++++++++++++++++++++++ license.txt | 2 +- 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 installer/HashCheck.nsi diff --git a/.gitignore b/.gitignore index 9e7af60..63d48d0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /obj.x86-32/ /bin.x86-64/ /obj.x86-64/ +/installer/*.exe diff --git a/installer/HashCheck.nsi b/installer/HashCheck.nsi new file mode 100644 index 0000000..f94c041 --- /dev/null +++ b/installer/HashCheck.nsi @@ -0,0 +1,117 @@ +SetCompressor /FINAL /SOLID lzma + +!include MUI2.nsh +!include x64.nsh + +Unicode true + +Name "HashCheck" +OutFile "HashCheckSetup.exe" + +RequestExecutionLevel admin +ManifestSupportedOS all + +!define MUI_ICON ..\HashCheck.ico +!define MUI_ABORTWARNING + +!insertmacro MUI_PAGE_WELCOME +!define MUI_PAGE_CUSTOMFUNCTION_SHOW change_license_font +!insertmacro MUI_PAGE_LICENSE "..\license.txt" +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +; Change to a smaller monospace font to more nicely display the license +; +Function change_license_font + FindWindow $0 "#32770" "" $HWNDPARENT + CreateFont $1 "Lucida Console" "7" + GetDlgItem $0 $0 1000 + SendMessage $0 ${WM_SETFONT} $1 1 +FunctionEnd + +; These are the same languages supported by HashCheck +; +!insertmacro MUI_LANGUAGE "English" ; the first language is the default +!insertmacro MUI_LANGUAGE "TradChinese" +!insertmacro MUI_LANGUAGE "SimpChinese" +!insertmacro MUI_LANGUAGE "Czech" +!insertmacro MUI_LANGUAGE "German" +!insertmacro MUI_LANGUAGE "Greek" +!insertmacro MUI_LANGUAGE "SpanishInternational" +!insertmacro MUI_LANGUAGE "French" +!insertmacro MUI_LANGUAGE "Italian" +!insertmacro MUI_LANGUAGE "Japanese" +!insertmacro MUI_LANGUAGE "Korean" +!insertmacro MUI_LANGUAGE "Dutch" +!insertmacro MUI_LANGUAGE "Polish" +!insertmacro MUI_LANGUAGE "PortugueseBR" +!insertmacro MUI_LANGUAGE "Portuguese" +!insertmacro MUI_LANGUAGE "Romanian" +!insertmacro MUI_LANGUAGE "Russian" +!insertmacro MUI_LANGUAGE "Swedish" +!insertmacro MUI_LANGUAGE "Turkish" +!insertmacro MUI_LANGUAGE "Ukrainian" + +; With solid compression, files that are required before the +; actual installation should be stored first in the data block, +; because this will make the installer start faster. +; +!insertmacro MUI_RESERVEFILE_LANGDLL + +; The install script +; +Section + + GetTempFileName $0 + File /oname=$0 ..\bin.x86-32\HashCheck.dll + ExecWait 'regsvr32 /i /n /s "$0"' + IfErrors abort_on_error + Delete $0 + + ; One of these exists and is undeletable if and only if + ; it was in use and therefore a reboot is now required + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.0 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.1 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.2 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.3 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.4 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.5 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.6 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.7 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.8 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.9 + + ${If} ${RunningX64} + ${DisableX64FSRedirection} + + File /oname=$0 ..\bin.x86-64\HashCheck.dll + ExecWait 'regsvr32 /i /n /s "$0"' + IfErrors abort_on_error + Delete $0 + + ; One of these exists and is undeletable if and only if + ; it was in use and therefore a reboot is now required + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.0 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.1 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.2 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.3 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.4 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.5 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.6 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.7 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.8 + Delete /REBOOTOK $SYSDIR\ShellExt\HashCheck.dll.9 + + ${EnableX64FSRedirection} + ${EndIf} + + Return + + abort_on_error: + MessageBox MB_ICONSTOP|MB_OK "An unexpected error occurred during installation" + +SectionEnd + +Function .onInit + !insertmacro MUI_LANGDLL_DISPLAY +FunctionEnd diff --git a/license.txt b/license.txt index f6fb9fa..49287ec 100644 --- a/license.txt +++ b/license.txt @@ -2,7 +2,7 @@ HashCheck Shell Extension Original work copyright (C) 2008-2009 Kai Liu. All rights reserved. Modified work copyright (C) 2014 Christopher Gurnee. All rights reserved. -Redistribution and usez in source and binary forms, with or without modification, +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this