This repository was archived by the owner on May 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmRemote.nsi
197 lines (170 loc) · 6.41 KB
/
mRemote.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
!include "MUI.nsh"
!include "WordFunc.nsh"
!insertmacro VersionCompare
!include "DotNetVer.nsh"
!include "..\Release\Version.nsh"
; This will be passed in using the /D switch by BUILD.CMD
!ifdef PRODUCT_VERSION_TAG
!define PRODUCT_VERSION_FRIENDLY "${PRODUCT_VERSION_SHORT}"
!define PRODUCT_VERSION_TAGGED "${PRODUCT_VERSION_SHORT}-${PRODUCT_VERSION_TAG}"
!else
!define PRODUCT_VERSION_FRIENDLY "${PRODUCT_VERSION_SHORT}"
!define PRODUCT_VERSION_TAGGED "${PRODUCT_VERSION_SHORT}"
!endif
; Basic Config
Name "mRemoteNG ${PRODUCT_VERSION_FRIENDLY}"
OutFile "..\Release\mRemoteNG-Installer-${PRODUCT_VERSION_TAGGED}.exe"
SetCompressor /SOLID lzma
InstallDir "$PROGRAMFILES\mRemoteNG"
InstallDirRegKey HKLM "Software\mRemoteNG" "InstallPath"
RequestExecutionLevel admin
; Version Information
VIProductVersion ${PRODUCT_VERSION}
VIAddVersionKey "CompanyName" "Next Generation Software"
VIAddVersionKey "ProductName" "mRemoteNG"
VIAddVersionKey "ProductVersion" ${PRODUCT_VERSION}
VIAddVersionKey "LegalCopyright" "Copyright © 2007-2009 Felix Deimel, 2010-2013 Riley McArdle"
VIAddVersionKey "FileDescription" "mRemoteNG ${PRODUCT_VERSION_FRIENDLY} Installer"
VIAddVersionKey "FileVersion" ${PRODUCT_VERSION}
; Design
!define MUI_ICON "Setup_Install.ico"
!define MUI_UNICON "RecycleBin.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "header.bmp" ; optional
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADERIMAGE_UNBITMAP "header.bmp" ; optional
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH
!define MUI_HEADER_TRANSPARENT_TEXT
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
; Install Pages
!insertmacro MUI_PAGE_LICENSE "..\COPYING.TXT"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
; Finish Page
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN "$INSTDIR\mRemoteNG.exe"
!insertmacro MUI_PAGE_FINISH
; Uninstall Pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Get Languages
!include "Language\languages.nsi"
; Set finish page text
!define MUI_FINISHPAGE_RUN_Text "$(LaunchMremoteNow)"
Function .onInit
ClearErrors
UserInfo::GetName
IfErrors Win9x
Pop $0
UserInfo::GetAccountType
Pop $1
# GetOriginalAccountType will check the tokens of the original user of the
# current thread/process. If the user tokens were elevated or limited for
# this process, GetOriginalAccountType will return the non-restricted
# account type.
# On Vista with UAC, for example, this is not the same value when running
# with `RequestExecutionLevel user`. GetOriginalAccountType will return
# "admin" while GetAccountType will return "user".
StrCmp $1 "Admin" 0 +3
Goto doit
StrCmp $1 "Power" 0 +3
Goto doit
StrCmp $1 "User" 0 +3
Goto noop
StrCmp $1 "Guest" 0 +3
Goto noop
MessageBox MB_OK "Unknown error"
Goto doit
Win9x:
doit:
# We can install
IfSilent +2
Call SelectLanguage
Goto end
noop:
MessageBox MB_OK "$(RequiresAdminUser)"
Quit
end:
FunctionEnd
Function SelectLanguage
;Language selection dialog
Push ""
Push ${LANG_ENGLISH}
Push ${LanguageNameEnglish}
Push ${LANG_GERMAN}
Push ${LanguageNameGerman}
Push ${LANG_DUTCH}
Push ${LanguageNameDutch}
Push ${LANG_FRENCH}
Push ${LanguageNameFrench}
Push ${LANG_POLISH}
Push ${LanguageNamePolish}
Push ${LANG_SPANISH}
Push ${LanguageNameSpanish}
Push ${LANG_CZECH}
Push ${LanguageNameCzech}
Push ${LANG_THAI}
Push ${LanguageNameThai}
Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "$(InstallerLanguage)" "$(SelectInstallerLanguage)"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
; Check .NET version
${IfNot} ${HasDotNet3.0}
MessageBox MB_OK|MB_ICONEXCLAMATION "$(RequiresNetFramework)"
Quit
${EndIf}
FunctionEnd
Section "" ; Install
SetOutPath $INSTDIR
SetShellVarContext all
; AddFiles
File /r /x "mRemoteNG.vshost.*" "..\mRemoteV1\bin\Release\*.*"
File /r "Dependencies\*.*"
File "..\*.txt"
; Uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
; Register ActiveX components
RegDLL "$INSTDIR\eolwtscom.dll"
; Start Menu
CreateDirectory "$SMPROGRAMS\mRemoteNG"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(CreditsLinkName).lnk" "$INSTDIR\CREDITS.TXT"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(CopyingLinkName).lnk" "$INSTDIR\COPYING.TXT"
CreateShortCut "$SMPROGRAMS\mRemoteNG\mRemoteNG.lnk" "$INSTDIR\mRemoteNG.exe"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(UninstallLinkName).lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(ChangeLogLinkName).lnk" "$INSTDIR\CHANGELOG.TXT"
; Registry
WriteRegStr HKLM "Software\mRemoteNG" "InstallPath" $INSTDIR
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayName" "mRemoteNG"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "Publisher" "Next Generation Software"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayIcon" "$INSTDIR\mRemoteNG.exe"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "EstimatedSize" 7080
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayVersion" ${PRODUCT_VERSION}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "VersionMajor" ${PRODUCT_VERSION_MAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "VersionMinor" ${PRODUCT_VERSION_MINOR}
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "NoRepair" 1
SectionEnd
Section "un.Uninstall"
; Unregister ActiveX components
UnregDLL "$INSTDIR\eolwtscom.dll"
; Delete Files
RMDIR /r $INSTDIR
; Start Menu
SetShellVarContext all
RMDir /r "$SMPROGRAMS\mRemoteNG"
SetShellVarContext current
RMDir /r "$SMPROGRAMS\mRemoteNG"
; Registry
DeleteRegValue HKLM "Software\mRemoteNG" "InstallPath"
DeleteRegKey /ifempty HKLM "Software\mRemoteNG"
DeleteRegKey /ifempty HKCU "Software\mRemoteNG"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG"
SectionEnd