TAP driver now passes signing tests on Vista x64.

Added new settings to settings.in to better control
build process.

Removed some unneeded JYFIXMEs from source code.


git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1874 e7ae566f-a301-0410-adde-c780ea21d3b5
This commit is contained in:
james 2007-04-25 21:37:49 +00:00
parent 8edd43829b
commit 657ecf14ac
36 changed files with 431 additions and 315 deletions

View File

@ -53,7 +53,9 @@ typedef unsigned long in_addr_t;
/*#define DEBUG_LABEL "DEBUG1"*/
/* Should we print debug info from driver? */
/*#define TAP_WIN32_DEBUG*/
#ifdef PRODUCT_TAP_DEBUG
#define TAP_WIN32_DEBUG
#endif
/*
* Minimum TAP-Win32 version number expected by userspace
@ -63,9 +65,6 @@ typedef unsigned long in_addr_t;
#define TAP_WIN32_MIN_MAJOR 9
#define TAP_WIN32_MIN_MINOR 1
/* Allow --askpass and --auth-user-pass passwords to be read from a file */
/* #undef ENABLE_PASSWORD_SAVE */
/* Enable client/server capability */
#define ENABLE_CLIENT_SERVER 1
@ -216,25 +215,25 @@ typedef unsigned long in_addr_t;
#define HAVE_GETPASS 1
/* Name of package */
#define PACKAGE "openvpn"
#define PACKAGE PRODUCT_UNIX_NAME
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "openvpn-users@lists.sourceforge.net"
//#define PACKAGE_BUGREPORT "openvpn-users@lists.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "OpenVPN"
#define PACKAGE_NAME PRODUCT_NAME
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "openvpn"
#define PACKAGE_TARNAME PACKAGE
/* Define to the version of this package. */
#define PACKAGE_VERSION PRODUCT_VERSION
/* Define to the full name and version of this package. */
#ifdef DEBUG_LABEL
#define PACKAGE_STRING "OpenVPN " PACKAGE_VERSION " " DEBUG_LABEL
#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION " " DEBUG_LABEL
#else
#define PACKAGE_STRING "OpenVPN " PACKAGE_VERSION
#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
#endif
/* Define as the return type of signal handlers (`int' or `void'). */

View File

@ -1,14 +1,34 @@
#!/bin/sh
# This is the master OpenVPN build script for Windows.
# See top-devel definitions in install-win32/version.nsi
# This script will build OpenVPN, the TAP driver, and
# the installer from source.
#
# See top-devel build configuration in install-win32/version.nsi
#
# Prerequisite installs:
#
# MinGW -- for GNU C compiler
# MSYS -- for bash
# msysDTK -- for perl
# NSIS -- for building installer
# svn -- for checking out source code (or TortoiseSVN)
# Windows Driver Kit Vista RC1 (5600) -- for building TAP driver + tapinstall
#
# Required source code not included in OpenVPN SVN repository
# because of MS licensing restrictions:
#
# ../tapinstall -- This is based on 'devcon' which is found in the
# Windows Driver Kit (formerly known as DDK).
# Copy the 'devcon' source tree to ../tapinstall
# Edit 'sources' and modify TARGETNAME=tapinstall
#
# ../svc-template -- This directory should contain service.[ch]
# from the MS Platform SDK.
#
# Example usage:
#
# make without signing:
# SIGNCODE="null" ./domake-win
#
# write installer to desktop
# build everything, then write installer to desktop
# INSTALLER_DEST="/c/Documents and Settings/James/Desktop" ./domake-win
install-win32/winconfig
@ -17,6 +37,7 @@ install-win32/maketapinstall
install-win32/maketap
install-win32/signtap
install-win32/makebin
install-win32/getgui
install-win32/buildinstaller
install-win32/signinstaller
install-win32/copyinstaller

View File

@ -163,7 +163,6 @@
#define D_REGISTRY LOGLEV(11, 70, M_DEBUG) /* win32 registry debugging info */
#define D_OPENSSL_LOCK LOGLEV(11, 70, M_DEBUG) /* show OpenSSL locks */
#define D_THREAD_DEBUG LOGLEV(4, 70, M_DEBUG) /* JYFIXME -- show pthread debug information */
/*#define D_THREAD_DEBUG LOGLEV(4, 70, M_DEBUG)*/ /* show pthread debug information */
#endif

View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View File

@ -3,4 +3,6 @@
# build the installer
cd install-win32
'/c/Program Files/NSIS/makensis' openvpn.nsi
rm -f *.exe
'/c/Program Files/NSIS/makensis' openvpn.nsi &>makensis.log
tail -20 makensis.log

View File

@ -1,4 +1,7 @@
($unixname) = @ARGV;
$unixname =~ s#^/c##g;
$unixname =~ s#/#\\#g;
print "$unixname\n";
#!/usr/bin/perl
while ($unixname = shift(@ARGV)) {
$unixname =~ s#^/([a-zA-Z])(/|$)#$1:\\#g;
$unixname =~ s#/#\\#g;
print "$unixname\n";
}

21
install-win32/getgui Normal file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# Get and sign the OpenVPN GUI
c=`pwd`
# load version.nsi definitions
. autodefs/defs.sh
GUI="$OPENVPN_GUI_DIR/$OPENVPN_GUI"
if [ -e "$GUI" ]; then
cp $GUI bin
echo '!define OPENVPN_GUI_DEFINED' >autodefs/guidefs.nsi
if [ -d "$SIGNTOOL" ]; then
export TARGET_EXE="bin/$OPENVPN_GUI"
$SIGNTOOL/signexe
fi
else
cat /dev/null >autodefs/guidefs.nsi
fi

53
install-win32/ifdef.pl Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/perl
# Simple ifdef/else/endif processor.
die "usage: ifdef [-C<command-prefix>] [-Dname ...] [control-file ...] " if (@ARGV[0] =~ /^(-h|--help)$/);
%Parms = ();
$pre = "!";
while ($arg=shift(@ARGV)) {
if ($arg =~ /^-/) {
if ($arg =~ /^-D(\w+)$/) {
$Parms{$1} = 1;
} elsif ($arg =~ /-C(.*)$/) {
$pre = $1;
} else {
die "unrecognized option: $arg";
}
} else {
open(CONTROL, "< $arg") or die "cannot open $arg";
while (<CONTROL>) {
if (/^!define\s+(\w+)/) {
$Parms{$1} = 1;
}
}
}
}
sub ifdef {
my ($var, $enabled) = @_;
my $def = 0;
$def = 1 if (defined $Parms{$var}) || ($var eq "true");
$def = 0 if $var eq "false";
while (<STDIN>) {
if (/^\s*\Q$pre\Eifdef\s+(\w+)\s*$/) {
return 1 if ifdef ($1, $def & $enabled);
} elsif (/^\s*\Q$pre\Eelseif\s+(\w+)\s*$/) {
$def = $def ^ 1;
return ifdef ($1, $def & $enabled);
} elsif (/^\s*\Q$pre\Eelse\s*$/) {
$def = $def ^ 1;
} elsif (/^\s*\Q$pre\Eendif\s*$/) {
return 0;
} elsif (/^\s*\Q$pre\E/) {
die "unrecognized command: $_";
} else {
print if $def && $enabled;
}
}
return 1;
}
ifdef("true", 1);

View File

