svn cleanup
[anytun.git] / openvpn / install-win32 / openvpn.nsi.in
blob58134208c5482df722f469e7a87fb41e6f8ff2c6
1 ; ****************************************************************************
2 ; * Copyright (C) 2002-2005 OpenVPN Solutions LLC *
3 ; * This program is free software; you can redistribute it and/or modify *
4 ; * it under the terms of the GNU General Public License version 2 *
5 ; * as published by the Free Software Foundation. *
6 ; ****************************************************************************
8 ; OpenVPN install script for Windows, using NSIS
10 !include "MUI.nsh"
11 !include "setpath.nsi"
13 !define HOME ".."
14 !define BIN "${HOME}\bin"
16 !define PRODUCT_NAME "OpenVPN"
17 !define VERSION "@VERSION@" # AUTO_VERSION
19 !define TAP "tap0801"
20 !define TAPDRV "${TAP}.sys"
22 ; something like "-DBG2"
23 !define OUTFILE_LABEL ""
25 ; something like "DEBUG2"
26 !define TITLE_LABEL ""
28 ; Default service settings
29 !define SERV_CONFIG_DIR "$INSTDIR\config"
30 !define SERV_CONFIG_EXT "ovpn"
31 !define SERV_EXE_PATH "$INSTDIR\bin\openvpn.exe"
32 !define SERV_LOG_DIR "$INSTDIR\log"
33 !define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
34 !define SERV_LOG_APPEND "0"
36 ;--------------------------------
37 ;Configuration
39 ;General
41 OutFile "openvpn-${VERSION}${OUTFILE_LABEL}-install.exe"
43 SetCompressor bzip2
45 ShowInstDetails show
46 ShowUninstDetails show
48 ;Folder selection page
49 InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
51 ;Remember install folder
52 InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
54 ;--------------------------------
55 ;Modern UI Configuration
57 Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
59 !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of OpenVPN, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of OpenVPN will only run on Win 2000, XP, or higher.\r\n\r\n\r\n"
61 !define MUI_COMPONENTSPAGE_TEXT_TOP "Select the components to install/upgrade. Stop any OpenVPN processes or the OpenVPN service if it is running. All DLLs are installed locally."
63 !define MUI_COMPONENTSPAGE_SMALLDESC
64 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
65 !define MUI_FINISHPAGE_NOAUTOCLOSE
66 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
67 !define MUI_ABORTWARNING
68 !define MUI_ICON "${HOME}\install-win32\openvpn.ico"
69 !define MUI_UNICON "${HOME}\install-win32\openvpn.ico"
70 !define MUI_HEADERIMAGE
71 !define MUI_HEADERIMAGE_BITMAP "${HOME}\install-win32\install-whirl.bmp"
72 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
74 !insertmacro MUI_PAGE_WELCOME
75 !insertmacro MUI_PAGE_LICENSE "${HOME}\install-win32\license.txt"
76 !insertmacro MUI_PAGE_COMPONENTS
77 !insertmacro MUI_PAGE_DIRECTORY
78 !insertmacro MUI_PAGE_INSTFILES
79 !insertmacro MUI_PAGE_FINISH
81 !insertmacro MUI_UNPAGE_CONFIRM
82 !insertmacro MUI_UNPAGE_INSTFILES
83 !insertmacro MUI_UNPAGE_FINISH
86 ;--------------------------------
87 ;Languages
89 !insertmacro MUI_LANGUAGE "English"
91 ;--------------------------------
92 ;Language Strings
94 LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install OpenVPN user-space components, including openvpn.exe."
96 LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install OpenVPN RSA scripts for X509 certificate management."
98 LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
100 LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP-Win32 virtual device driver. Will not interfere with CIPE."
102 LangString DESC_SecService ${LANG_ENGLISH} "Install the OpenVPN service wrapper (openvpnserv.exe)"
104 LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
106 LangString DESC_SecAddPath ${LANG_ENGLISH} "Add OpenVPN executable directory to the current user's PATH."
108 LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add OpenVPN shortcuts to the current user's Start Menu."
110 LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register OpenVPN config file association (*.${SERV_CONFIG_EXT})"
112 ;--------------------------------
113 ;Reserve Files
115 ;Things that need to be extracted on first (keep these lines before any File command!)
116 ;Only useful for BZIP2 compression
118 ReserveFile "${HOME}\install-win32\install-whirl.bmp"
120 ;--------------------------------
121 ;Macros
123 !macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
124 Push $R0
125 ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
126 StrCmp $R0 "" +1 +2
127 WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
128 Pop $R0
129 !macroend
131 !macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
132 Push $R0
133 ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
134 StrCmp $R0 '${VALUE}' +1 +2
135 DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
136 Pop $R0
137 !macroend
139 !macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
140 Push $R0
141 ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
142 StrCmp $R0 '${VALUE}' +1 +2
143 DeleteRegKey "${ROOT}" "${SUBKEY}"
144 Pop $R0
145 !macroend
147 !macro DelRegKeyIfEmpty ROOT SUBKEY
148 Push $R0
149 EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
150 StrCmp $R0 "" +1 +2
151 DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}"
152 Pop $R0
153 !macroend
155 ;------------------------------------------
156 ;Set reboot flag based on tapinstall return
158 Function CheckReboot
159 IntCmp $R0 1 "" noreboot noreboot
160 IntOp $R0 0 & 0
161 SetRebootFlag true
162 DetailPrint "REBOOT flag set"
163 noreboot:
164 FunctionEnd
166 ;--------------------------------
167 ;Installer Sections
169 Function .onInit
170 ClearErrors
171 UserInfo::GetName
172 IfErrors ok
173 Pop $R0
174 UserInfo::GetAccountType
175 Pop $R1
176 StrCmp $R1 "Admin" ok
177 Messagebox MB_OK "Administrator privileges required to install OpenVPN [$R0/$R1]"
178 Abort
180 FunctionEnd
182 !define SF_SELECTED 1
184 Section "OpenVPN User-Space Components" SecOpenVPNUserSpace
186 SetOverwrite on
187 SetOutPath "$INSTDIR\bin"
189 File "${HOME}\openvpn.exe"
191 SectionEnd
193 Section "OpenVPN RSA Certificate Management Scripts" SecOpenVPNEasyRSA
195 SetOverwrite on
196 SetOutPath "$INSTDIR\easy-rsa"
198 File "${HOME}\install-win32\openssl.cnf.sample"
199 File "${HOME}\easy-rsa\Windows\vars.bat.sample"
201 File "${HOME}\easy-rsa\Windows\init-config.bat"
203 File "${HOME}\easy-rsa\Windows\README.txt"
204 File "${HOME}\easy-rsa\Windows\build-ca.bat"
205 File "${HOME}\easy-rsa\Windows\build-dh.bat"
206 File "${HOME}\easy-rsa\Windows\build-key-server.bat"
207 File "${HOME}\easy-rsa\Windows\build-key.bat"
208 File "${HOME}\easy-rsa\Windows\build-key-pkcs12.bat"
209 File "${HOME}\easy-rsa\Windows\clean-all.bat"
210 File "${HOME}\easy-rsa\Windows\index.txt.start"
211 File "${HOME}\easy-rsa\Windows\revoke-full.bat"
212 File "${HOME}\easy-rsa\Windows\serial.start"
214 SectionEnd
216 Section "OpenVPN Service" SecService
218 SetOverwrite on
220 SetOutPath "$INSTDIR\bin"
221 File "${HOME}\service-win32\openvpnserv.exe"
223 SetOutPath "$INSTDIR\config"
225 FileOpen $R0 "$INSTDIR\config\README.txt" w
226 FileWrite $R0 "This directory should contain OpenVPN configuration files$\r$\n"
227 FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
228 FileWrite $R0 "$\r$\n"
229 FileWrite $R0 "When OpenVPN is started as a service, a separate OpenVPN$\r$\n"
230 FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
231 FileClose $R0
233 SetOutPath "$INSTDIR\sample-config"
234 File "${HOME}\install-win32\sample.${SERV_CONFIG_EXT}"
235 File "${HOME}\install-win32\client.${SERV_CONFIG_EXT}"
236 File "${HOME}\install-win32\server.${SERV_CONFIG_EXT}"
238 CreateDirectory "$INSTDIR\log"
239 FileOpen $R0 "$INSTDIR\log\README.txt" w
240 FileWrite $R0 "This directory will contain the log files for OpenVPN$\r$\n"
241 FileWrite $R0 "sessions which are being run as a service.$\r$\n"
242 FileClose $R0
244 SectionEnd
246 Section "OpenVPN File Associations" SecFileAssociation
247 SectionEnd
249 Section "OpenSSL DLLs" SecOpenSSLDLLs
251 SetOverwrite on
252 SetOutPath "$INSTDIR\bin"
253 File "${BIN}\libeay32.dll"
254 File "${BIN}\libssl32.dll"
256 SectionEnd
258 Section "OpenSSL Utilities" SecOpenSSLUtilities
260 SetOverwrite on
261 SetOutPath "$INSTDIR\bin"
262 File "${BIN}\openssl.exe"
264 SectionEnd
266 Section "TAP-Win32 Virtual Ethernet Adapter" SecTAP
268 SetOverwrite on
269 SetOutPath "$INSTDIR\bin"
270 File "${BIN}\ti3790\tapinstall.exe"
272 FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
273 FileWrite $R0 "rem Add a new TAP-Win32 virtual ethernet adapter$\r$\n"
274 FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
275 FileWrite $R0 "pause$\r$\n"
276 FileClose $R0
278 FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
279 FileWrite $R0 "echo WARNING: this script will delete ALL TAP-Win32 virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
280 FileWrite $R0 "pause$\r$\n"
281 FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
282 FileWrite $R0 "pause$\r$\n"
283 FileClose $R0
285 SetOutPath "$INSTDIR\driver"
286 File "${HOME}\tap-win32\i386\OemWin2k.inf"
287 File "${HOME}\tap-win32\i386\${TAPDRV}"
289 SectionEnd
291 Section "Add OpenVPN to PATH" SecAddPath
293 ; remove previously set path (if any)
294 Push "$INSTDIR\bin"
295 Call RemoveFromPath
297 ; append our bin directory to end of current user path
298 Push "$INSTDIR\bin"
299 Call AddToPath
301 SectionEnd
303 Section "Add Shortcuts to Start Menu" SecAddShortcuts
305 SetOverwrite on
306 CreateDirectory "$SMPROGRAMS\OpenVPN"
307 WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
308 WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
309 WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
310 WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
311 CreateShortCut "$SMPROGRAMS\OpenVPN\Uninstall OpenVPN.lnk" "$INSTDIR\Uninstall.exe"
313 SectionEnd
315 ;--------------------
316 ;Post-install section
318 Section -post
320 ; delete old devcon.exe
321 Delete "$INSTDIR\bin\devcon.exe"
324 ; install/upgrade TAP-Win32 driver if selected, using tapinstall.exe
326 SectionGetFlags ${SecTAP} $R0
327 IntOp $R0 $R0 & ${SF_SELECTED}
328 IntCmp $R0 ${SF_SELECTED} "" notap notap
329 ; TAP install/update was selected.
330 ; Should we install or update?
331 ; If tapinstall error occurred, $5 will
332 ; be nonzero.
333 IntOp $5 0 & 0
334 nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
335 Pop $R0 # return value/error/timeout
336 IntOp $5 $5 | $R0
337 DetailPrint "tapinstall hwids returned: $R0"
339 ; If tapinstall output string contains "${TAP}" we assume
340 ; that TAP device has been previously installed,
341 ; therefore we will update, not install.
342 Push "${TAP}"
343 Call StrStr
344 Pop $R0
346 IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
347 IntCmp $R0 -1 tapinstall
349 ;tapupdate:
350 DetailPrint "TAP-Win32 UPDATE"
351 nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
352 Pop $R0 # return value/error/timeout
353 Call CheckReboot
354 IntOp $5 $5 | $R0
355 DetailPrint "tapinstall update returned: $R0"
356 Goto tapinstall_check_error
358 tapinstall:
359 DetailPrint "TAP-Win32 REMOVE OLD TAP"
360 nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP'
361 Pop $R0 # return value/error/timeout
362 DetailPrint "tapinstall remove TAP returned: $R0"
363 nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAPDEV'
364 Pop $R0 # return value/error/timeout
365 DetailPrint "tapinstall remove TAPDEV returned: $R0"
367 DetailPrint "TAP-Win32 INSTALL (${TAP})"
368 nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
369 Pop $R0 # return value/error/timeout
370 Call CheckReboot
371 IntOp $5 $5 | $R0
372 DetailPrint "tapinstall install returned: $R0"
374 tapinstall_check_error:
375 DetailPrint "tapinstall cumulative status: $5"
376 IntCmp $5 0 notap
377 MessageBox MB_OK "An error occurred installing the TAP-Win32 device driver."
379 notap:
381 ; Store install folder in registry
382 WriteRegStr HKLM SOFTWARE\OpenVPN "" $INSTDIR
384 ; install as a service if requested
385 SectionGetFlags ${SecService} $R0
386 IntOp $R0 $R0 & ${SF_SELECTED}
387 IntCmp $R0 ${SF_SELECTED} "" noserv noserv
389 ; set registry parameters for openvpnserv
390 !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "config_dir" "${SERV_CONFIG_DIR}"
391 !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "config_ext" "${SERV_CONFIG_EXT}"
392 !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "exe_path" "${SERV_EXE_PATH}"
393 !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "log_dir" "${SERV_LOG_DIR}"
394 !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "priority" "${SERV_PRIORITY}"
395 !insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "log_append" "${SERV_LOG_APPEND}"
397 ; install openvpnserv as a service
398 DetailPrint "Previous Service REMOVE (if exists)"
399 nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -remove'
400 Pop $R0 # return value/error/timeout
401 DetailPrint "Service INSTALL"
402 nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -install'
403 Pop $R0 # return value/error/timeout
405 noserv:
406 ; Store README, license, icon
407 SetOverwrite on
408 SetOutPath $INSTDIR
409 File "${HOME}\install-win32\INSTALL-win32.txt"
410 File "${HOME}\install-win32\license.txt"
411 File "${HOME}\install-win32\openvpn.ico"
413 ; Create file association if requested
414 SectionGetFlags ${SecFileAssociation} $R0
415 IntOp $R0 $R0 & ${SF_SELECTED}
416 IntCmp $R0 ${SF_SELECTED} "" noass noass
417 !insertmacro WriteRegStringIfUndef HKCR ".${SERV_CONFIG_EXT}" "" "OpenVPNFile"
418 !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile" "" "OpenVPN Config File"
419 !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell" "" "open"
420 !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\DefaultIcon" "" "$INSTDIR\openvpn.ico,0"
421 !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\open\command" "" 'notepad.exe "%1"'
422 !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\run" "" "Start OpenVPN on this config file"
423 !insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\run\command" "" '"$INSTDIR\bin\openvpn.exe" --pause-exit --config "%1"'
425 ; Create start menu shortcuts to addtap.bat and deltapall.bat
426 noass:
427 IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
428 CreateShortCut "$SMPROGRAMS\OpenVPN\Add a new TAP-Win32 virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
430 trydeltap:
431 IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
432 CreateShortCut "$SMPROGRAMS\OpenVPN\Delete ALL TAP-Win32 virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
434 ; Create start menu shortcuts for config and log directories
435 config_shortcut:
436 IfFileExists "$INSTDIR\config" "" log_shortcut
437 CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN configuration file directory.lnk" "$INSTDIR\config" ""
439 log_shortcut:
440 IfFileExists "$INSTDIR\log" "" samp_shortcut
441 CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN log file directory.lnk" "$INSTDIR\log" ""
443 samp_shortcut:
444 IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
445 CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
447 genkey_shortcut:
448 IfFileExists "$INSTDIR\bin\openvpn.exe" "" noshortcuts
449 IfFileExists "$INSTDIR\config" "" noshortcuts
450 CreateShortCut "$SMPROGRAMS\OpenVPN\Generate a static OpenVPN key.lnk" "$INSTDIR\bin\openvpn.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\openvpn.ico" 0
452 noshortcuts:
453 ; Create uninstaller
454 WriteUninstaller "$INSTDIR\Uninstall.exe"
456 ; Show up in Add/Remove programs
457 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
458 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
459 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\openvpn.ico"
460 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
462 ; Advise a reboot
463 ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP-Win32 driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
465 SectionEnd
467 ;--------------------------------
468 ;Descriptions
470 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
471 !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
472 !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
473 !insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP)
474 !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities)
475 !insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs)
476 !insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath)
477 !insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts)
478 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
479 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation)
480 !insertmacro MUI_FUNCTION_DESCRIPTION_END
482 ;--------------------------------
483 ;Uninstaller Section
485 Function un.onInit
486 ClearErrors
487 UserInfo::GetName
488 IfErrors ok
489 Pop $R0
490 UserInfo::GetAccountType
491 Pop $R1
492 StrCmp $R1 "Admin" ok
493 Messagebox MB_OK "Administrator privileges required to uninstall OpenVPN [$R0/$R1]"
494 Abort
496 FunctionEnd
498 Section "Uninstall"
500 DetailPrint "Service REMOVE"
501 nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -remove'
502 Pop $R0 # return value/error/timeout
504 Sleep 2000
506 DetailPrint "TAP-Win32 REMOVE"
507 nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
508 Pop $R0 # return value/error/timeout
509 DetailPrint "tapinstall remove returned: $R0"
511 Push "$INSTDIR\bin"
512 Call un.RemoveFromPath
514 RMDir /r $SMPROGRAMS\OpenVPN
516 Delete "$INSTDIR\bin\openvpn.exe"
517 Delete "$INSTDIR\bin\openvpnserv.exe"
518 Delete "$INSTDIR\bin\libeay32.dll"
519 Delete "$INSTDIR\bin\libssl32.dll"
520 Delete "$INSTDIR\bin\tapinstall.exe"
521 Delete "$INSTDIR\bin\addtap.bat"
522 Delete "$INSTDIR\bin\deltapall.bat"
524 Delete "$INSTDIR\config\README.txt"
525 Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
527 Delete "$INSTDIR\log\README.txt"
529 Delete "$INSTDIR\driver\OemWin2k.inf"
530 Delete "$INSTDIR\driver\${TAPDRV}"
532 Delete "$INSTDIR\bin\openssl.exe"
534 Delete "$INSTDIR\INSTALL-win32.txt"
535 Delete "$INSTDIR\openvpn.ico"
536 Delete "$INSTDIR\license.txt"
537 Delete "$INSTDIR\Uninstall.exe"
539 Delete "$INSTDIR\easy-rsa\openssl.cnf.sample"
540 Delete "$INSTDIR\easy-rsa\vars.bat.sample"
541 Delete "$INSTDIR\easy-rsa\init-config.bat"
542 Delete "$INSTDIR\easy-rsa\README.txt"
543 Delete "$INSTDIR\easy-rsa\build-ca.bat"
544 Delete "$INSTDIR\easy-rsa\build-dh.bat"
545 Delete "$INSTDIR\easy-rsa\build-key-server.bat"
546 Delete "$INSTDIR\easy-rsa\build-key.bat"
547 Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
548 Delete "$INSTDIR\easy-rsa\clean-all.bat"
549 Delete "$INSTDIR\easy-rsa\index.txt.start"
550 Delete "$INSTDIR\easy-rsa\revoke-key.bat"
551 Delete "$INSTDIR\easy-rsa\revoke-full.bat"
552 Delete "$INSTDIR\easy-rsa\serial.start"
554 Delete "$INSTDIR\sample-config\*.ovpn"
556 RMDir "$INSTDIR\bin"
557 RMDir "$INSTDIR\driver"
558 RMDir "$INSTDIR\easy-rsa"
559 RMDir "$INSTDIR\sample-config"
560 RMDir "$INSTDIR"
562 !insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "OpenVPNFile"
563 DeleteRegKey HKCR "OpenVPNFile"
564 DeleteRegKey HKLM SOFTWARE\OpenVPN
565 DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
566 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenVPN"
568 ;Messagebox MB_OK "IMPORTANT: If you intend on reinstalling OpenVPN after this uninstall, and you are running Win2K, you are strongly urged to reboot before reinstalling (this is an informational message only, pressing OK will not reboot)."
570 SectionEnd