1 ; ****************************************************************************
2 ; * Copyright (C) 2002-2009 OpenVPN Technologies, Inc. *
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
15 !include "guidefs.nsi"
16 !include "xguidefs.nsi"
17 !include "setpath.nsi"
18 !include "GetWindowsVersion.nsi"
21 !include "MultiFileExtract.nsi"
25 !define BIN
"${GEN}\bin"
26 !define LIB
"${GEN}\lib"
28 ; Which GUI to use (XGUI has priority).
29 ; We will define either USE_XGUI (XML-based version) or
30 ; USE_GUI (Mathias Sundman version) but not both.
31 !ifdef OPENVPN_XGUI_DEFINED
34 !ifdef OPENVPN_GUI_DEFINED
39 !define PRODUCT_ICON
"icon.ico"
42 !define XGUI_POSTFIX
"X"
44 !define XGUI_POSTFIX
""
47 !ifdef PRODUCT_TAP_DEBUG
48 !define DBG_POSTFIX
"-DBG"
50 !define DBG_POSTFIX
""
53 !define VERSION
"${PRODUCT_VERSION}${XGUI_POSTFIX}${DBG_POSTFIX}"
55 !define TAP
"${PRODUCT_TAP_ID}"
56 !define TAPDRV
"${TAP}.sys"
58 ; Default service settings
59 !define SERV_CONFIG_DIR
"$INSTDIR\config"
60 !define SERV_CONFIG_EXT
"${PRODUCT_FILE_EXT}"
61 !define SERV_EXE_PATH
"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
62 !define SERV_LOG_DIR
"$INSTDIR\log"
63 !define SERV_PRIORITY
"NORMAL_PRIORITY_CLASS"
64 !define SERV_LOG_APPEND
"0"
67 !define XGUI_EXE ovpn
-xgui
-en
.exe
68 !define XGUI_TRAY ovpn
-tray
.exe
69 !define XGUI_XMLSERV ovpn
-xmlserv
.exe
70 !define XGUI_HTDOCS htdocs
72 !define XGUI_AJAX_GUI_NAME
"${PRODUCT_NAME} Ajax GUI"
73 !define XGUI_TRANSITION_GUI_NAME
"${PRODUCT_NAME} Transitional GUI"
75 ;--------------------------------
80 OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe"
83 ShowUninstDetails show
85 ;Folder selection page
86 InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
88 ;Remember install folder
89 InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
91 ;--------------------------------
92 ;Modern UI Configuration
94 Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
96 !define MUI_WELCOMEPAGE_TEXT
"This wizard will guide you through the installation of ${PRODUCT_NAME}, an Open Source VPN package by James Yonan.\r\n\r\nNote that the Windows version of ${PRODUCT_NAME} will only run on Win 2000, XP, or higher.\r\n\r\n\r\n"
98 !define MUI_COMPONENTSPAGE_TEXT_TOP
"Select the components to install/upgrade. Stop any ${PRODUCT_NAME} processes or the ${PRODUCT_NAME} service if it is running. All DLLs are installed locally."
100 !define MUI_COMPONENTSPAGE_SMALLDESC
102 !define MUI_FINISHPAGE_SHOWREADME
"http://openvpn.net/"
103 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
105 !define MUI_FINISHPAGE_SHOWREADME
"$INSTDIR\INSTALL-win32.txt"
107 !define MUI_FINISHPAGE_NOAUTOCLOSE
108 !define MUI_ABORTWARNING
109 !define MUI_ICON
"${GEN}\images\${PRODUCT_ICON}"
110 !define MUI_UNICON
"${GEN}\images\${PRODUCT_ICON}"
111 !define MUI_HEADERIMAGE
112 !define MUI_HEADERIMAGE_BITMAP
"${GEN}\images\install-whirl.bmp"
113 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
115 !insertmacro MUI_PAGE_WELCOME
116 !insertmacro MUI_PAGE_LICENSE
"${GEN}\text\license.txt"
117 !insertmacro MUI_PAGE_COMPONENTS
118 !insertmacro MUI_PAGE_DIRECTORY
119 !insertmacro MUI_PAGE_INSTFILES
120 !insertmacro MUI_PAGE_FINISH
122 !insertmacro MUI_UNPAGE_CONFIRM
123 !insertmacro MUI_UNPAGE_INSTFILES
124 !insertmacro MUI_UNPAGE_FINISH
127 ;--------------------------------
130 !insertmacro MUI_LANGUAGE
"English"
132 ;--------------------------------
135 LangString DESC_SecOpenVPNUserSpace
${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe."
138 LangString DESC_SecOpenVPNGUI
${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman"
142 LangString DESC_SecOpenVPNXGUI
${LANG_ENGLISH} "Install ${PRODUCT_NAME} XML-based GUI"
145 LangString DESC_SecOpenVPNEasyRSA
${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management."
147 LangString DESC_SecOpenSSLDLLs
${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
149 LangString DESC_SecPKCS11DLLs
${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)."
151 LangString DESC_SecTAP
${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE."
153 LangString DESC_SecService
${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)"
155 LangString DESC_SecOpenSSLUtilities
${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
157 LangString DESC_SecAddPath
${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH."
159 LangString DESC_SecAddShortcuts
${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu."
161 LangString DESC_SecFileAssociation
${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})"
163 ;--------------------------------
166 ;Things that need to be extracted on first (keep these lines before any File command!)
167 ;Only useful for BZIP2 compression
169 ReserveFile
"${GEN}\images\install-whirl.bmp"
171 ;--------------------------------
174 !macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
176 ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
178 WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
182 !macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
184 ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
185 StrCmp $R0 '${VALUE}' +1 +2
186 DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
190 !macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
192 ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
193 StrCmp $R0 '${VALUE}' +1 +2
194 DeleteRegKey "${ROOT}" "${SUBKEY}"
198 !macro DelRegKeyIfEmpty ROOT SUBKEY
200 EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
202 DeleteRegKey /ifempty
"${ROOT}" "${SUBKEY}"
206 ;------------------------------------------
207 ;Set reboot flag based on tapinstall return
210 IntCmp $R0 1 "" noreboot noreboot
213 DetailPrint "REBOOT flag set"
217 ;--------------------------------
223 # Verify that user has admin privs
227 UserInfo::GetAccountType
229 StrCmp $R1 "Admin" ok
230 Messagebox
MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]"
234 # Delete previous start menu
235 RMDir /r
$SMPROGRAMS\
${PRODUCT_NAME}
237 !ifdef CHECK_WINDOWS_VERSION
238 # Check windows version
239 Call GetWindowsVersion
241 StrCmp $1 "2000" goodwinver
242 StrCmp $1 "XP" goodwinver
243 StrCmp $1 "2003" goodwinver
244 StrCmp $1 "VISTA" goodwinver
246 Messagebox
MB_OK "Sorry, ${PRODUCT_NAME} does not currently support Windows $1"
250 System::Call "kernel32::GetCurrentProcess() i .s"
251 System::Call "kernel32::IsWow64Process(i s, *i .r0)"
252 IntCmp $0 0 init32bits
254 ; we are running on 64-bit windows
255 StrCmp $1 "VISTA" vista64bummer
257 # Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Windows."
262 # Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Vista because Microsoft doesn't allow the installation of 64 bit unsigned drivers."
272 !define SF_SELECTED
1
275 ;--------------------
280 ; Stop OpenVPN if currently running
281 DetailPrint "Previous Service REMOVE (if exists)"
282 nsExec::ExecToLog
'"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
283 Pop $R0 # return value/error/timeout
286 DetailPrint "Previous XML Service REMOVE (if exists)"
287 nsExec::ExecToLog
'"$INSTDIR\bin\${XGUI_XMLSERV}" -remove'
288 Pop $R0 # return value/error/timeout
295 Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace
298 SetOutPath "$INSTDIR\bin"
300 File "${BIN}\${PRODUCT_UNIX_NAME}.exe"
305 Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI
308 SetOutPath "$INSTDIR\bin"
310 File "${BIN}\${OPENVPN_GUI}"
316 Section "${PRODUCT_NAME} XML-based GUI" SecOpenVPNXGUI
320 SetOutPath "$INSTDIR\bin"
321 File "${BIN}\${XGUI_EXE}"
322 File "${BIN}\${XGUI_TRAY}"
323 File "${BIN}\${XGUI_XMLSERV}"
325 SetOutPath "$INSTDIR\${XGUI_HTDOCS}"
326 File "${GEN}\${XGUI_HTDOCS}\*.*"
331 Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA
334 SetOutPath "$INSTDIR\easy-rsa"
336 File "${GEN}\easy-rsa\openssl.cnf.sample"
337 File "${GEN}\easy-rsa\vars.bat.sample"
339 File "${GEN}\easy-rsa\init-config.bat"
341 File "${GEN}\easy-rsa\README.txt"
342 File "${GEN}\easy-rsa\build-ca.bat"
343 File "${GEN}\easy-rsa\build-dh.bat"
344 File "${GEN}\easy-rsa\build-key-server.bat"
345 File "${GEN}\easy-rsa\build-key.bat"
346 File "${GEN}\easy-rsa\build-key-pkcs12.bat"
347 File "${GEN}\easy-rsa\clean-all.bat"
348 File "${GEN}\easy-rsa\index.txt.start"
349 File "${GEN}\easy-rsa\revoke-full.bat"
350 File "${GEN}\easy-rsa\serial.start"
354 Section "${PRODUCT_NAME} Service" SecService
358 SetOutPath "$INSTDIR\bin"
359 File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe"
361 SetOutPath "$INSTDIR\config"
363 FileOpen $R0 "$INSTDIR\config\README.txt" w
364 FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n"
365 FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
366 FileWrite $R0 "$\r$\n"
367 FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n"
368 FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
371 SetOutPath "$INSTDIR\sample-config"
372 File "${GEN}\samples\sample.${SERV_CONFIG_EXT}"
373 File "${GEN}\samples\client.${SERV_CONFIG_EXT}"
374 File "${GEN}\samples\server.${SERV_CONFIG_EXT}"
376 CreateDirectory "$INSTDIR\log"
377 FileOpen $R0 "$INSTDIR\log\README.txt" w
378 FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n"
379 FileWrite $R0 "sessions which are being run as a service.$\r$\n"
384 Section "${PRODUCT_NAME} File Associations" SecFileAssociation
387 Section "OpenSSL DLLs" SecOpenSSLDLLs
390 SetOutPath "$INSTDIR\bin"
391 File "${LIB}\libeay32.dll"
392 File "${LIB}\libssl32.dll"
396 Section "OpenSSL Utilities" SecOpenSSLUtilities
399 SetOutPath "$INSTDIR\bin"
400 File "${BIN}\openssl.exe"
404 Section "PKCS#11 DLLs" SecPKCS11DLLs
407 SetOutPath "$INSTDIR\bin"
408 File "${LIB}\libpkcs11-helper-1.dll"
412 Section "TAP Virtual Ethernet Adapter" SecTAP
416 FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
417 FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n"
418 FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
419 FileWrite $R0 "pause$\r$\n"
422 FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
423 FileWrite $R0 "echo WARNING: this script will delete ALL TAP virtual adapters (use the device manager to delete adapters one at a time)$\r$\n"
424 FileWrite $R0 "pause$\r$\n"
425 FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
426 FileWrite $R0 "pause$\r$\n"
429 ; Check if we are running on a 64 bit system.
430 System::Call "kernel32::GetCurrentProcess() i .s"
431 System::Call "kernel32::IsWow64Process(i s, *i .r0)"
432 IntCmp $0 0 tap
-32bit
436 DetailPrint "We are running on a 64-bit system."
438 SetOutPath "$INSTDIR\bin"
440 File "${GEN}\tapinstall\amd64\tapinstall.exe"
442 SetOutPath "$INSTDIR\driver"
444 File "${GEN}\driver\amd64\OemWin2k.inf"
445 File "${GEN}\driver\amd64\${PRODUCT_TAP_ID}.cat"
446 File "${GEN}\driver\amd64\${TAPDRV}"
452 DetailPrint "We are running on a 32-bit system."
454 SetOutPath "$INSTDIR\bin"
455 File "${GEN}\tapinstall\i386\tapinstall.exe"
457 SetOutPath "$INSTDIR\driver"
458 File "${GEN}\driver\i386\OemWin2k.inf"
459 File "${GEN}\driver\i386\${PRODUCT_TAP_ID}.cat"
460 File "${GEN}\driver\i386\${TAPDRV}"
466 Section "Add ${PRODUCT_NAME} to PATH" SecAddPath
468 ; remove previously set path (if any)
472 ; append our bin directory to end of current user path
478 Section "Add Shortcuts to Start Menu" SecAddShortcuts
481 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
482 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation"
483 WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
484 WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
485 WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
486 WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
487 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
491 ;--------------------
492 ;Post-install section
498 ; delete old devcon.exe
499 Delete "$INSTDIR\bin\devcon.exe"
501 ; Store README, license, icon
505 File "${GEN}\text\INSTALL-win32.txt"
507 File "${GEN}\text\license.txt"
508 File "${GEN}\images\${PRODUCT_ICON}"
510 ; store sample config files
513 SetOutPath "$INSTDIR\config"
515 File "${GEN}\conf\${SAMPCONF_CONF}"
517 !ifdef SAMPCONF_CONF2
518 File "${GEN}\conf\${SAMPCONF_CONF2}"
521 File "${GEN}\conf\${SAMPCONF_P12}"
524 File "${GEN}\conf\${SAMPCONF_TA}"
527 File "${GEN}\conf\${SAMPCONF_CA}"
530 File "${GEN}\conf\${SAMPCONF_CRT}"
533 File "${GEN}\conf\${SAMPCONF_KEY}"
536 File "${GEN}\conf\${SAMPCONF_DH}"
540 ; Try to extract files if present
543 Call MultiFileExtract
545 IntCmp $R0 0 +3 +1 +1
546 DetailPrint "MultiFileExtract Failed status=$R0"
548 DetailPrint "MultiFileExtract Succeeded"
552 ; install/upgrade TAP driver if selected, using tapinstall.exe
554 SectionGetFlags
${SecTAP} $R0
555 IntOp $R0 $R0 & ${SF_SELECTED}
556 IntCmp $R0 ${SF_SELECTED} "" notap notap
557 ; TAP install/update was selected.
558 ; Should we install or update?
559 ; If tapinstall error occurred, $5 will
562 nsExec::ExecToStack
'"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
563 Pop $R0 # return value/error/timeout
565 DetailPrint "tapinstall hwids returned: $R0"
567 ; If tapinstall output string contains "${TAP}" we assume
568 ; that TAP device has been previously installed,
569 ; therefore we will update, not install.
574 IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
575 IntCmp $R0 -1 tapinstall
578 DetailPrint "TAP UPDATE"
579 nsExec::ExecToLog
'"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
580 Pop $R0 # return value/error/timeout
583 DetailPrint "tapinstall update returned: $R0"
584 Goto tapinstall_check_error
587 DetailPrint "TAP REMOVE OLD TAP"
589 nsExec::ExecToLog
'"$INSTDIR\bin\tapinstall.exe" remove TAP0801'
590 Pop $R0 # return value/error/timeout
591 DetailPrint "tapinstall remove TAP0801 returned: $R0"
593 DetailPrint "TAP INSTALL (${TAP})"
594 nsExec::ExecToLog
'"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
595 Pop $R0 # return value/error/timeout
598 DetailPrint "tapinstall install returned: $R0"
600 tapinstall_check_error:
601 DetailPrint "tapinstall cumulative status: $5"
603 MessageBox MB_OK "An error occurred installing the TAP device driver."
607 ; Store install folder in registry
608 WriteRegStr HKLM SOFTWARE\
${PRODUCT_NAME} "" $INSTDIR
610 ; install as a service if requested
611 SectionGetFlags
${SecService} $R0
612 IntOp $R0 $R0 & ${SF_SELECTED}
613 IntCmp $R0 ${SF_SELECTED} "" noserv noserv
615 ; set registry parameters for openvpnserv
616 !insertmacro WriteRegStringIfUndef
HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}"
617 !insertmacro WriteRegStringIfUndef
HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}"
618 !insertmacro WriteRegStringIfUndef
HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}"
619 !insertmacro WriteRegStringIfUndef
HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}"
620 !insertmacro WriteRegStringIfUndef
HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}"
621 !insertmacro WriteRegStringIfUndef
HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}"
623 ; install openvpnserv as a service (to be started manually from service control manager)
624 DetailPrint "Service INSTALL"
625 nsExec::ExecToLog
'"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install'
626 Pop $R0 # return value/error/timeout
630 IfFileExists "$INSTDIR\bin\${XGUI_XMLSERV}" "" fileass
631 ; install and automatically start XML service
632 DetailPrint "XML Service INSTALL"
633 nsExec::ExecToLog
'"$INSTDIR\bin\${XGUI_XMLSERV}" -install'
634 Pop $R0 # return value/error/timeout
638 DetailPrint "XML Service START"
639 nsExec::ExecToLog
'"$INSTDIR\bin\${XGUI_XMLSERV}" -start'
640 Pop $R0 # return value/error/timeout
644 ; Create file association if requested
646 SectionGetFlags
${SecFileAssociation} $R0
647 IntOp $R0 $R0 & ${SF_SELECTED}
648 IntCmp $R0 ${SF_SELECTED} "" noass noass
649 WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File"
650 WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File"
651 WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open"
652 WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0"
653 WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"'
654 WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file"
655 WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"'
657 ; Create start menu folders
659 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities"
660 CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts"
662 ; Create start menu and desktop shortcuts to OpenVPN GUI
664 IfFileExists "$INSTDIR\bin\${OPENVPN_GUI}" "" tryaddxgui
665 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
666 CreateShortcut
"$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
669 ; Create start menu and desktop shortcuts to OpenVPN XGUI
672 IfFileExists "$INSTDIR\bin\${XGUI_EXE}" "" tryaddtray
673 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" ""
674 # CreateShortcut "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}"
676 IfFileExists "$INSTDIR\bin\${XGUI_TRAY}" "" tryaddtap
677 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_EXE}" ""
678 CreateShortcut
"$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk" "$INSTDIR\bin\${XGUI_TRAY}"
681 ; Create start menu shortcuts to addtap.bat and deltapall.bat
683 IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
684 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
687 IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
688 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
690 ; Create start menu shortcuts for config and log directories
692 IfFileExists "$INSTDIR\config" "" log_shortcut
693 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" ""
696 IfFileExists "$INSTDIR\log" "" samp_shortcut
697 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" ""
700 IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
701 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
704 IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts
705 IfFileExists "$INSTDIR\config" "" noshortcuts
706 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Generate a static ${PRODUCT_NAME} key.lnk" "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" '--pause-exit --verb 3 --genkey --secret "$INSTDIR\config\key.txt"' "$INSTDIR\${PRODUCT_ICON}" 0
710 WriteUninstaller "$INSTDIR\Uninstall.exe"
712 ; Show up in Add/Remove programs
713 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
714 WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
715 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
716 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
719 ;Messagebox MB_OK "IMPORTANT: Rebooting the system is advised in order to finalize TAP driver installation/upgrade (this is an informational message only, pressing OK will not reboot)."
723 ;--------------------------------
726 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
727 !insertmacro MUI_DESCRIPTION_TEXT
${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace
)
729 !insertmacro MUI_DESCRIPTION_TEXT
${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI
)
732 !insertmacro MUI_DESCRIPTION_TEXT
${SecOpenVPNXGUI} $(DESC_SecOpenVPNXGUI
)
734 !insertmacro MUI_DESCRIPTION_TEXT
${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA
)
735 !insertmacro MUI_DESCRIPTION_TEXT
${SecTAP} $(DESC_SecTAP
)
736 !insertmacro MUI_DESCRIPTION_TEXT
${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities
)
737 !insertmacro MUI_DESCRIPTION_TEXT
${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs
)
738 !insertmacro MUI_DESCRIPTION_TEXT
${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs
)
739 !insertmacro MUI_DESCRIPTION_TEXT
${SecAddPath} $(DESC_SecAddPath
)
740 !insertmacro MUI_DESCRIPTION_TEXT
${SecAddShortcuts} $(DESC_SecAddShortcuts
)
741 !insertmacro MUI_DESCRIPTION_TEXT
${SecService} $(DESC_SecService
)
742 !insertmacro MUI_DESCRIPTION_TEXT
${SecFileAssociation} $(DESC_SecFileAssociation
)
743 !insertmacro MUI_FUNCTION_DESCRIPTION_END
745 ;--------------------------------
753 UserInfo::GetAccountType
755 StrCmp $R1 "Admin" ok
756 Messagebox
MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]"
764 DetailPrint "XML Service REMOVE"
765 nsExec::ExecToLog
'"$INSTDIR\bin\${XGUI_XMLSERV}" -remove'
766 Pop $R0 # return value/error/timeout
769 ; Stop OpenVPN if currently running
770 DetailPrint "Service REMOVE"
771 nsExec::ExecToLog
'"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
772 Pop $R0 # return value/error/timeout
776 DetailPrint "TAP REMOVE"
777 nsExec::ExecToLog
'"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
778 Pop $R0 # return value/error/timeout
779 DetailPrint "tapinstall remove returned: $R0"
782 Call un
.RemoveFromPath
784 RMDir /r
$SMPROGRAMS\
${PRODUCT_NAME}
786 ; delete sample config files
789 Delete "$INSTDIR\config\${SAMPCONF_CONF}"
791 !ifdef SAMPCONF_CONF2
792 Delete "$INSTDIR\config\${SAMPCONF_CONF2}"
795 Delete "$INSTDIR\config\${SAMPCONF_P12}"
798 Delete "$INSTDIR\config\${SAMPCONF_TA}"
801 Delete "$INSTDIR\config\${SAMPCONF_CA}"
804 Delete "$INSTDIR\config\${SAMPCONF_CRT}"
807 Delete "$INSTDIR\config\${SAMPCONF_KEY}"
810 Delete "$INSTDIR\config\${SAMPCONF_DH}"
815 Delete "$INSTDIR\bin\${OPENVPN_GUI}"
816 Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
820 Delete "$INSTDIR\bin\${XGUI_EXE}"
821 Delete "$INSTDIR\bin\${XGUI_TRAY}"
822 Delete "$INSTDIR\bin\${XGUI_XMLSERV}"
823 RMDir /r
"$INSTDIR\${XGUI_HTDOCS}"
824 Delete "$DESKTOP\${XGUI_AJAX_GUI_NAME}.lnk"
825 Delete "$DESKTOP\${XGUI_TRANSITION_GUI_NAME}.lnk"
828 Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
829 Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe"
830 Delete "$INSTDIR\bin\libeay32.dll"
831 Delete "$INSTDIR\bin\libssl32.dll"
832 Delete "$INSTDIR\bin\libpkcs11-helper-1.dll"
833 Delete "$INSTDIR\bin\tapinstall.exe"
834 Delete "$INSTDIR\bin\addtap.bat"
835 Delete "$INSTDIR\bin\deltapall.bat"
837 Delete "$INSTDIR\config\README.txt"
838 Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
840 Delete "$INSTDIR\log\README.txt"
842 Delete "$INSTDIR\driver\OemWin2k.inf"
843 Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat"
844 Delete "$INSTDIR\driver\${TAPDRV}"
846 Delete "$INSTDIR\bin\openssl.exe"
848 Delete "$INSTDIR\INSTALL-win32.txt"
849 Delete "$INSTDIR\${PRODUCT_ICON}"
850 Delete "$INSTDIR\license.txt"
851 Delete "$INSTDIR\Uninstall.exe"
853 Delete "$INSTDIR\easy-rsa\openssl.cnf.sample"
854 Delete "$INSTDIR\easy-rsa\vars.bat.sample"
855 Delete "$INSTDIR\easy-rsa\init-config.bat"
856 Delete "$INSTDIR\easy-rsa\README.txt"
857 Delete "$INSTDIR\easy-rsa\build-ca.bat"
858 Delete "$INSTDIR\easy-rsa\build-dh.bat"
859 Delete "$INSTDIR\easy-rsa\build-key-server.bat"
860 Delete "$INSTDIR\easy-rsa\build-key.bat"
861 Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
862 Delete "$INSTDIR\easy-rsa\clean-all.bat"
863 Delete "$INSTDIR\easy-rsa\index.txt.start"
864 Delete "$INSTDIR\easy-rsa\revoke-key.bat"
865 Delete "$INSTDIR\easy-rsa\revoke-full.bat"
866 Delete "$INSTDIR\easy-rsa\serial.start"
868 Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}"
871 RMDir "$INSTDIR\config"
872 RMDir "$INSTDIR\driver"
873 RMDir "$INSTDIR\easy-rsa"
874 RMDir "$INSTDIR\sample-config"
875 RMDir /r
"$INSTDIR\log"
878 !insertmacro DelRegKeyIfUnchanged
HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File"
879 DeleteRegKey HKCR "${PRODUCT_NAME}File"
880 DeleteRegKey HKLM SOFTWARE\
${PRODUCT_NAME}
881 DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
882 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
884 ;Messagebox MB_OK "IMPORTANT: If you intend on reinstalling ${PRODUCT_NAME} 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)."