Skip to content

Commit

Permalink
add binary installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Gurnee committed Dec 7, 2014
1 parent 5d426c4 commit fb67c7f
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/obj.x86-32/
/bin.x86-64/
/obj.x86-64/
/installer/*.exe
117 changes: 117 additions & 0 deletions installer/HashCheck.nsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
SetCompressor /FINAL /SOLID lzma

!include MUI2.nsh
!include x64.nsh

Unicode true

This comment has been minimized.

Copy link
@GnstheGrain

GnstheGrain Jul 8, 2016

Require NSIS 3xRC for this string to be valid.
If using, NSIS v2x, remove that string before proceeding to compile (line 6)


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
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb67c7f

Please sign in to comment.