@ -8,7 +8,7 @@ while (<STDIN>) {
if (/^\s*$/) {
print "\n";
} elsif (/^define\((\w+),\[(.*?)\]\)/) {
print "define $1 \"$2\"\n";
print "!define $1 \"$2\"\n";
} elsif (/^dnl(.*)$/) {
print "#$1\n";
}

View File

@ -15,38 +15,47 @@ $open_quote = "@@";
$close_quote = "@@";
while ($arg=shift(@ARGV)) {
if ($arg =~ /^-/) {
if ($arg =~ /^-D(\w+)=(.*)$/) {
$Parms{$1} = $2
} elsif ($arg =~ /-O(.*)$/) {
$open_quote = $1;
} elsif ($arg =~ /-C(.*)$/) {
$close_quote = $1;
} else {
die "unrecognized option: $arg";
}
if ($arg =~ /^-/) {
if ($arg =~ /^-D(\w+)(?:=(.*))?$/) {
$Parms{$1} = $2
} elsif ($arg =~ /-O(.*)$/) {
$open_quote = $1;
} elsif ($arg =~ /-C(.*)$/) {
$close_quote = $1;
} else {
open(CONTROL, "< $arg") or die "cannot open $arg";
while (<CONTROL>) {
chomp;
if (/^define\s+(\w+)\s+['"]?(.+?)['"]?\s*$/) {
$Parms{$1} = $2
}
}
die "unrecognized option: $arg";
}
} else {
open(CONTROL, "< $arg") or die "cannot open $arg";
while (<CONTROL>) {
if (/^!define\s+(\w+)(?:\s+['"]?(.*?)['"]?)?\s*$/) {
$Parms{$1} = $2;
}
}
}
}
sub print_symbol_table {
foreach my $k (sort (keys(%Parms))) {
my $v = $Parms{$k};
print "[$k] -> \"$v\"\n";
}
}
#print_symbol_table ();
#exit 0;
while (<STDIN>) {
s{
\Q$open_quote\E
\s*
(
\w+
)
\w+
)
\s*
\Q$close_quote\E
}{
$Parms{$1}
}xge;
}xge;
print;
}

View File

@ -9,12 +9,12 @@ rm -rf bin
mkdir bin
# Get OpenVPN executable
cp openvpn.exe bin
strip bin/openvpn.exe
cp $PRODUCT_UNIX_NAME.exe bin
strip bin/$PRODUCT_UNIX_NAME.exe
# Get OpenVPN service
cp service-win32/openvpnserv.exe bin
strip bin/openvpnserv.exe
cp service-win32/${PRODUCT_UNIX_NAME}serv.exe bin
strip bin/${PRODUCT_UNIX_NAME}serv.exe
# Get OpenSSL binaries
for f in libeay32.dll libssl32.dll openssl.exe ; do

View File

@ -6,25 +6,52 @@
# get version.nsi definitions
. autodefs/defs.sh
amdtarget=""
if [ -z "$TAP_BIN_AMD64" ]; then
if [ -n "$PRODUCT_TAP_DEBUG" ] ; then
w2ktarget="w2k c"
amdtarget="chk AMD64 WNET"
else
w2ktarget="w2k f"
amdtarget="fre AMD64 WNET"
fi
if [ -z "$DRVBINSRC" ] ; then
if [ -n "$TAP_BIN_AMD64" ]; then
amdtarget=""
fi
cd tap-win32
t=`pwd`
cd ..
for mode in "w2k f" "$amdtarget"; do
for mode in "$w2ktarget" "$amdtarget"; do
echo '**********' build TAP $mode
cmd //c "C:\\WINDDK\\$DDKVER\\bin\\setenv.bat C:\\WINDDK\\$DDKVER $mode && cd `perl install-win32/dosname.pl $t` && build -cef"
done
fi
if [ -n "$TAP_BIN_AMD64" ]; then
mkdir -p $t/amd64
cp "$TAP_BIN_AMD64" $t/amd64
fi
title openvpn-build &>/dev/null
title openvpn-build &>/dev/null
if [ -n "$TAP_BIN_AMD64" ]; then
mkdir -p $t/amd64
cp "$TAP_BIN_AMD64" $t/amd64
fi
# copy driver files into tap-win32/dist
cd tap-win32
rm -rf dist
mkdir dist
cd dist
mkdir i386
mkdir amd64
cd i386
x86=`pwd`
cd ../amd64
x64=`pwd`
cd ../..
cp i386/OemWin2k.inf $x86
cp i386/*.sys $x86
cp amd64/OemWin2k.inf $x64
cp amd64/*.sys $x64
out="TAP driver catalog file is undefined";
echo "$out" >$x86/$PRODUCT_TAP_ID.cat
echo "$out" >$x64/$PRODUCT_TAP_ID.cat
fi

View File

@ -10,16 +10,22 @@
!define HOME ".."
!include "${HOME}\autodefs\defs.nsi"
!include "${HOME}\autodefs\guidefs.nsi"
!include "MUI.nsh"
!include "setpath.nsi"
!include "GetWindowsVersion.nsi"
!define BIN "${HOME}\bin"
!define PRODUCT_NAME "OpenVPN"
!define VERSION "${PRODUCT_VERSION}"
!define PRODUCT_ICON "icon.ico"
!define TAP "tap0901"
!ifdef PRODUCT_TAP_DEBUG
!define VERSION "${PRODUCT_VERSION}-DBG"
!else
!define VERSION "${PRODUCT_VERSION}"
!endif
!define TAP "${PRODUCT_TAP_ID}"
!define TAPDRV "${TAP}.sys"
; something like "-DBG2"
@ -30,8 +36,8 @@
; Default service settings
!define SERV_CONFIG_DIR "$INSTDIR\config"
!define SERV_CONFIG_EXT "ovpn"
!define SERV_EXE_PATH "$INSTDIR\bin\openvpn.exe"
!define SERV_CONFIG_EXT "${PRODUCT_FILE_EXT}"
!define SERV_EXE_PATH "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
!define SERV_LOG_DIR "$INSTDIR\log"
!define SERV_PRIORITY "NORMAL_PRIORITY_CLASS"
!define SERV_LOG_APPEND "0"
@ -41,7 +47,7 @@
;General
OutFile "openvpn-${VERSION}${OUTFILE_LABEL}-install.exe"
OutFile "${PRODUCT_UNIX_NAME}-${VERSION}${OUTFILE_LABEL}-install.exe"
SetCompressor bzip2
@ -59,17 +65,17 @@
Name "${PRODUCT_NAME} ${VERSION} ${TITLE_LABEL}"
!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"
!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"
!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."
!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."
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\INSTALL-win32.txt"
!define MUI_FINISHPAGE_NOAUTOCLOSE
# !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_ABORTWARNING
!define MUI_ICON "${HOME}\images\openvpn.ico"
!define MUI_UNICON "${HOME}\images\openvpn.ico"
!define MUI_ICON "${HOME}\images\${PRODUCT_ICON}"
!define MUI_UNICON "${HOME}\images\${PRODUCT_ICON}"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${HOME}\images\install-whirl.bmp"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
@ -94,27 +100,27 @@
;--------------------------------
;Language Strings
LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install OpenVPN user-space components, including openvpn.exe."
LangString DESC_SecOpenVPNUserSpace ${LANG_ENGLISH} "Install ${PRODUCT_NAME} user-space components, including ${PRODUCT_UNIX_NAME}.exe."
!ifdef OPENVPN_GUI
LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install OpenVPN GUI by Mathias Sundman"
!ifdef OPENVPN_GUI_DEFINED
LangString DESC_SecOpenVPNGUI ${LANG_ENGLISH} "Install ${PRODUCT_NAME} GUI by Mathias Sundman"
!endif
LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install OpenVPN RSA scripts for X509 certificate management."
LangString DESC_SecOpenVPNEasyRSA ${LANG_ENGLISH} "Install ${PRODUCT_NAME} RSA scripts for X509 certificate management."
LangString DESC_SecOpenSSLDLLs ${LANG_ENGLISH} "Install OpenSSL DLLs locally (may be omitted if DLLs are already installed globally)."
LangString DESC_SecTAP ${LANG_ENGLISH} "Install/Upgrade the TAP-Win32 virtual device driver. Will not interfere with CIPE."
LangString DESC_SecService ${LANG_ENGLISH} "Install the OpenVPN service wrapper (openvpnserv.exe)"
LangString DESC_SecService ${LANG_ENGLISH} "Install the ${PRODUCT_NAME} service wrapper (${PRODUCT_UNIX_NAME}serv.exe)"
LangString DESC_SecOpenSSLUtilities ${LANG_ENGLISH} "Install the OpenSSL Utilities (used for generating public/private key pairs)."
LangString DESC_SecAddPath ${LANG_ENGLISH} "Add OpenVPN executable directory to the current user's PATH."
LangString DESC_SecAddPath ${LANG_ENGLISH} "Add ${PRODUCT_NAME} executable directory to the current user's PATH."
LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add OpenVPN shortcuts to the current user's Start Menu."
LangString DESC_SecAddShortcuts ${LANG_ENGLISH} "Add ${PRODUCT_NAME} shortcuts to the current user's Start Menu."
LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register OpenVPN config file association (*.${SERV_CONFIG_EXT})"
LangString DESC_SecFileAssociation ${LANG_ENGLISH} "Register ${PRODUCT_NAME} config file association (*.${SERV_CONFIG_EXT})"
;--------------------------------
;Reserve Files
@ -183,7 +189,7 @@ Function .onInit
UserInfo::GetAccountType
Pop $R1
StrCmp $R1 "Admin" ok
Messagebox MB_OK "Administrator privileges required to install OpenVPN [$R0/$R1]"
Messagebox MB_OK "Administrator privileges required to install ${PRODUCT_NAME} [$R0/$R1]"
Abort
ok:
@ -194,7 +200,7 @@ Function .onInit
StrCmp $1 "2003" goodwinver
StrCmp $1 "VISTA" goodwinver
Messagebox MB_OK "Sorry, OpenVPN does not currently support Windows $1"
Messagebox MB_OK "Sorry, ${PRODUCT_NAME} does not currently support Windows $1"
Abort
goodwinver:
@ -205,12 +211,12 @@ goodwinver:
; we are running on 64-bit windows
StrCmp $1 "VISTA" vista64bummer
# Messagebox MB_OK "Sorry, OpenVPN doesn't currently support 64-bit Windows."
# Messagebox MB_OK "Sorry, ${PRODUCT_NAME} doesn't currently support 64-bit Windows."
# Abort
vista64bummer:
# Messagebox MB_OK "Sorry, OpenVPN doesn't currently support 64-bit Vista because Microsoft doesn't allow the installation of 64 bit unsigned drivers."
# 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."
# Abort
init32bits:
@ -219,32 +225,32 @@ FunctionEnd
!define SF_SELECTED 1
Section "OpenVPN User-Space Components" SecOpenVPNUserSpace
Section "${PRODUCT_NAME} User-Space Components" SecOpenVPNUserSpace
SetOverwrite on
SetOutPath "$INSTDIR\bin"
File "${BIN}\openvpn.exe"
File "${BIN}\${PRODUCT_UNIX_NAME}.exe"
SectionEnd
!ifdef OPENVPN_GUI
Section "OpenVPN GUI" SecOpenVPNGUI
!ifdef OPENVPN_GUI_DEFINED
Section "${PRODUCT_NAME} GUI" SecOpenVPNGUI
SetOverwrite on
SetOutPath "$INSTDIR\bin"
File "${HOME}\${OPENVPN_GUI_DIR}\${OPENVPN_GUI}"
File "${BIN}\${OPENVPN_GUI}"
SectionEnd
!endif
Section "OpenVPN RSA Certificate Management Scripts" SecOpenVPNEasyRSA
Section "${PRODUCT_NAME} RSA Certificate Management Scripts" SecOpenVPNEasyRSA
SetOverwrite on
SetOutPath "$INSTDIR\easy-rsa"
File "${HOME}\install-win32\openssl.cnf.sample"
File "${HOME}\samples\openssl.cnf.sample"
File "${HOME}\easy-rsa\Windows\vars.bat.sample"
File "${HOME}\easy-rsa\Windows\init-config.bat"
@ -262,37 +268,37 @@ Section "OpenVPN RSA Certificate Management Scripts" SecOpenVPNEasyRSA
SectionEnd
Section "OpenVPN Service" SecService
Section "${PRODUCT_NAME} Service" SecService
SetOverwrite on
SetOutPath "$INSTDIR\bin"
File "${BIN}\openvpnserv.exe"
File "${BIN}\${PRODUCT_UNIX_NAME}serv.exe"
SetOutPath "$INSTDIR\config"
FileOpen $R0 "$INSTDIR\config\README.txt" w
FileWrite $R0 "This directory should contain OpenVPN configuration files$\r$\n"
FileWrite $R0 "This directory should contain ${PRODUCT_NAME} configuration files$\r$\n"
FileWrite $R0 "each having an extension of .${SERV_CONFIG_EXT}$\r$\n"
FileWrite $R0 "$\r$\n"
FileWrite $R0 "When OpenVPN is started as a service, a separate OpenVPN$\r$\n"
FileWrite $R0 "When ${PRODUCT_NAME} is started as a service, a separate ${PRODUCT_NAME}$\r$\n"
FileWrite $R0 "process will be instantiated for each configuration file.$\r$\n"
FileClose $R0
SetOutPath "$INSTDIR\sample-config"
File "${HOME}\install-win32\sample.${SERV_CONFIG_EXT}"
File "${HOME}\install-win32\client.${SERV_CONFIG_EXT}"
File "${HOME}\install-win32\server.${SERV_CONFIG_EXT}"
File "${HOME}\samples\sample.${SERV_CONFIG_EXT}"
File "${HOME}\samples\client.${SERV_CONFIG_EXT}"
File "${HOME}\samples\server.${SERV_CONFIG_EXT}"
CreateDirectory "$INSTDIR\log"
FileOpen $R0 "$INSTDIR\log\README.txt" w
FileWrite $R0 "This directory will contain the log files for OpenVPN$\r$\n"
FileWrite $R0 "This directory will contain the log files for ${PRODUCT_NAME}$\r$\n"
FileWrite $R0 "sessions which are being run as a service.$\r$\n"
FileClose $R0
SectionEnd
Section "OpenVPN File Associations" SecFileAssociation
Section "${PRODUCT_NAME} File Associations" SecFileAssociation
SectionEnd
Section "OpenSSL DLLs" SecOpenSSLDLLs
@ -345,6 +351,7 @@ Section "TAP-Win32 Virtual Ethernet Adapter" SecTAP
SetOutPath "$INSTDIR\driver"
File "${BIN}\driver\amd64\OemWin2k.inf"
File "${BIN}\driver\amd64\${PRODUCT_TAP_ID}.cat"
File "${BIN}\driver\amd64\${TAPDRV}"
goto tapend
@ -358,14 +365,14 @@ tap-32bit:
SetOutPath "$INSTDIR\driver"
File "${BIN}\driver\i386\OemWin2k.inf"
File "${BIN}\driver\i386\tap.cat"
File "${BIN}\driver\i386\${PRODUCT_TAP_ID}.cat"
File "${BIN}\driver\i386\${TAPDRV}"
tapend:
SectionEnd
Section "Add OpenVPN to PATH" SecAddPath
Section "Add ${PRODUCT_NAME} to PATH" SecAddPath
; remove previously set path (if any)
Push "$INSTDIR\bin"
@ -380,12 +387,12 @@ SectionEnd
Section "Add Shortcuts to Start Menu" SecAddShortcuts
SetOverwrite on
CreateDirectory "$SMPROGRAMS\OpenVPN"
WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
WriteINIStr "$SMPROGRAMS\OpenVPN\OpenVPN Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
CreateShortCut "$SMPROGRAMS\OpenVPN\Uninstall OpenVPN.lnk" "$INSTDIR\Uninstall.exe"
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Windows Notes.url" "InternetShortcut" "URL" "http://openvpn.net/INSTALL-win32.html"
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Manual Page.url" "InternetShortcut" "URL" "http://openvpn.net/man.html"
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} HOWTO.url" "InternetShortcut" "URL" "http://openvpn.net/howto.html"
WriteINIStr "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Web Site.url" "InternetShortcut" "URL" "http://openvpn.net/"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
SectionEnd
@ -454,7 +461,7 @@ Section -post
notap:
; Store install folder in registry
WriteRegStr HKLM SOFTWARE\OpenVPN "" $INSTDIR
WriteRegStr HKLM SOFTWARE\${PRODUCT_NAME} "" $INSTDIR
; install as a service if requested
SectionGetFlags ${SecService} $R0
@ -462,19 +469,19 @@ Section -post
IntCmp $R0 ${SF_SELECTED} "" noserv noserv
; set registry parameters for openvpnserv
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "config_dir" "${SERV_CONFIG_DIR}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "config_ext" "${SERV_CONFIG_EXT}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "exe_path" "${SERV_EXE_PATH}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "log_dir" "${SERV_LOG_DIR}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "priority" "${SERV_PRIORITY}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\OpenVPN" "log_append" "${SERV_LOG_APPEND}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_dir" "${SERV_CONFIG_DIR}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "config_ext" "${SERV_CONFIG_EXT}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "exe_path" "${SERV_EXE_PATH}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_dir" "${SERV_LOG_DIR}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "priority" "${SERV_PRIORITY}"
!insertmacro WriteRegStringIfUndef HKLM "SOFTWARE\${PRODUCT_NAME}" "log_append" "${SERV_LOG_APPEND}"
; install openvpnserv as a service
DetailPrint "Previous Service REMOVE (if exists)"
nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -remove'
nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
Pop $R0 # return value/error/timeout
DetailPrint "Service INSTALL"
nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -install'
nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -install'
Pop $R0 # return value/error/timeout
noserv:
@ -483,54 +490,54 @@ Section -post
SetOutPath $INSTDIR
File "${HOME}\install-win32\INSTALL-win32.txt"
File "${HOME}\install-win32\license.txt"
File "${HOME}\images\openvpn.ico"
File "${HOME}\images\${PRODUCT_ICON}"
; Create file association if requested
SectionGetFlags ${SecFileAssociation} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} "" noass noass
!insertmacro WriteRegStringIfUndef HKCR ".${SERV_CONFIG_EXT}" "" "OpenVPNFile"
!insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile" "" "OpenVPN Config File"
!insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell" "" "open"
!insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\DefaultIcon" "" "$INSTDIR\openvpn.ico,0"
!insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\open\command" "" 'notepad.exe "%1"'
!insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\run" "" "Start OpenVPN on this config file"
!insertmacro WriteRegStringIfUndef HKCR "OpenVPNFile\shell\run\command" "" '"$INSTDIR\bin\openvpn.exe" --pause-exit --config "%1"'
WriteRegStr HKCR ".${SERV_CONFIG_EXT}" "" "${PRODUCT_NAME}File"
WriteRegStr HKCR "${PRODUCT_NAME}File" "" "${PRODUCT_NAME} Config File"
WriteRegStr HKCR "${PRODUCT_NAME}File\shell" "" "open"
WriteRegStr HKCR "${PRODUCT_NAME}File\DefaultIcon" "" "$INSTDIR\${PRODUCT_ICON},0"
WriteRegStr HKCR "${PRODUCT_NAME}File\shell\open\command" "" 'notepad.exe "%1"'
WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run" "" "Start ${PRODUCT_NAME} on this config file"
WriteRegStr HKCR "${PRODUCT_NAME}File\shell\run\command" "" '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" --pause-exit --config "%1"'
; Create start menu and desktop shortcuts to OpenVPN GUI
noass:
!ifdef OPENVPN_GUI
!ifdef OPENVPN_GUI_DEFINED
IfFileExists "$INSTDIR\bin\${OPENVPN_GUI}" "" tryaddtap
CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
CreateShortcut "$DESKTOP\OpenVPN GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}" ""
CreateShortcut "$DESKTOP\${PRODUCT_NAME} GUI.lnk" "$INSTDIR\bin\${OPENVPN_GUI}"
!endif
; Create start menu shortcuts to addtap.bat and deltapall.bat
tryaddtap:
IfFileExists "$INSTDIR\bin\addtap.bat" "" trydeltap
CreateShortCut "$SMPROGRAMS\OpenVPN\Add a new TAP-Win32 virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Add a new TAP-Win32 virtual ethernet adapter.lnk" "$INSTDIR\bin\addtap.bat" ""
trydeltap:
IfFileExists "$INSTDIR\bin\deltapall.bat" "" config_shortcut
CreateShortCut "$SMPROGRAMS\OpenVPN\Delete ALL TAP-Win32 virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Delete ALL TAP-Win32 virtual ethernet adapters.lnk" "$INSTDIR\bin\deltapall.bat" ""
; Create start menu shortcuts for config and log directories
config_shortcut:
IfFileExists "$INSTDIR\config" "" log_shortcut
CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN configuration file directory.lnk" "$INSTDIR\config" ""
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} configuration file directory.lnk" "$INSTDIR\config" ""
log_shortcut:
IfFileExists "$INSTDIR\log" "" samp_shortcut
CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN log file directory.lnk" "$INSTDIR\log" ""
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} log file directory.lnk" "$INSTDIR\log" ""
samp_shortcut:
IfFileExists "$INSTDIR\sample-config" "" genkey_shortcut
CreateShortCut "$SMPROGRAMS\OpenVPN\OpenVPN Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Sample Configuration Files.lnk" "$INSTDIR\sample-config" ""
genkey_shortcut:
IfFileExists "$INSTDIR\bin\openvpn.exe" "" noshortcuts
IfFileExists "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe" "" noshortcuts
IfFileExists "$INSTDIR\config" "" noshortcuts
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
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\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
noshortcuts:
; Create uninstaller
@ -539,7 +546,7 @@ Section -post
; Show up in Add/Remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} ${VERSION}"
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\openvpn.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
; Advise a reboot
@ -552,7 +559,7 @@ SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNUserSpace} $(DESC_SecOpenVPNUserSpace)
!ifdef OPENVPN_GUI
!ifdef OPENVPN_GUI_DEFINED
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNGUI} $(DESC_SecOpenVPNGUI)
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenVPNEasyRSA} $(DESC_SecOpenVPNEasyRSA)
@ -576,7 +583,7 @@ Function un.onInit
UserInfo::GetAccountType
Pop $R1
StrCmp $R1 "Admin" ok
Messagebox MB_OK "Administrator privileges required to uninstall OpenVPN [$R0/$R1]"
Messagebox MB_OK "Administrator privileges required to uninstall ${PRODUCT_NAME} [$R0/$R1]"
Abort
ok:
FunctionEnd
@ -584,7 +591,7 @@ FunctionEnd
Section "Uninstall"
DetailPrint "Service REMOVE"
nsExec::ExecToLog '"$INSTDIR\bin\openvpnserv.exe" -remove'
nsExec::ExecToLog '"$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe" -remove'
Pop $R0 # return value/error/timeout
Sleep 2000
@ -597,13 +604,13 @@ Section "Uninstall"
Push "$INSTDIR\bin"
Call un.RemoveFromPath
RMDir /r $SMPROGRAMS\OpenVPN
RMDir /r $SMPROGRAMS\${PRODUCT_NAME}
Delete "$INSTDIR\bin\openvpn.exe"
!ifdef OPENVPN_GUI
Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}.exe"
!ifdef OPENVPN_GUI_DEFINED
Delete "$INSTDIR\bin\${OPENVPN_GUI}"
!endif
Delete "$INSTDIR\bin\openvpnserv.exe"
Delete "$INSTDIR\bin\${PRODUCT_UNIX_NAME}serv.exe"
Delete "$INSTDIR\bin\libeay32.dll"
Delete "$INSTDIR\bin\libssl32.dll"
Delete "$INSTDIR\bin\tapinstall.exe"
@ -616,13 +623,13 @@ Section "Uninstall"
Delete "$INSTDIR\log\README.txt"
Delete "$INSTDIR\driver\OemWin2k.inf"
Delete "$INSTDIR\driver\tap.cat"
Delete "$INSTDIR\driver\${PRODUCT_TAP_ID}.cat"
Delete "$INSTDIR\driver\${TAPDRV}"
Delete "$INSTDIR\bin\openssl.exe"
Delete "$INSTDIR\INSTALL-win32.txt"
Delete "$INSTDIR\openvpn.ico"
Delete "$INSTDIR\${PRODUCT_ICON}"
Delete "$INSTDIR\license.txt"
Delete "$INSTDIR\Uninstall.exe"
@ -641,7 +648,7 @@ Section "Uninstall"
Delete "$INSTDIR\easy-rsa\revoke-full.bat"
Delete "$INSTDIR\easy-rsa\serial.start"
Delete "$INSTDIR\sample-config\*.ovpn"
Delete "$INSTDIR\sample-config\*.${PRODUCT_FILE_EXT}"
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR\driver"
@ -649,12 +656,12 @@ Section "Uninstall"
RMDir "$INSTDIR\sample-config"
RMDir "$INSTDIR"
!insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "OpenVPNFile"
DeleteRegKey HKCR "OpenVPNFile"
DeleteRegKey HKLM SOFTWARE\OpenVPN
!insertmacro DelRegKeyIfUnchanged HKCR ".${SERV_CONFIG_EXT}" "${PRODUCT_NAME}File"
DeleteRegKey HKCR "${PRODUCT_NAME}File"
DeleteRegKey HKLM SOFTWARE\${PRODUCT_NAME}
DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenVPN"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
;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)."
;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)."
SectionEnd

View File

@ -2,58 +2,70 @@
# for Windows OpenVPN installer.
# Get the OpenVPN version number
include "autodefs/version.in"
!include "autodefs/version.in"
# Branding
!define PRODUCT_NAME "OpenVPN"
!define PRODUCT_UNIX_NAME "openvpn"
!define PRODUCT_FILE_EXT "ovpn"
# Allow --askpass and --auth-user-pass passwords to be read from a file
;!define ENABLE_PASSWORD_SAVE
# Include the OpenVPN GUI exe in the installer.
# May be undefined.
define OPENVPN_GUI_DIR "../openvpn-gui"
define OPENVPN_GUI "openvpn-gui-1.0.3.exe"
!define OPENVPN_GUI_DIR "../openvpn-gui"
!define OPENVPN_GUI "openvpn-gui-1.0.3.exe"
# Prebuilt libraries. DMALLOC is optional.
define OPENSSL_DIR "../openssl-0.9.7l"
define LZO_DIR "../lzo-2.02"
define DMALLOC_DIR "../dmalloc-5.4.2"
!define OPENSSL_DIR "../openssl-0.9.7l"
!define LZO_DIR "../lzo-2.02"
!define DMALLOC_DIR "../dmalloc-5.4.2"
# Write TAP driver and tapinstall.exe to this directory,
# to use as prebuilt binaries for future builds. May
# be undefined.
;define DRVBINDEST "../tapbin"
;!define DRVBINDEST "../tapbin"
# Don't build TAP driver and tapinstall.exe -- instead get
# them as prebuilt binaries from this directory. May be
# undefined.
;define DRVBINSRC "../tapbin"
;!define DRVBINSRC "../tapbin"
# tapinstall.exe source code.
# Not needed if DRVBINSRC is defined.
define TISRC "../tapinstall"
!define TISRC "../tapinstall"
# TAP Adapter parameters.
define PRODUCT_TAP_MAJOR_VER 9
define PRODUCT_TAP_MINOR_VER 3
define PRODUCT_TAP_RELDATE "04/18/2007"
!define PRODUCT_TAP_DEVICE_DESCRIPTION "TAP-Win32 Adapter V9"
!define PRODUCT_TAP_PROVIDER "TAP-Win32 Provider V9"
!define PRODUCT_TAP_ID "tap0901"
!define PRODUCT_TAP_MAJOR_VER 9
!define PRODUCT_TAP_MINOR_VER 3
!define PRODUCT_TAP_RELDATE "04/18/2007"
; visible=0x81 hidden=0x89
!define PRODUCT_TAP_CHARACTERISTICS 0x81
# Build debugging version of TAP driver
;!define PRODUCT_TAP_DEBUG
# Service template files service.[ch] (get from Platform SDK).
# If undefined, don't build openvpnserv.exe
define SVC_TEMPLATE "../svc-template"
!define SVC_TEMPLATE "../svc-template"
# DDK Version.
# DDK distribution is assumed to be in C:\WINDDK\${DDKVER}
# Not needed if DRVBINSRC is defined.
define DDKVER 5600
!define DDKVER 5600
# Code Signing.
# This directory should contain signcode.exe + key files.
# If undefined, don't sign any files.
define SIGNCODE "../sign"
# INF2CAT should point to the MS inf2cat distribution.
# inf2cat is used for driver signing.
# If undefined, don't sign any files.
define INF2CAT "../inf2cat"
!define SIGNTOOL "../signtool"
!define PRODUCT_SIGN_CN "openvpn"
# -j parameter passed to make
define MAKE_JOBS 2
!define MAKE_JOBS 2
# do a make clean before make
define MAKE_CLEAN "yes"
!define MAKE_CLEAN "yes"

View File

@ -1,22 +1,16 @@
#!/bin/sh
# Sign the installer
# SIGNCODE should point to directory with signcode.exe and keys
# Sign the installer.
c=`pwd`
# load version.nsi definitions
. autodefs/defs.sh
if [ -n "$SIGNCODE" ] ; then
if [ -d "$SIGNTOOL" ]; then
cd install-win32
ls openvpn*.exe 2>/dev/null || exit 1
exe=`pwd`/`ls -t openvpn*.exe | head -n 1`
ls *.exe 2>/dev/null || exit 1
export TARGET_EXE=$(pwd)/$(ls -t *.exe | head -n 1)
cd $c
cd "$SIGNCODE"
TS="http://timestamp.verisign.com/scripts/timstamp.dll"
echo '******************' SIGNCODE OpenVPN INSTALLER
./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN Installer" -t $TS `perl $c/install-win32/dosname.pl $exe`
$SIGNTOOL/signexe
fi

View File

@ -1,54 +1,10 @@
#!/bin/sh
# Sign the x86 and x64 versions of the TAP driver
# SIGNCODE should point to directory with signcode.exe and keys
# INF2CAT should point to the MS inf2cat distribution
c=`pwd`
# Sign the TAP driver.
# load version.nsi definitions
. autodefs/defs.sh
if [ -z "$DRVBINSRC" ] ; then
# copy driver files into tap-win32/dist
cd tap-win32
rm -rf dist
mkdir dist
cd dist
mkdir i386
mkdir amd64
cd i386
x86=`pwd`
cd ../amd64
x64=`pwd`
cd ../..
cp i386/OemWin2k.inf $x86
cp i386/*.sys $x86
cp amd64/OemWin2k.inf $x64
cp amd64/*.sys $x64
cd $c
if [ -n "$SIGNCODE" ] && [ -n "$INF2CAT" ] ; then
cd "$INF2CAT"
echo '******************' BUILD .cat FILE for x86
cmd //c "inf2cat /driver:`perl $c/install-win32/dosname.pl $x86` /os:2000,XP_X86,Server2003_X86,Vista_X86"
echo '******************' BUILD .cat FILE for x64
cmd //c "inf2cat /driver:`perl $c/install-win32/dosname.pl $x64` /os:XP_X64,Server2003_X64,Vista_X64"
cd $c
cd "$SIGNCODE"
TS="http://timestamp.verisign.com/scripts/timstamp.dll"
echo '******************' SIGNCODE .cat FILE for x86
./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN TAP-Win32 Driver" -t $TS `perl $c/install-win32/dosname.pl $x86/tap.cat`
echo '******************' SIGNCODE .cat FILE for x64
./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN TAP-Win64 Driver" -t $TS `perl $c/install-win32/dosname.pl $x64/tap.cat`
else
out="TAP driver catalog file is undefined";
echo "$out" >$x86/tap.cat
echo "$out" >$x64/tap.cat
fi
if [ -d "$SIGNTOOL" ]; then
$SIGNTOOL/signtap
fi

View File

@ -7,9 +7,9 @@
# Input grammar:
# (1) comments having ';' or '#' as the first char in the line
# (2) a blank line
# (3) include "file"
# (4) define foo bar
# (5) define foo "bar"
# (3) !include "file"
# (4) !define foo bar
# (5) !define foo "bar"
#
# Environmental variables can be used to override a setting.
# The special value "null" causes the variable to be undefined.
@ -25,6 +25,7 @@ sub comment {
sub define {
my ($name, $value) = @_;
if ($mode eq "sh") {
$value="true" if !$value;
print "[ -z \"\$$name\" ] && export $name=$value\n";
print "[ \"\$$name\" = \"$nulltag\" ] && unset $name\n";
} else {
@ -34,13 +35,12 @@ sub define {
}
if ($value ne $nulltag) {
print "#define $name $value\n" if ($mode =~ /^(c|h)$/);
print "!define $name $value\n" if ($mode eq "nsi");
print "define $name $value\n" if ($mode eq "in");
print "!define $name $value\n" if ($mode =~ /^(nsi|in)$/);
print "var $name=$value;\n" if ($mode eq "js");
} else {
print "//#undef $name\n" if ($mode =~ /^(c|h)$/);
print "#!undef $name\n" if ($mode eq "nsi");
print ";undef $name\n" if ($mode eq "in");
print ";!undef $name\n" if ($mode eq "in");
print "//undef $name\n" if ($mode eq "js");
}
}
@ -60,9 +60,9 @@ sub include_file {
print "\n";
} elsif (/^[#;](.*)$/) {
comment ($1);
} elsif (/^define\s+(\w+)\s+(.+)$/) {
} elsif (/^!define\s+(\w+)(?:\s+(.*?))?\s*$/) {
define ($1, $2);
} elsif (/^include\s+"(.+)"/) {
} elsif (/^!include\s+"(.+)"$/) {
include_file ($1);
} else {
die "can't parse this line: $_\n";

View File

@ -9,6 +9,7 @@ rm -rf autodefs
mkdir autodefs
MACRO="perl install-win32/macro.pl autodefs/defs.in"
IFDEF="perl install-win32/ifdef.pl"
# silly vista security theatre
PATCH="/tmp/p.exe"
@ -24,13 +25,11 @@ done
. autodefs/defs.sh
# configure tap driver sources
$MACRO <tap-win32/SOURCES.in >tap-win32/SOURCES
$MACRO <tap-win32/i386/OemWin2k.inf.in >tap-win32/i386/OemWin2k.inf
rm -rf tap-win32/amd64
mkdir tap-win32/amd64
cp tap-win32/i386/OemWin2k.inf tap-win32/amd64
cd tap-win32/amd64
$PATCH <../inf64.patch
$MACRO <tap-win32/SOURCES.in >tap-win32/SOURCES
$MACRO <tap-win32/i386/OemWin2k.inf.in | $IFDEF >tap-win32/i386/OemWin2k.inf
$MACRO <tap-win32/i386/OemWin2k.inf.in | $IFDEF -DAMD64 >tap-win32/amd64/OemWin2k.inf
# configure service
if [ -n "$SVC_TEMPLATE" ] ; then
@ -47,7 +46,11 @@ cd $c
cat COPYING COPYRIGHT.GPL >install-win32/license.txt
# copy sample configuration files and docs
cp sample-config-files/client.conf install-win32/client.ovpn
cp sample-config-files/server.conf install-win32/server.ovpn
cp easy-rsa/1.0/openssl.cnf install-win32/openssl.cnf.sample
s=samples
rm -rf $s
mkdir $s
cp sample-config-files/client.conf $s/client.$PRODUCT_FILE_EXT
cp sample-config-files/server.conf $s/server.$PRODUCT_FILE_EXT
cp install-win32/sample.ovpn $s/sample.$PRODUCT_FILE_EXT
cp easy-rsa/1.0/openssl.cnf $s/openssl.cnf.sample
cp INSTALL-win32.txt install-win32

View File

@ -58,7 +58,7 @@ LIB_DIRS = -L${OPENSSL_DIR}/out -L${LZO_DIR}
LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC_DIR}
EXE = openvpn.exe
EXE = ${PRODUCT_UNIX_NAME}.exe
HEADERS = \
base64.h \

View File

@ -44,7 +44,7 @@
#include "memdbg.h"
#define MANAGEMENT_ECHO_PULL_INFO 0 /* JYFIXME */
#define MANAGEMENT_ECHO_PULL_INFO 0
#if MANAGEMENT_ECHO_PULL_INFO
#define MANAGEMENT_ECHO_FLAGS LOG_PRINT_INTVAL

View File

@ -70,6 +70,9 @@ const char title_string[] =
#if EPOLL
" [EPOLL]"
#endif
#ifdef PRODUCT_TAP_DEBUG
" [TAPDBG]"
#endif
#ifdef USE_PTHREAD
" [PTHREAD]"
#endif

View File

@ -748,7 +748,7 @@ get_proxy_settings (char **err, struct gc_arena *gc)
if (err)
*err = string_alloc ("PROXY: automatic detection not supported on this OS", gc);
return NULL;
#else /* JYFIXME, test --auto-proxy feature */
#else /* test --auto-proxy feature */
struct auto_proxy_info *pi;
ALLOC_OBJ_CLEAR_GC (pi, struct auto_proxy_info, gc);
pi->http.server = "10.10.0.2";

View File

@ -5,7 +5,7 @@
# applying service.patch to the Platform
# SDK service sample.
EXE = openvpnserv.exe
EXE = ${PRODUCT_UNIX_NAME}serv.exe
HEADERS = service.h

View File

@ -1,4 +1,4 @@
# build service.[ch] patch against original
# SDK sample
diff -ub service.c.orig service.c >service.patch
diff -ub service.h.orig service.h >>service.patch
diff -ub service.c.orig service.c | u2d >service.patch
diff -ub service.h.orig service.h | u2d >>service.patch

View File

@ -65,13 +65,13 @@ struct security_attributes
* Control Manager which will cause an asynchronous call
* of ServiceStop below.
*/
#define EXIT_EVENT_NAME "openvpn_exit_1"
#define EXIT_EVENT_NAME PRODUCT_UNIX_NAME "_exit_1"
/*
* Which registry key in HKLM should
* we get config info from?
*/
#define REG_KEY "SOFTWARE\\OpenVPN"
#define REG_KEY "SOFTWARE\\" PRODUCT_NAME
static HANDLE exit_event = NULL;
@ -398,7 +398,7 @@ VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
mysnprintf (log_path, "%s\\%s", log_dir, log_file);
/* construct command line */
mysnprintf (command_line, "openvpn --service %s 1 --config \"%s\"",
mysnprintf (command_line, PRODUCT_UNIX_NAME " --service %s 1 --config \"%s\"",
EXIT_EVENT_NAME,
find_obj.cFileName);
@ -406,7 +406,7 @@ VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
be inherited. */
if (!init_security_attributes_allow_all (&sa))
{
MSG (M_SYSERR, "InitializeSecurityDescriptor start_openvpn failed");
MSG (M_SYSERR, "InitializeSecurityDescriptor start_" PRODUCT_UNIX_NAME " failed");
goto finish;
}

View File

@ -1,5 +1,5 @@
--- service.c.orig Mon Jan 30 10:03:35 2006
+++ service.c Mon Jan 30 10:16:33 2006
--- service.c.orig Tue Apr 24 14:49:30 2007
+++ service.c Tue Apr 24 12:20:08 2007
@@ -16,6 +16,7 @@
service_main(DWORD dwArgc, LPTSTR *lpszArgv);
CmdInstallService();
@ -319,27 +319,33 @@
}
if ( lpszTemp )
--- service.h.orig Mon Jan 30 10:03:35 2006
+++ service.h Mon Jan 30 10:03:35 2006
@@ -62,13 +62,13 @@
--- service.h.orig Tue Apr 24 14:49:30 2007
+++ service.h Tue Apr 24 11:58:48 2007
@@ -57,18 +57,19 @@
extern "C" {
#endif
+#include "../autodefs/defs.h"
//////////////////////////////////////////////////////////////////////////////
//// todo: change to desired strings
////
// name of the executable
-#define SZAPPNAME "Simple"
+#define SZAPPNAME "openvpnserv"
+#define SZAPPNAME PRODUCT_UNIX_NAME "serv"
// internal name of the service
-#define SZSERVICENAME "SimpleService"
+#define SZSERVICENAME "OpenVPNService"
+#define SZSERVICENAME PRODUCT_NAME "Service"
// displayed name of the service
-#define SZSERVICEDISPLAYNAME "Simple Service"
+#define SZSERVICEDISPLAYNAME "OpenVPN Service"
+#define SZSERVICEDISPLAYNAME PRODUCT_NAME " Service"
// list of service dependencies - "dep1\0dep2\0\0"
-#define SZDEPENDENCIES ""
+#define SZDEPENDENCIES "TAP0901\0Dhcp\0\0"
+#define SZDEPENDENCIES PRODUCT_TAP_ID "\0Dhcp\0\0"
//////////////////////////////////////////////////////////////////////////////
@@ -126,7 +126,10 @@
@@ -126,7 +127,10 @@
// RETURN VALUE:
// none
//

View File

@ -80,14 +80,14 @@ typedef uint16_t packet_size_type;
/* OpenVPN sockaddr struct */
struct openvpn_sockaddr
{
int dummy; /* JYFIXME -- add offset to force a bug if sa not explicitly dereferenced */
/*int dummy;*/ /* add offset to force a bug if sa not explicitly dereferenced */
struct sockaddr_in sa;
};
/* actual address of remote, based on source address of received packets */
struct link_socket_actual
{
int dummy; /* JYFIXME -- add offset to force a bug if dest not explicitly dereferenced */
/*int dummy;*/ /* add offset to force a bug if dest not explicitly dereferenced */
struct openvpn_sockaddr dest;
#if ENABLE_IP_PKTINFO
struct in_pktinfo pi;

View File

@ -4,7 +4,7 @@
MAJORCOMP=ntos
MINORCOMP=ndis
TARGETNAME=tap0901
TARGETNAME=@@PRODUCT_TAP_ID@@
TARGETTYPE=DRIVER
TARGETPATH=.
TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib $(DDK_LIB_PATH)\ntstrsafe.lib
@ -59,7 +59,7 @@ LINKER_FLAGS=$(LINKER_FLAGS) /MAP /MAPINFO:EXPORTS /MAPINFO:LINES
#BROWSER_INFO=1
#BROWSERFILE=$(TARGETNAME).BSC -n
# Abort compilation on warnings.
MSC_WARNING_LEVEL=/W3 /WX
# Abort compilation on warnings by adding /WX
MSC_WARNING_LEVEL=/W3
SOURCES=tapdrvr.c resource.rc

View File

@ -32,6 +32,8 @@
// common to both.
//===============================================
#include "../autodefs/defs.h"
//=============
// TAP IOCTLs
//=============
@ -79,4 +81,4 @@
// simultaneously.
//=========================================================
#define TAP_COMPONENT_ID "tap0901"
#define TAP_COMPONENT_ID PRODUCT_TAP_ID

View File

@ -30,7 +30,7 @@
// Product and Version public settings
//====================================================================
#define PRODUCT_STRING "TAP-Win32 Adapter V9"
#define PRODUCT_STRING PRODUCT_TAP_DEVICE_DESCRIPTION
#define TAP_NDIS_MAJOR_VERSION 5
#define TAP_NDIS_MINOR_VERSION 0

View File

@ -96,7 +96,7 @@ MyDebugPrint (const unsigned char* format, ...)
va_end (args);
if (status == STATUS_SUCCESS)
g_Debug.out = end - g_Debug.text;
g_Debug.out = (unsigned int) (end - g_Debug.text);
else
g_Debug.error = TRUE;
}

View File

@ -23,7 +23,11 @@
; not collide with other instances of TAP-Win32 defined
; by other apps. Multiple versions of the TAP-Win32
; driver, each installed by different apps, can coexist
; on the same machine if you follow these guidelines:
; on the same machine if you follow these guidelines.
; NOTE: these instructions assume you are editing the
; generated OemWin2k.inf file, not the source
; OemWin2k.inf.in file which is preprocessed by winconfig
; and uses macro definitions from settings.in.
;
; (1) Rename all tapXXXX instances in this file to
; something different (use at least 5 characters
@ -44,7 +48,7 @@
[Version]
Signature = "$Windows NT$"
CatalogFile = tap.cat
CatalogFile = @@PRODUCT_TAP_ID@@.cat
ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
Provider = %Provider%
Class = Net
@ -54,17 +58,25 @@
DriverVer=@@PRODUCT_TAP_RELDATE@@,@@PRODUCT_TAP_MAJOR_VER@@.00.00.@@PRODUCT_TAP_MINOR_VER@@
[Strings]
DeviceDescription = "TAP-Win32 Adapter V9"
Provider = "TAP-Win32 Provider V9"
DeviceDescription = "@@PRODUCT_TAP_DEVICE_DESCRIPTION@@"
Provider = "@@PRODUCT_TAP_PROVIDER@@"
;----------------------------------------------------------------
; Manufacturer + Product Section (Done)
;----------------------------------------------------------------
[Manufacturer]
%Provider% = tap0901
!ifdef AMD64
%Provider% = @@PRODUCT_TAP_ID@@, NTamd64
!else
%Provider% = @@PRODUCT_TAP_ID@@
!endif
[tap0901]
%DeviceDescription% = tap0901.ndi, tap0901
!ifdef AMD64
[@@PRODUCT_TAP_ID@@.NTamd64]
!else
[@@PRODUCT_TAP_ID@@]
!endif
%DeviceDescription% = @@PRODUCT_TAP_ID@@.ndi, @@PRODUCT_TAP_ID@@
;---------------------------------------------------------------
; Driver Section (Done)
@ -79,23 +91,23 @@
; NCF_HAS_UI = 0x80
;----------------- Characteristics ------------
[tap0901.ndi]
CopyFiles = tap0901.driver, tap0901.files
AddReg = tap0901.reg
AddReg = tap0901.params.reg
Characteristics = 0x81
[@@PRODUCT_TAP_ID@@.ndi]
CopyFiles = @@PRODUCT_TAP_ID@@.driver, @@PRODUCT_TAP_ID@@.files
AddReg = @@PRODUCT_TAP_ID@@.reg
AddReg = @@PRODUCT_TAP_ID@@.params.reg
Characteristics = @@PRODUCT_TAP_CHARACTERISTICS@@
[tap0901.ndi.Services]
AddService = tap0901, 2, tap0901.service
[@@PRODUCT_TAP_ID@@.ndi.Services]
AddService = @@PRODUCT_TAP_ID@@, 2, @@PRODUCT_TAP_ID@@.service
[tap0901.reg]
HKR, Ndi, Service, 0, "tap0901"
[@@PRODUCT_TAP_ID@@.reg]
HKR, Ndi, Service, 0, "@@PRODUCT_TAP_ID@@"
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
HKR, , Manufacturer, 0, "%Provider%"
HKR, , ProductName, 0, "%DeviceDescription%"
[tap0901.params.reg]
[@@PRODUCT_TAP_ID@@.params.reg]
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
HKR, Ndi\params\MTU, Type, 0, "int"
HKR, Ndi\params\MTU, Default, 0, "1500"
@ -136,13 +148,13 @@
; SERVICE_DISABLED = 0x4
;---------- Start Mode ---------------
[tap0901.service]
[@@PRODUCT_TAP_ID@@.service]
DisplayName = %DeviceDescription%
ServiceType = 1
StartType = 3
ErrorControl = 1
LoadOrderGroup = NDIS
ServiceBinary = %12%\tap0901.sys
ServiceBinary = %12%\@@PRODUCT_TAP_ID@@.sys
;-----------------------------------------------------------------
; File Installation
@ -158,25 +170,25 @@
; 1 = "Intel Driver Disk 1",e100bex.sys,,
[SourceDisksNames]
1 = %DeviceDescription%, tap0901.sys
1 = %DeviceDescription%, @@PRODUCT_TAP_ID@@.sys
; SourceDisksFiles
; filename_on_source = diskID[, [subdir][, size]]
; e100bex.sys = 1,, ; on distribution disk 1
[SourceDisksFiles]
tap0901.sys = 1
@@PRODUCT_TAP_ID@@.sys = 1
[DestinationDirs]
tap0901.files = 11
tap0901.driver = 12
@@PRODUCT_TAP_ID@@.files = 11
@@PRODUCT_TAP_ID@@.driver = 12
[tap0901.files]
[@@PRODUCT_TAP_ID@@.files]
; TapPanel.cpl,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
; cipsrvr.exe,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
[tap0901.driver]
tap0901.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
[@@PRODUCT_TAP_ID@@.driver]
@@PRODUCT_TAP_ID@@.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
;---------------------------------------------------------------
; End

View File

@ -1,14 +0,0 @@
--- i386/OemWin2k.inf Mon Mar 5 23:17:34 2007
+++ amd64/OemWin2k.inf Mon Mar 5 23:17:35 2007
@@ -61,9 +61,9 @@
; Manufacturer + Product Section (Done)
;----------------------------------------------------------------
[Manufacturer]
- %Provider% = tap0901
+ %Provider% = tap0901, NTamd64
-[tap0901]
+[tap0901.NTamd64]
%DeviceDescription% = tap0901.ndi, tap0901
;---------------------------------------------------------------

View File

@ -58,7 +58,7 @@
//========================================================
// Check for truncated IPv4 packets, log errors if found.
//========================================================
#define PACKET_TRUNCATION_CHECK 1 // JYFIXME
#define PACKET_TRUNCATION_CHECK 0
//========================================================
// EXPERIMENTAL -- Configure TAP device object to be
@ -68,7 +68,7 @@
// Duplicates the functionality of OpenVPN's
// --allow-nonadmin directive.
//========================================================
#define ENABLE_NONADMIN 1 // JYFIXME
#define ENABLE_NONADMIN 1
#if DDKVER < 5600
#include <ndis.h>
@ -1413,7 +1413,8 @@ AdapterTransmit (IN NDIS_HANDLE p_AdapterContext,
IN UINT p_Flags)
{
TapAdapterPointer l_Adapter = (TapAdapterPointer) p_AdapterContext;
ULONG l_Index = 0, l_BufferLength = 0, l_PacketLength = 0;
ULONG l_Index = 0, l_PacketLength = 0;
UINT l_BufferLength = 0;
PIRP l_IRP;
TapPacketPointer l_PacketBuffer;
PNDIS_BUFFER l_NDIS_Buffer;

2
tun.c
View File

@ -50,7 +50,7 @@
#ifdef WIN32
/* #define SIMULATE_DHCP_FAILED */ /* JYFIXME -- simulate bad DHCP negotiation */
/* #define SIMULATE_DHCP_FAILED */ /* simulate bad DHCP negotiation */
#define NI_TEST_FIRST (1<<0)
#define NI_IP_NETMASK (1<<1)

View File

@ -1,2 +1,2 @@
dnl define the OpenVPN version
define(PRODUCT_VERSION,[2.1_rc3])
define(PRODUCT_VERSION,[2.1_rc3a])