diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-09-14 02:18:40 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-09-14 02:18:40 +0000 |
commit | d1270d07b24fb379f599543ef7807dafa4dbeaec (patch) | |
tree | a92648c25d7e7a1f19d597385ac313dbab26ad8e /tap-win32 | |
parent | Version 2.1_beta15 released (diff) | |
download | openvpn-d1270d07b24fb379f599543ef7807dafa4dbeaec.tar.xz |
TAP-Win32 fixes to run on Windows Vista.
Modified installer to detect 32-bit vs.
64 bit Windows and install the correct TAP
driver.
TAP-Win32 version number is at 8.4.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1229 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'tap-win32')
-rwxr-xr-x | tap-win32/SOURCES | 4 | ||||
-rwxr-xr-x | tap-win32/amd64/OemWin2k.inf | 183 | ||||
-rwxr-xr-x | tap-win32/amd64/tap.cat | 6 | ||||
-rwxr-xr-x | tap-win32/i386/OemWin2k.inf | 4 | ||||
-rwxr-xr-x | tap-win32/resource.rc | 2 | ||||
-rwxr-xr-x | tap-win32/tapdrvr.c | 76 |
6 files changed, 254 insertions, 21 deletions
diff --git a/tap-win32/SOURCES b/tap-win32/SOURCES index f03b7f6..4d6cdee 100755 --- a/tap-win32/SOURCES +++ b/tap-win32/SOURCES @@ -15,7 +15,7 @@ INCLUDES=$(DDK_INCLUDE_PATH) # config-win32.h C_DEFINES= C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MAJOR_VERSION=8 -C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MINOR_VERSION=3 +C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MINOR_VERSION=4 # Use 00:FF:XX:XX:XX:XX format MAC addresses where # the Xs are random (like Linux tap driver). @@ -60,7 +60,7 @@ MSC_OPTIMIZATION=/Od /Oi /Fc !ENDIF # Generate a linker map file just in case we need one for debugging -LINKER_FLAGS=$(LINKER_FLAGS) /MAP /MAPINFO:EXPORTS /MAPINFO:LINES /MAPINFO:FIXUPS +LINKER_FLAGS=$(LINKER_FLAGS) /MAP /MAPINFO:EXPORTS /MAPINFO:LINES # Generate a browser information file for use in IDE development BROWSER_INFO=1 diff --git a/tap-win32/amd64/OemWin2k.inf b/tap-win32/amd64/OemWin2k.inf new file mode 100755 index 0000000..68879bd --- /dev/null +++ b/tap-win32/amd64/OemWin2k.inf @@ -0,0 +1,183 @@ +; **************************************************************************** +; * Copyright (C) 2002-2006 OpenVPN Solutions LLC * +; * This program is free software; you can redistribute it and/or modify * +; * it under the terms of the GNU General Public License version 2 * +; * as published by the Free Software Foundation. * +; **************************************************************************** + +; SYNTAX CHECKER +; cd \WINDDK\3790\tools\chkinf +; chkinf c:\src\openvpn\tap-win32\i386\oemwin2k.inf +; OUTPUT -> file:///c:/WINDDK/3790/tools/chkinf/htm/c%23+src+openvpn+tap-win32+i386+__OemWin2k.htm + +; INSTALL/REMOVE DRIVER +; tapinstall install OemWin2k.inf TAP0801 +; tapinstall update OemWin2k.inf TAP0801 +; tapinstall remove TAP0801 + +;********************************************************* +; Note to Developers: +; +; If you are bundling the TAP-Win32 driver with your app, +; you should try to rename it in such a way that it will +; 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: +; +; (1) Rename all tapXXXX instances in this file to +; something different (use at least 5 characters +; for this name!) +; (2) Change the "!define TAP" definition in openvpn.nsi +; to match what you changed tapXXXX to. +; (3) Change TARGETNAME in SOURCES to match what you +; changed tapXXXX to. +; (4) Change TAP_COMPONENT_ID in common.h to match what +; you changed tapXXXX to. +; (5) Change SZDEPENDENCIES in service.h to match what +; you changed tapXXXX to. +; (6) Change DeviceDescription and Provider strings. +; (7) Change PRODUCT_STRING in constants.h to what you +; set DeviceDescription to. +; +;********************************************************* + +[Version] + Signature = "$Windows NT$" + CatalogFile = tap.cat + ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318} + Provider = %Provider% + Class = Net + +; This version number should match the version +; number given in SOURCES. + DriverVer=09/13/2006,8.00.00.0004 + +[Strings] + DeviceDescription = "TAP-Win32 Adapter V8" + Provider = "TAP-Win32 Provider" + +;---------------------------------------------------------------- +; Manufacturer + Product Section (Done) +;---------------------------------------------------------------- +[Manufacturer] + %Provider% = tap0801, NTamd64 + +[tap0801.NTamd64] + %DeviceDescription% = tap0801.ndi, tap0801 + +;--------------------------------------------------------------- +; Driver Section (Done) +;--------------------------------------------------------------- + +;----------------- Characteristics ------------ +; NCF_PHYSICAL = 0x04 +; NCF_VIRTUAL = 0x01 +; NCF_SOFTWARE_ENUMERATED = 0x02 +; NCF_HIDDEN = 0x08 +; NCF_NO_SERVICE = 0x10 +; NCF_HAS_UI = 0x80 +;----------------- Characteristics ------------ + +[tap0801.ndi] + CopyFiles = tap0801.driver, tap0801.files + AddReg = tap0801.reg + AddReg = tap0801.params.reg + Characteristics = 0x81 + +[tap0801.ndi.Services] + AddService = tap0801, 2, tap0801.service + +[tap0801.reg] + HKR, Ndi, Service, 0, "tap0801" + HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" + HKR, , Manufacturer, 0, "%Provider%" + HKR, , ProductName, 0, "%DeviceDescription%" + +[tap0801.params.reg] + HKR, Ndi\params\MTU, ParamDesc, 0, "MTU" + HKR, Ndi\params\MTU, Type, 0, "int" + HKR, Ndi\params\MTU, Default, 0, "1500" + HKR, Ndi\params\MTU, Optional, 0, "0" + HKR, Ndi\params\MTU, Min, 0, "100" + HKR, Ndi\params\MTU, Max, 0, "1500" + HKR, Ndi\params\MTU, Step, 0, "1" + HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status" + HKR, Ndi\params\MediaStatus, Type, 0, "enum" + HKR, Ndi\params\MediaStatus, Default, 0, "0" + HKR, Ndi\params\MediaStatus, Optional, 0, "0" + HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled" + HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected" + HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address" + HKR, Ndi\params\MAC, Type, 0, "edit" + HKR, Ndi\params\MAC, Optional, 0, "1" + HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access" + HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum" + HKR, Ndi\params\AllowNonAdmin, Default, 0, "1" + HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0" + HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed" + HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed" + +;---------------------------------------------------------------- +; Service Section +;---------------------------------------------------------------- + +;---------- Service Type ------------- +; SERVICE_KERNEL_DRIVER = 0x01 +; SERVICE_WIN32_OWN_PROCESS = 0x10 +;---------- Service Type ------------- + +;---------- Start Mode --------------- +; SERVICE_BOOT_START = 0x0 +; SERVICE_SYSTEM_START = 0x1 +; SERVICE_AUTO_START = 0x2 +; SERVICE_DEMAND_START = 0x3 +; SERVICE_DISABLED = 0x4 +;---------- Start Mode --------------- + +[tap0801.service] + DisplayName = %DeviceDescription% + ServiceType = 1 + StartType = 3 + ErrorControl = 1 + LoadOrderGroup = NDIS + ServiceBinary = %12%\tap0801.sys + +;----------------------------------------------------------------- +; File Installation +;----------------------------------------------------------------- + +;----------------- Copy Flags ------------ +; COPYFLG_NOSKIP = 0x02 +; COPYFLG_NOVERSIONCHECK = 0x04 +;----------------- Copy Flags ------------ + +; SourceDisksNames +; diskid = description[, [tagfile] [, <unused>, subdir]] +; 1 = "Intel Driver Disk 1",e100bex.sys,, + +[SourceDisksNames] + 1 = %DeviceDescription%, tap0801.sys + +; SourceDisksFiles +; filename_on_source = diskID[, [subdir][, size]] +; e100bex.sys = 1,, ; on distribution disk 1 + +[SourceDisksFiles] +tap0801.sys = 1 + +[DestinationDirs] + tap0801.files = 11 + tap0801.driver = 12 + +[tap0801.files] +; TapPanel.cpl,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK +; cipsrvr.exe,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK + +[tap0801.driver] + tap0801.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK + +;--------------------------------------------------------------- +; End +;--------------------------------------------------------------- diff --git a/tap-win32/amd64/tap.cat b/tap-win32/amd64/tap.cat new file mode 100755 index 0000000..4492fa2 --- /dev/null +++ b/tap-win32/amd64/tap.cat @@ -0,0 +1,6 @@ +; **************************************************************************** +; * Copyright (C) 2002-2005 OpenVPN Solutions LLC * +; * This program is free software; you can redistribute it and/or modify * +; * it under the terms of the GNU General Public License version 2 * +; * as published by the Free Software Foundation. * +; **************************************************************************** diff --git a/tap-win32/i386/OemWin2k.inf b/tap-win32/i386/OemWin2k.inf index 681c4b7..219b4ca 100755 --- a/tap-win32/i386/OemWin2k.inf +++ b/tap-win32/i386/OemWin2k.inf @@ -1,5 +1,5 @@ ; **************************************************************************** -; * Copyright (C) 2002-2005 OpenVPN Solutions LLC * +; * Copyright (C) 2002-2006 OpenVPN Solutions LLC * ; * This program is free software; you can redistribute it and/or modify * ; * it under the terms of the GNU General Public License version 2 * ; * as published by the Free Software Foundation. * @@ -51,7 +51,7 @@ ; This version number should match the version ; number given in SOURCES. - DriverVer=05/15/2004,8.00.00.0001 + DriverVer=09/13/2006,8.00.00.0004 [Strings] DeviceDescription = "TAP-Win32 Adapter V8" diff --git a/tap-win32/resource.rc b/tap-win32/resource.rc index 726e287..8c9cb7b 100755 --- a/tap-win32/resource.rc +++ b/tap-win32/resource.rc @@ -36,7 +36,7 @@ #define VER_COMPANYNAME_STR "The OpenVPN Project" #define VER_FILEDESCRIPTION_STR "TAP-Win32 Virtual Network Driver" #define VER_ORIGINALFILENAME_STR TAP_COMPONENT_ID ".sys" -#define VER_LEGALCOPYRIGHT_YEARS "2003-2004" +#define VER_LEGALCOPYRIGHT_YEARS "2003-2006" #define VER_LEGALCOPYRIGHT_STR "OpenVPN Solutions LLC and Damion K. Wilson" diff --git a/tap-win32/tapdrvr.c b/tap-win32/tapdrvr.c index 0997bd5..9c6304b 100755 --- a/tap-win32/tapdrvr.c +++ b/tap-win32/tapdrvr.c @@ -8,7 +8,7 @@ * Copyright (C) Damion K. Wilson, 2003, and is released under the * GPL version 2 (see below). * - * All other source code is Copyright (C) 2002-2005 OpenVPN Solutions LLC, + * All other source code is Copyright (C) 2002-2006 OpenVPN Solutions LLC, * and is released under the GPL version 2 (see below). * * This program is free software; you can redistribute it and/or modify @@ -364,19 +364,6 @@ NDIS_STATUS AdapterCreate AdapterHalt); l_Adapter->m_RegisteredAdapterShutdownHandler = TRUE; - //==================================== - // Allocate and construct adapter name - //==================================== - - if (RtlUnicodeStringToAnsiString ( - &l_Adapter->m_NameAnsi, - &((PNDIS_MINIPORT_BLOCK) p_AdapterHandle)->MiniportName, - TRUE) != STATUS_SUCCESS) - { - AdapterFreeResources (l_Adapter); - return NDIS_STATUS_RESOURCES; - } - //============================================ // Get parameters from registry which were set // in the adapter advanced properties dialog. @@ -392,8 +379,66 @@ NDIS_STATUS AdapterCreate l_Adapter->m_MediaState = FALSE; NdisOpenConfiguration (&status, &configHandle, p_ConfigurationHandle); - if (status == NDIS_STATUS_SUCCESS) + if (status != NDIS_STATUS_SUCCESS) { + DEBUGP (("[TAP] Couldn't open adapter registry\n")); + AdapterFreeResources (l_Adapter); + return status; + } + + //==================================== + // Allocate and construct adapter name + //==================================== + { + NDIS_STRING key = NDIS_STRING_CONST("MiniportName"); + NdisReadConfiguration (&status, &parm, configHandle, &key, NdisParameterString); + if (status == NDIS_STATUS_SUCCESS) + { + if (parm->ParameterType == NdisParameterString) + { + DEBUGP (("[TAP] NdisReadConfiguration (MiniportName=%s)\n", parm->ParameterData.StringData.Buffer)); + + if (RtlUnicodeStringToAnsiString ( + &l_Adapter->m_NameAnsi, + &parm->ParameterData.StringData, + TRUE) != STATUS_SUCCESS) + { + DEBUGP (("[TAP] RtlUnicodeStringToAnsiString MiniportName failed\n")); + status = NDIS_STATUS_RESOURCES; + } + } + } else { + /* "MiniportName" is available only XP and above. Not on Windows 2000. */ + NDIS_STRING key = NDIS_STRING_CONST("NdisVersion"); + NdisReadConfiguration (&status, &parm, configHandle, &key, NdisParameterInteger); + if (status == NDIS_STATUS_SUCCESS) + { + if (parm->ParameterData.IntegerData == 0x50000) + { + /* Fallback for Windows 2000 with NDIS version 5.00.00 + Don't use this on Vista, 'NDIS_MINIPORT_BLOCK' was changed! */ + DEBUGP (("[TAP] NdisReadConfiguration NdisVersion (Int=%X)\n", parm->ParameterData.IntegerData)); + if (RtlUnicodeStringToAnsiString ( + &l_Adapter->m_NameAnsi, + &((PNDIS_MINIPORT_BLOCK) p_AdapterHandle)->MiniportName, + TRUE) != STATUS_SUCCESS) + { + DEBUGP (("[TAP] RtlUnicodeStringToAnsiString MiniportName (W2K) failed\n")); + status = NDIS_STATUS_RESOURCES; + } + } + } + } + } + + /* Can't continue without name (see macro 'NAME') */ + if (status != NDIS_STATUS_SUCCESS || !l_Adapter->m_NameAnsi.Buffer) + { + NdisCloseConfiguration (configHandle); + AdapterFreeResources (l_Adapter); + return NDIS_STATUS_RESOURCES; + } + /* Read MTU setting from registry */ { NDIS_STRING key = NDIS_STRING_CONST("MTU"); @@ -470,7 +515,6 @@ NDIS_STATUS AdapterCreate } NdisCloseConfiguration (configHandle); - } DEBUGP (("[%s] MTU=%d\n", NAME (l_Adapter), l_Adapter->m_MTU)); } |