1
; ****************************************************************************
2
; * Copyright (C) 2002-2010 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
10
; Start menu entries don't get uninstalled properly on Windows Vista/7 unless we
11
; explicitly state that the installer requires admin privileges. This is
12
; caused by backwards compatibility tricks used on those platforms. For details,
13
; see http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
14
RequestExecutionLevel admin
20
# Include basic build settings
21
!include "settings.in"
23
# Include variables generated dynamically from version.m4 by wb.py
24
!include "version_m4_vars.tmp"
26
;!include "guidefs.nsi"
27
!include "setpath.nsi"
30
!include "MultiFileExtract.nsi"
34
!define BIN "${GEN}\bin"
35
!define EASYRSA "..\easy-rsa"
37
!define PRODUCT_ICON "icon.ico"
39
!ifdef PRODUCT_TAP_DEBUG
40
!define DBG_POSTFIX "-DBG"
42
!define DBG_POSTFIX ""
45
!define VERSION "${PRODUCT_VERSION}${DBG_POSTFIX}"
47
!define TAP "${PRODUCT_TAP_ID}"
48
!define TAPDRV "${TAP}.sys"
50
; Default service settings
51
!define SERV_CONFIG_DIR "$INSTDIR\config"
52
!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}"
53
!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
54
!define SERV_LOG_DIR "$INSTDIR\log"
55
!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
56
!define SERV_LOG_APPEND "0"
58
;--------------------------------
63
OutFile "${GEN}\${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe"
66
ShowUninstDetails show
68
;Folder selection page
69
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
71
;Remember install folder
72
InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
74
;--------------------------------
75
;Modern UI Configuration
77
Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
79
!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} only runs on XP, or higher.\r\n\r\n\r\n"
81
!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."
83
!define MUI_COMPONENTSPAGE_SMALLDESC
84
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
85
!define MUI_FINISHPAGE_NOAUTOCLOSE
86
!define MUI_ABORTWARNING
87
!define MUI_ICON "..\images\${PRODUCT_ICON}"
88
!define MUI_UNICON "..\images\${PRODUCT_ICON}"
89
!define MUI_HEADERIMAGE
90
!define MUI_HEADERIMAGE_BITMAP "..\images\install-whirl.bmp"
91
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
93
!insertmacro MUI_PAGE_WELCOME
94
!insertmacro MUI_PAGE_LICENSE "..\COPYRIGHT.GPL"
95
!insertmacro MUI_PAGE_COMPONENTS
96
!insertmacro MUI_PAGE_DIRECTORY
97
!insertmacro MUI_PAGE_INSTFILES
98
!insertmacro MUI_PAGE_FINISH
100
!insertmacro MUI_UNPAGE_CONFIRM
101
!insertmacro MUI_UNPAGE_INSTFILES
102
!insertmacro MUI_UNPAGE_FINISH
105
;--------------------------------
108
!insertmacro MUI_LANGUAGE "English"
110
;--------------------------------
113
LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe."
116
LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman"
119
LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management."
121
LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
123
LangString DESC_SecPKCS11DLLs ${LANG_ENGLISH} "Install PKCS#11 helper DLLs locally (may be omitted if DLLs are already installed globally)."
125
LangString DESC_SecLZO2DLLs ${LANG_ENGLISH} "Install LZO2 DLLs locally (may be omitted if DLLs are already installed globally)."
127
LangString DESC_SecMSVCR90DLL ${LANG_ENGLISH} "Install Microsoft Visual C 9.0 Runtime (may be omitted if it is already installed globally)."
129
LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP virtual device driver. Will not interfere with CIPE."
131
LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)"
133
LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
135
LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH."
137
LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu."
139
LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})"
141
;--------------------------------
144
;Things that need to be extracted on first (keep these lines before any File command!)
145
;Only useful for BZIP2 compression
147
ReserveFile "..\images\install-whirl.bmp"
149
;--------------------------------
152
!macro WriteRegStringIfUndef ROOT SUBKEY KEY VALUE
154
ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
156
WriteRegStr "${ROOT}" "${SUBKEY}" "${KEY}" '${VALUE}'
160
!macro DelRegStringIfUnchanged ROOT SUBKEY KEY VALUE
162
ReadRegStr $R0 "${ROOT}" "${SUBKEY}" "${KEY}"
163
StrCmp $R0 '${VALUE}' +1 +2
164
DeleteRegValue "${ROOT}" "${SUBKEY}" "${KEY}"
168
!macro DelRegKeyIfUnchanged ROOT SUBKEY VALUE
170
ReadRegStr $R0 "${ROOT}" "${SUBKEY}" ""
171
StrCmp $R0 '${VALUE}' +1 +2
172
DeleteRegKey "${ROOT}" "${SUBKEY}"
176
!macro DelRegKeyIfEmpty ROOT SUBKEY
178
EnumRegValue $R0 "${ROOT}" "${SUBKEY}" 1
180
DeleteRegKey /ifempty "${ROOT}" "${SUBKEY}"
184
;------------------------------------------
185
;Set reboot flag based on tapinstall return
188
IntCmp $R0 1 "" noreboot noreboot
191
DetailPrint "REBOOT flag set"
195
;--------------------------------
201
# Verify that user has admin privs
205
UserInfo::GetAccountType
207
StrCmp $R1 "Admin" ok
208
Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]"
212
# Delete previous start menu
213
RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
215
# FIXME: reimplement Windows version checking code that was located here, but
216
# disabled intentionally to avoid Windows 7 issues. This should do it:
218
# http://nsis.sourceforge.net/Get_Windows_version
220
# Blacklisting should be safer than whitelisting used originally.
225
!define SF_SELECTED 1
228
;--------------------
233
; Stop OpenVPN if currently running
234
DetailPrint "Previous Service REMOVE (if exists)"
235
nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
236
Pop $R0 # return value/error/timeout
240
# Fix for Trac ticket 120. Remove after 2.3 has been released.
242
SetShellVarContext current
243
Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
248
Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace
251
SetOutPath "$INSTDIR\bin"
253
File "${BIN}\${PRODUCT_UNIX_NAME}.exe"
258
Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI
261
SetOutPath "$INSTDIR\bin"
263
File "${BIN}\${OPENVPN_GUI}"
268
Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA
271
SetOutPath "$INSTDIR\easy-rsa"
273
# FIXME: the easy-rsa directory would need cleaning up
275
# Original nsi script looked for ${EASYRSA}\2.0\openssl.cnf.sample. A newer
276
# openssl.cnf is needed on OpenVPN 2.2+.
277
File "${EASYRSA}\2.0\openssl-1.0.0.cnf"
279
File "${EASYRSA}\Windows\vars.bat.sample"
281
File "${EASYRSA}\Windows\init-config.bat"
283
File "${EASYRSA}\Windows\README.txt"
284
File "${EASYRSA}\Windows\build-ca.bat"
285
File "${EASYRSA}\Windows\build-dh.bat"
286
File "${EASYRSA}\Windows\build-key-server.bat"
287
File "${EASYRSA}\Windows\build-key.bat"
288
File "${EASYRSA}\Windows\build-key-pkcs12.bat"
289
File "${EASYRSA}\Windows\clean-all.bat"
290
File "${EASYRSA}\Windows\index.txt.start"
291
File "${EASYRSA}\Windows\revoke-full.bat"
292
File "${EASYRSA}\Windows\serial.start"
296
Section "${PRODUCT_NAME} Service" SecService
300
SetOutPath "$INSTDIR\bin"
301
File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe"
303
SetOutPath "$INSTDIR\config"
305
FileOpen $R0 "$INSTDIR\config\README.txt" w
306
FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n"
307
FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
308
FileWrite $R0 "$\r$\n"
309
FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n"
310
FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
313
SetOutPath "$INSTDIR\sample-config"
314
File "${GEN}\samples\sample.${SERV_CONFIG_EXT}"
315
File "${GEN}\samples\client.${SERV_CONFIG_EXT}"
316
File "${GEN}\samples\server.${SERV_CONFIG_EXT}"
318
CreateDirectory "$INSTDIR\log"
319
FileOpen $R0 "$INSTDIR\log\README.txt" w
320
FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n"
321
FileWrite $R0 "sessions which are being run as a service.$\r$\n"
326
Section "${PRODUCT_NAME} File Associations" SecFileAssociation
329
Section "OpenSSL DLLs" SecOpenSSLDLLs
332
SetOutPath "$INSTDIR\bin"
333
File "${BIN}\libeay32.dll"
334
File "${BIN}\ssleay32.dll"
338
Section "OpenSSL Utilities" SecOpenSSLUtilities
341
SetOutPath "$INSTDIR\bin"
342
File "${BIN}\openssl.exe"
346
Section "PKCS#11 DLLs" SecPKCS11DLLs
349
SetOutPath "$INSTDIR\bin"
350
File "${BIN}\libpkcs11-helper-1.dll"
354
Section "LZO2 DLLs" SecLZO2DLLs
357
SetOutPath "$INSTDIR\bin"
358
File "${BIN}\lzo2.dll"
362
Section "Microsoft Visual C 9.0 Runtime DLL" SecMSVCR90DLL
365
SetOutPath "$INSTDIR\bin"
366
File "${BIN}\Microsoft.VC90.CRT\msvcr90.dll"
367
File "${BIN}\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest"
374
Section "TAP Virtual Ethernet Adapter" SecTAP
378
# Generate TAP driver install script dynamically
379
FileOpen $R0 "$INSTDIR\bin\addtap.bat" w
380
FileWrite $R0 "rem Add a new TAP virtual ethernet adapter$\r$\n"
381
FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}$\r$\n'
382
FileWrite $R0 "pause$\r$\n"
385
# Generate TAP driver removal script dynamically
386
FileOpen $R0 "$INSTDIR\bin\deltapall.bat" w
387
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"
388
FileWrite $R0 "pause$\r$\n"
389
FileWrite $R0 '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}$\r$\n'
390
FileWrite $R0 "pause$\r$\n"
393
; Check if we are running on a 64 bit system.
394
System::Call "kernel32::GetCurrentProcess() i .s"
395
System::Call "kernel32::IsWow64Process(i s, *i .r0)"
396
IntCmp $0 0 tap-32bit
400
DetailPrint "We are running on a 64-bit system."
402
SetOutPath "$INSTDIR\bin"
404
File "${GEN}\amd64\tapinstall.exe"
406
SetOutPath "$INSTDIR\driver"
408
File "${GEN}\amd64\OemWin2k.inf"
409
File "${GEN}\amd64\${TAPDRV}"
411
# Don't try to install TAP driver signature if it does not exist.
412
File /nonfatal "${GEN}\amd64\${PRODUCT_TAP_ID}.cat"
418
DetailPrint "We are running on a 32-bit system."
420
SetOutPath "$INSTDIR\bin"
421
File "${GEN}\i386\tapinstall.exe"
423
SetOutPath "$INSTDIR\driver"
424
File "${GEN}\i386\OemWin2k.inf"
425
File "${GEN}\i386\${TAPDRV}"
427
# Don't try to install TAP driver signature if it does not exist.
428
File /nonfatal "${GEN}\i386\${PRODUCT_TAP_ID}.cat"
434
Section "Add ${PRODUCT_NAME} to PATH" SecAddPath
436
; remove previously set path (if any)
440
; append our bin directory to end of current user path
446
Section "Add Shortcuts to Start Menu" SecAddShortcuts
448
; Required to handle shortcuts properly on Vista/7
449
SetShellVarContext all
451
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
452
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Documentation"
453
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
454
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
455
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
456
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\Documentation\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
457
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
461
;--------------------
462
;Post-install section
468
; delete old tapinstall.exe
469
;Delete "$INSTDIR\bin\tapinstall.exe"
471
; Store README, license, icon
474
File "..\INSTALL-win32.txt"
475
File "..\COPYRIGHT.GPL"
476
File "..\images\${PRODUCT_ICON}"
478
; store sample config files
481
SetOutPath "$INSTDIR\config"
483
File "${GEN}\conf\${SAMPCONF_CONF}"
485
!ifdef SAMPCONF_CONF2
486
File "${GEN}\conf\${SAMPCONF_CONF2}"
489
File "${GEN}\conf\${SAMPCONF_P12}"
492
File "${GEN}\conf\${SAMPCONF_TA}"
495
File "${GEN}\conf\${SAMPCONF_CA}"
498
File "${GEN}\conf\${SAMPCONF_CRT}"
501
File "${GEN}\conf\${SAMPCONF_KEY}"
504
File "${GEN}\conf\${SAMPCONF_DH}"
508
; Try to extract files if present
511
Call MultiFileExtract
513
IntCmp $R0 0 +3 +1 +1
514
DetailPrint "MultiFileExtract Failed status=$R0"
516
DetailPrint "MultiFileExtract Succeeded"
520
; install/upgrade TAP driver if selected, using tapinstall.exe
522
SectionGetFlags ${SecTAP} $R0
523
IntOp $R0 $R0 & ${SF_SELECTED}
524
IntCmp $R0 ${SF_SELECTED} "" notap notap
525
; TAP install/update was selected.
526
; Should we install or update?
527
; If tapinstall error occurred, $5 will
530
nsExec::ExecToStack '"$INSTDIR\bin\tapinstall.exe" hwids ${TAP}'
531
Pop $R0 # return value/error/timeout
533
DetailPrint "tapinstall hwids returned: $R0"
535
; If tapinstall output string contains "${TAP}" we assume
536
; that TAP device has been previously installed,
537
; therefore we will update, not install.
542
IntCmp $5 0 "" tapinstall_check_error tapinstall_check_error
543
IntCmp $R0 -1 tapinstall
546
DetailPrint "TAP UPDATE"
547
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" update "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
548
Pop $R0 # return value/error/timeout
551
DetailPrint "tapinstall update returned: $R0"
552
Goto tapinstall_check_error
555
DetailPrint "TAP REMOVE OLD TAP"
557
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove TAP0801'
558
Pop $R0 # return value/error/timeout
559
DetailPrint "tapinstall remove TAP0801 returned: $R0"
561
DetailPrint "TAP INSTALL (${TAP})"
562
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" install "$INSTDIR\driver\OemWin2k.inf" ${TAP}'
563
Pop $R0 # return value/error/timeout
566
DetailPrint "tapinstall install returned: $R0"
568
tapinstall_check_error:
569
DetailPrint "tapinstall cumulative status: $5"
571
MessageBox MB_OK "An error occurred installing the TAP device driver."
575
; Store install folder in registry
576
WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR
578
; install as a service if requested
579
SectionGetFlags ${SecService} $R0
580
IntOp $R0 $R0 & ${SF_SELECTED}
581
IntCmp $R0 ${SF_SELECTED} "" noserv noserv
583
; set registry parameters for openvpnserv
584
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}"
585
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}"
586
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}"
587
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}"
588
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}"
589
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}"
591
; install openvpnserv as a service (to be started manually from service control manager)
592
DetailPrint "Service INSTALL"
593
nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install'
594
Pop $R0 # return value/error/timeout
598
; Create file association if requested
600
SectionGetFlags ${SecFileAssociation} $R0
601
IntOp $R0 $R0 & ${SF_SELECTED}
602
IntCmp $R0 ${SF_SELECTED} "" noass noass
603
WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File"
604
WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File"
605
WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open"
606
WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0"
607
WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"'
608
WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file"
609
WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"'
611
; Create start menu folders
613
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Utilities"
614
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts"
616
; Create start menu and desktop shortcuts to OpenVPN GUI
618
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
619
CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
622
; Create start menu shortcuts to addtap.bat and deltapall.bat
624
IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
625
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Add a new TAP virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
628
IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
629
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Utilities\Delete ALL TAP virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
631
; Create start menu shortcuts for config and log directories
633
IfFileExists "$INSTDIR\config" "" log_shortcut
634
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" ""
637
IfFileExists "$INSTDIR\log" "" samp_shortcut
638
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" ""
641
IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
642
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Shortcuts\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
645
IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts
646
IfFileExists "$INSTDIR\config" "" noshortcuts
647
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
651
WriteUninstaller "$INSTDIR\Uninstall.exe"
653
; Show up in Add/Remove programs
654
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
655
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
656
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
657
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
660
;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)."
664
;--------------------------------
667
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
668
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
670
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI)
672
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
673
!insertmacro MUI_DESCRIPTION_TEXT ${SecTAP} $(DESC_SecTAP)
674
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLUtilities} $(DESC_SecOpenSSLUtilities)
675
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenSSLDLLs} $(DESC_SecOpenSSLDLLs)
676
!insertmacro MUI_DESCRIPTION_TEXT ${SecPKCS11DLLs} $(DESC_SecPKCS11DLLs)
677
!insertmacro MUI_DESCRIPTION_TEXT ${SecLZO2DLLs} $(DESC_SecLZO2DLLs)
678
!insertmacro MUI_DESCRIPTION_TEXT ${SecMSVCR90DLL} $(DESC_SecMSVCR90DLL)
679
!insertmacro MUI_DESCRIPTION_TEXT ${SecAddPath} $(DESC_SecAddPath)
680
!insertmacro MUI_DESCRIPTION_TEXT ${SecAddShortcuts} $(DESC_SecAddShortcuts)
682
!insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
683
!insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssociation} $(DESC_SecFileAssociation)
684
!insertmacro MUI_FUNCTION_DESCRIPTION_END
686
;--------------------------------
694
UserInfo::GetAccountType
696
StrCmp $R1 "Admin" ok
697
Messagebox MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]"
704
; Required to handle shortcuts properly on Vista/7
705
SetShellVarContext all
707
; Stop OpenVPN if currently running
709
DetailPrint "Service REMOVE"
710
nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
711
Pop $R0 # return value/error/timeout
715
DetailPrint "TAP REMOVE"
716
nsExec::ExecToLog '"$INSTDIR\bin\tapinstall.exe" remove ${TAP}'
717
Pop $R0 # return value/error/timeout
718
DetailPrint "tapinstall remove returned: $R0"
721
Call un.RemoveFromPath
723
RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
725
; delete sample config files
728
Delete "$INSTDIR\config\${SAMPCONF_CONF}"
730
!ifdef SAMPCONF_CONF2
731
Delete "$INSTDIR\config\${SAMPCONF_CONF2}"
734
Delete "$INSTDIR\config\${SAMPCONF_P12}"
737
Delete "$INSTDIR\config\${SAMPCONF_TA}"
740
Delete "$INSTDIR\config\${SAMPCONF_CA}"
743
Delete "$INSTDIR\config\${SAMPCONF_CRT}"
746
Delete "$INSTDIR\config\${SAMPCONF_KEY}"
749
Delete "$INSTDIR\config\${SAMPCONF_DH}"
754
Delete "$INSTDIR\bin\${OPENVPN_GUI}"
755
Delete "$DESKTOP\${PRODUCT_NAME} GUI.lnk"
758
# Files installed by openvpn-2.2-beta5 and earlier
759
Delete "$INSTDIR\easy-rsa\openssl.cnf.sample"
760
Delete "$INSTDIR\license"
761
Delete "$INSTDIR\bin\libssl32.dll"
763
Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
764
Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe"
765
Delete "$INSTDIR\bin\libeay32.dll"
766
Delete "$INSTDIR\bin\ssleay32.dll"
767
Delete "$INSTDIR\bin\libpkcs11-helper-1.dll"
768
Delete "$INSTDIR\bin\lzo2.dll"
769
Delete "$INSTDIR\bin\msvcr90.dll"
770
Delete "$INSTDIR\bin\Microsoft.VC90.CRT.manifest"
771
Delete "$INSTDIR\bin\tapinstall.exe"
772
Delete "$INSTDIR\bin\addtap.bat"
773
Delete "$INSTDIR\bin\deltapall.bat"
775
Delete "$INSTDIR\config\README.txt"
776
Delete "$INSTDIR\config\sample.${SERV_CONFIG_EXT}.txt"
778
Delete "$INSTDIR\log\README.txt"
780
Delete "$INSTDIR\driver\OemWin2k.inf"
781
Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat"
782
Delete "$INSTDIR\driver\${TAPDRV}"
784
Delete "$INSTDIR\bin\openssl.exe"
786
Delete "$INSTDIR\INSTALL-win32.txt"
787
Delete "$INSTDIR\${PRODUCT_ICON}"
788
Delete "$INSTDIR\COPYRIGHT.GPL"
789
Delete "$INSTDIR\Uninstall.exe"
791
Delete "$INSTDIR\easy-rsa\openssl.cnf"
792
Delete "$INSTDIR\easy-rsa\vars.bat.sample"
793
Delete "$INSTDIR\easy-rsa\init-config.bat"
794
Delete "$INSTDIR\easy-rsa\README.txt"
795
Delete "$INSTDIR\easy-rsa\build-ca.bat"
796
Delete "$INSTDIR\easy-rsa\build-dh.bat"
797
Delete "$INSTDIR\easy-rsa\build-key-server.bat"
798
Delete "$INSTDIR\easy-rsa\build-key.bat"
799
Delete "$INSTDIR\easy-rsa\build-key-pkcs12.bat"
800
Delete "$INSTDIR\easy-rsa\clean-all.bat"
801
Delete "$INSTDIR\easy-rsa\index.txt.start"
802
Delete "$INSTDIR\easy-rsa\revoke-key.bat"
803
Delete "$INSTDIR\easy-rsa\revoke-full.bat"
804
Delete "$INSTDIR\easy-rsa\serial.start"
806
Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}"
809
RMDir "$INSTDIR\config"
810
RMDir "$INSTDIR\driver"
811
RMDir "$INSTDIR\easy-rsa"
812
RMDir "$INSTDIR\sample-config"
813
RMDir /r "$INSTDIR\log"
816
!insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File"
817
DeleteRegKey HKCR "${PRODUCT_NAME}File"
818
DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME}
819
DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
820
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"