5 |
; has uninstall support and (optionally) installs start menu shortcuts. |
; has uninstall support and (optionally) installs start menu shortcuts. |
6 |
; |
; |
7 |
|
|
8 |
!include "connection.nsi" |
!include "MUI.nsh" |
9 |
!include "vpn_functions.nsi" |
!include "variables-declaration.nsi" |
10 |
|
!include "string_functions.nsi" |
11 |
|
!include "file_functions.nsi" |
12 |
|
!include "ras_functions.nsi" |
13 |
|
|
14 |
|
|
15 |
; -------------------------------- |
; -------------------------------- |
27 |
; overwrite the old one automatically) |
; overwrite the old one automatically) |
28 |
InstallDirRegKey HKLM "Software\NSIS_VpnDial" "Install_Dir" |
InstallDirRegKey HKLM "Software\NSIS_VpnDial" "Install_Dir" |
29 |
|
|
30 |
; more options: language of the installer & installer style |
SetOverwrite on |
|
LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf" |
|
|
XPStyle on |
|
31 |
|
|
32 |
|
|
33 |
; -------------------------------- |
; -------------------------------- |
34 |
; Pages |
; (MUI) Interface Settings |
35 |
; -------------------------------- |
; -------------------------------- |
36 |
|
!define MUI_ABORTWARNING |
37 |
|
!define MUI_COMPONENTSPAGE_NODESC |
38 |
|
!define MUI_ICON "key.ico" |
39 |
|
!define MUI_UNICON "key.ico" |
40 |
|
|
41 |
|
|
42 |
Page components |
; -------------------------------- |
43 |
Page directory |
; Pages |
44 |
Page instfiles |
; -------------------------------- |
45 |
|
|
46 |
UninstPage uninstConfirm |
UninstPage uninstConfirm |
47 |
UninstPage instfiles |
UninstPage instfiles |
48 |
|
|
49 |
|
!insertmacro MUI_PAGE_WELCOME |
50 |
|
Page custom SetupPage1 |
51 |
|
Page custom SetupPage2 |
52 |
|
Page custom SetupPage3 |
53 |
|
!insertmacro MUI_PAGE_COMPONENTS |
54 |
|
!insertmacro MUI_PAGE_DIRECTORY |
55 |
|
!insertmacro MUI_PAGE_INSTFILES |
56 |
|
|
57 |
|
!insertmacro MUI_UNPAGE_CONFIRM |
58 |
|
!insertmacro MUI_UNPAGE_INSTFILES |
59 |
|
!insertmacro MUI_LANGUAGE "German" |
60 |
|
|
61 |
|
|
62 |
|
; -------------------------------- |
63 |
|
; .onInit |
64 |
|
; -------------------------------- |
65 |
|
|
66 |
|
Function .onInit |
67 |
|
|
68 |
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e' |
69 |
|
Pop $R0 |
70 |
|
StrCmp $R0 0 +3 |
71 |
|
MessageBox MB_OK|MB_ICONEXCLAMATION "Die Installation läuft bereits." |
72 |
|
Abort |
73 |
|
|
74 |
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings.ini" |
75 |
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings_net.ini" |
76 |
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings_cert.ini" |
77 |
|
FunctionEnd |
78 |
|
|
79 |
|
Function SetupPage1 |
80 |
|
; custom page |
81 |
|
; see: http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html#customPages |
82 |
|
; and: http://nsis.sourceforge.net/Docs/InstallOptions/Readme.html |
83 |
|
!insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" |
84 |
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings.ini" |
85 |
|
FunctionEnd |
86 |
|
|
87 |
|
Function SetupPage2 |
88 |
|
!insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" |
89 |
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings_net.ini" |
90 |
|
FunctionEnd |
91 |
|
|
92 |
|
Function SetupPage3 |
93 |
|
!insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" |
94 |
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings_cert.ini" |
95 |
|
FunctionEnd |
96 |
|
|
97 |
|
|
98 |
; -------------------------------- |
; -------------------------------- |
99 |
; The stuff to install |
; The stuff to install |
100 |
; -------------------------------- |
; -------------------------------- |
101 |
|
|
102 |
Section |
Section |
103 |
|
|
104 |
|
;Get Parameter from vpndial_settings.ini |
105 |
|
|
106 |
|
;Get Connectionname |
107 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $connectionname "vpndial_settings.ini" "Field 2" "State" |
108 |
|
;MessageBox MB_OK $R1 |
109 |
|
;StrCpy $connectionname $R1 |
110 |
|
|
111 |
|
;Get Destination_host |
112 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $destination_host "vpndial_settings.ini" "Field 3" "State" |
113 |
|
;MessageBox MB_OK $R2 |
114 |
|
;StrCpy $destination_host $R2 |
115 |
|
|
116 |
|
;Get Username |
117 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $username "vpndial_settings.ini" "Field 4" "State" |
118 |
|
|
119 |
|
;Get Password |
120 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $userpass "vpndial_settings.ini" "Field 8" "State" |
121 |
|
|
122 |
|
;------------------------------------------------------------------------------------------------------------- |
123 |
|
|
124 |
|
;Get Parameter from vpndial_settings_net.ini |
125 |
|
|
126 |
|
;Get Destination_net |
127 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "vpndial_settings_net.ini" "Field 2" "State" |
128 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R2 "vpndial_settings_net.ini" "Field 3" "State" |
129 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R3 "vpndial_settings_net.ini" "Field 4" "State" |
130 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R4 "vpndial_settings_net.ini" "Field 7" "State" |
131 |
|
|
132 |
|
StrCpy $destination_net "$R1.$R2.$R3.$R4" |
133 |
|
|
134 |
|
;Get Destination_mask |
135 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R5 "vpndial_settings_net.ini" "Field 12" "State" |
136 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R6 "vpndial_settings_net.ini" "Field 13" "State" |
137 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R7 "vpndial_settings_net.ini" "Field 14" "State" |
138 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $R8 "vpndial_settings_net.ini" "Field 15" "State" |
139 |
|
|
140 |
|
StrCpy $destination_mask "$R12.$R13.$R14.$R15" |
141 |
|
|
142 |
|
;-------------------------------------------------------------------------------------------------------------- |
143 |
|
|
144 |
|
;Get Parameter from vpndial_settings_cert.ini |
145 |
|
|
146 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $cacert "vpndial_settings_cert.ini" "Field 2" "State" |
147 |
|
!insertmacro MUI_INSTALLOPTIONS_READ $usercert "vpndial_settings_cert.ini" "Field 3" "State" |
148 |
|
|
149 |
|
SectionEnd |
150 |
|
|
151 |
|
Section |
152 |
SetShellVarContext all |
SetShellVarContext all |
153 |
Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk |
Push $APPDATA\Microsoft\Network\Connections\Pbk\rasphone.pbk |
154 |
Push "[$connectionname]" |
Push "[$connectionname]" |
157 |
Pop $1 #Found at all? yes/no |
Pop $1 #Found at all? yes/no |
158 |
Pop $2 #Number of lines found in |
Pop $2 #Number of lines found in |
159 |
StrCmp $1 yes 0 +3 |
StrCmp $1 yes 0 +3 |
160 |
MessageBox MB_OK "$\"[$connectionname]$\" was found already found. Cannot create. Sorry." |
MessageBox MB_OK "Die Verbindung $\"$connectionname$\" existiert bereits. Der Eintrag kann leider nicht doppelt angelegt werden." |
161 |
Abort |
Abort |
162 |
SectionEnd |
SectionEnd |
163 |
|
|
164 |
Section "VpnDial" IDX_VpnDial |
Section "VpnDial" IDX_VpnDial |
165 |
|
|
166 |
|
SetOverwrite on |
167 |
|
|
168 |
SetDetailsPrint both |
SetDetailsPrint both |
169 |
DetailPrint "Installiere VpnDial..." |
DetailPrint "Installiere VpnDial..." |
170 |
|
|
176 |
;CreateDirectory $INSTDIR\certs\ |
;CreateDirectory $INSTDIR\certs\ |
177 |
|
|
178 |
; Put file there |
; Put file there |
|
;File /r "C:\IPSec\nsis\vpndial\*.*" |
|
179 |
File /r "vpndial\*.*" |
File /r "vpndial\*.*" |
180 |
;File "C:\IPSec\nsis\vpndial\certs\" |
|
|
;File "C:\IPSec\nsis\vpndial\certs\*.*" |
|
|
|
|
181 |
; Write the installation path into the registry |
; Write the installation path into the registry |
182 |
WriteRegStr HKLM Software\NSIS_VpnDial "Install_Dir" "$INSTDIR" |
WriteRegStr HKLM Software\NSIS_VpnDial "Install_Dir" "$INSTDIR" |
183 |
|
|
189 |
WriteUninstaller "uninstall.exe" |
WriteUninstaller "uninstall.exe" |
190 |
|
|
191 |
SectionEnd |
SectionEnd |
192 |
|
|
193 |
|
|
194 |
|
; --------------------------------------------------------------------------- |
195 |
|
; pbk-Datei anpassen |
196 |
|
; --------------------------------------------------------------------------- |
197 |
|
|
198 |
|
; Verbindungsname |
199 |
Section |
Section |
200 |
DetailPrint "Installiere VPN-Verbindung..." |
DetailPrint "Installiere VPN-Verbindung..." |
201 |
Push "[##connectionname##]" #-- text to be replaced within the " " |
Push "[##connectionname##]" #-- text to be replaced within the " " |
206 |
Call AdvReplaceInFile #-- Call the Function |
Call AdvReplaceInFile #-- Call the Function |
207 |
SectionEnd |
SectionEnd |
208 |
|
|
209 |
|
; Gegenstelle |
210 |
Section |
Section |
211 |
Push "PhoneNumber=##destinationhost##" #-- text to be replaced within the " " |
Push "PhoneNumber=##destinationhost##" #-- text to be replaced within the " " |
212 |
Push "PhoneNumber=$destination_host" #-- replace with anything within the " " |
Push "PhoneNumber=$destination_host" #-- replace with anything within the " " |
215 |
Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in |
Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in |
216 |
Call AdvReplaceInFile #-- Call the Function |
Call AdvReplaceInFile #-- Call the Function |
217 |
SectionEnd |
SectionEnd |
218 |
|
|
219 |
|
; GUID |
220 |
|
Section |
221 |
|
Call CreateRasGUID |
222 |
|
Pop $0 ; contains GUID |
223 |
|
Push "Guid=##guid##" #-- text to be replaced within the " " |
224 |
|
Push "Guid=$0" #-- replace with anything within the " " |
225 |
|
Push all #-- replace all occurrences |
226 |
|
Push all #-- replace all occurrences |
227 |
|
Push "$INSTDIR\pbk\connection.pbk" #-- file to replace in |
228 |
|
Call AdvReplaceInFile #-- Call the Function |
229 |
|
SectionEnd |
230 |
|
|
231 |
|
; Verbindungsdatei mit globaler Datei zusammenführen |
232 |
Section |
Section |
233 |
SetShellVarContext all |
SetShellVarContext all |
234 |
Push $INSTDIR\pbk\rasphone.pbk |
Push $INSTDIR\pbk\rasphone.pbk |
245 |
SectionEnd |
SectionEnd |
246 |
|
|
247 |
Section |
Section |
248 |
nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $INSTDIR\certs\$cacert -s -r localMachine root" |
;nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $INSTDIR\certs\$cacert -s -r localMachine root" |
249 |
|
;nsExec::Exec "$INSTDIR\bin\certmgr.exe -add -c $cacert -s -r localMachine root" |
250 |
SectionEnd |
SectionEnd |
251 |
|
|
252 |
Section |
Section |
253 |
nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $INSTDIR\certs\$usercert -c LOCAL_MACHINE\My -a $currentuser" |
;nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $INSTDIR\certs\$usercert -c LOCAL_MACHINE\My -a $currentuser" |
254 |
|
nsExec::Exec "$INSTDIR\bin\winhttpcertcfg.exe -g -i $usercert -c LOCAL_MACHINE\My -a $currentuser" |
255 |
SectionEnd |
SectionEnd |
256 |
|
|
257 |
; Optional section (can be disabled by the user) |
; Optional section (can be disabled by the user) |
258 |
Section "Start Menu Shortcuts" IDX_STARTMENU |
Section "Startmenü-Einträge" IDX_STARTMENU |
259 |
|
|
260 |
SetDetailsPrint both |
SetDetailsPrint both |
261 |
DetailPrint "Installiere Startmenü-Einträge und Desktop-Verknüpfungen..." |
DetailPrint "Installiere Startmenü-Einträge und Desktop-Verknüpfungen..." |
267 |
;CreateShortCut "$SMPROGRAMS\VpnDial\VpnSetup.lnk" "$INSTDIR\bin\VpnDial.exe" "--setup $connectionname --user $username --pass $userpass" "$INSTDIR\bin\VpnDial.exe" 0 |
;CreateShortCut "$SMPROGRAMS\VpnDial\VpnSetup.lnk" "$INSTDIR\bin\VpnDial.exe" "--setup $connectionname --user $username --pass $userpass" "$INSTDIR\bin\VpnDial.exe" 0 |
268 |
CreateShortCut "$SMPROGRAMS\VpnDial\Zertifikate.lnk" "$INSTDIR\certs\" "" "$INSTDIR\certs\" 0 |
CreateShortCut "$SMPROGRAMS\VpnDial\Zertifikate.lnk" "$INSTDIR\certs\" "" "$INSTDIR\certs\" 0 |
269 |
CreateShortCut "$SMPROGRAMS\VpnDial\ZertifikatsVerwaltung.lnk" "$INSTDIR\links\IPSec.msc" "" "$INSTDIR\links\IPSec.msc" 0 |
CreateShortCut "$SMPROGRAMS\VpnDial\ZertifikatsVerwaltung.lnk" "$INSTDIR\links\IPSec.msc" "" "$INSTDIR\links\IPSec.msc" 0 |
270 |
CreateShortCut "$SMPROGRAMS\VpnDial\README.lnk" "$INSTDIR\doc\README.txt" "" "$INSTDIR\doc\README.txt" 0 |
;CreateShortCut "$SMPROGRAMS\VpnDial\README.lnk" "$INSTDIR\doc\README.txt" "" "$INSTDIR\doc\README.txt" 0 |
271 |
CreateShortCut "$SMPROGRAMS\VpnDial\README-HTML.lnk" "$INSTDIR\doc\README.htm" "" "$INSTDIR\doc\README.htm" 0 |
;CreateShortCut "$SMPROGRAMS\VpnDial\README-HTML.lnk" "$INSTDIR\doc\README.htm" "" "$INSTDIR\doc\README.htm" 0 |
272 |
|
|
273 |
CopyFiles "$INSTDIR\links\Netzwerkverbindung*" "$SMPROGRAMS\VpnDial\" |
CopyFiles "$INSTDIR\links\Netzwerkverbindung*" "$SMPROGRAMS\VpnDial\" |
274 |
|
|
275 |
SectionEnd |
SectionEnd |
276 |
|
|
277 |
|
|
|
|
|
278 |
; -------------------------------- |
; -------------------------------- |
279 |
; Uninstaller |
; Uninstaller |
280 |
; -------------------------------- |
; -------------------------------- |