6 |
; |
; |
7 |
|
|
8 |
!include "MUI.nsh" |
!include "MUI.nsh" |
9 |
!include "parameter.nsi" |
!include "variables-declaration.nsi" |
10 |
|
!include "string_functions.nsi" |
11 |
!include "file_functions.nsi" |
!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 |
|
|
|
; more options: language of the installer & installer style |
|
|
;LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf" |
|
|
;XPStyle on |
|
|
|
|
30 |
SetOverwrite on |
SetOverwrite on |
31 |
|
|
32 |
|
|
42 |
; -------------------------------- |
; -------------------------------- |
43 |
; Pages |
; Pages |
44 |
; -------------------------------- |
; -------------------------------- |
|
;Page components |
|
|
;Page directory |
|
|
;Page instfiles |
|
45 |
|
|
46 |
UninstPage uninstConfirm |
UninstPage uninstConfirm |
47 |
UninstPage instfiles |
UninstPage instfiles |
48 |
|
|
|
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" |
|
49 |
!insertmacro MUI_PAGE_WELCOME |
!insertmacro MUI_PAGE_WELCOME |
50 |
Page custom Setup |
Page custom SetupPage1 |
51 |
|
Page custom SetupPage2 |
52 |
|
Page custom SetupPage3 |
53 |
!insertmacro MUI_PAGE_COMPONENTS |
!insertmacro MUI_PAGE_COMPONENTS |
54 |
!insertmacro MUI_PAGE_DIRECTORY |
!insertmacro MUI_PAGE_DIRECTORY |
55 |
!insertmacro MUI_PAGE_INSTFILES |
!insertmacro MUI_PAGE_INSTFILES |
64 |
; -------------------------------- |
; -------------------------------- |
65 |
|
|
66 |
Function .onInit |
Function .onInit |
67 |
|
|
68 |
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e' |
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e' |
69 |
Pop $R0 |
Pop $R0 |
70 |
StrCmp $R0 0 +3 |
StrCmp $R0 0 +3 |
72 |
Abort |
Abort |
73 |
|
|
74 |
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "vpndial_settings.ini" |
!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 |
FunctionEnd |
78 |
|
|
79 |
Function Setup |
Function SetupPage1 |
80 |
; custom page |
; custom page |
81 |
; see: http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html#customPages |
; see: http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html#customPages |
82 |
; and: http://nsis.sourceforge.net/Docs/InstallOptions/Readme.html |
; and: http://nsis.sourceforge.net/Docs/InstallOptions/Readme.html |
83 |
!insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" |
!insertmacro MUI_HEADER_TEXT "VpnDial Einstellungen" "Bitte füllen Sie folgende Angaben aus" |
84 |
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "vpndial_settings.ini" |
!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 |
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]" |
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) |