From 657ecf14acc58a6d345341a5e36411bde5be9cd9 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 25 Apr 2007 21:37:49 +0000 Subject: 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 --- tap-win32/SOURCES.in | 6 ++-- tap-win32/common.h | 4 ++- tap-win32/constants.h | 2 +- tap-win32/error.c | 2 +- tap-win32/i386/OemWin2k.inf.in | 66 +++++++++++++++++++++++++----------------- tap-win32/inf64.patch | 14 --------- tap-win32/tapdrvr.c | 7 +++-- 7 files changed, 51 insertions(+), 50 deletions(-) delete mode 100644 tap-win32/inf64.patch (limited to 'tap-win32') diff --git a/tap-win32/SOURCES.in b/tap-win32/SOURCES.in index d64829d..58e4c59 100755 --- a/tap-win32/SOURCES.in +++ b/tap-win32/SOURCES.in @@ -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 diff --git a/tap-win32/common.h b/tap-win32/common.h index 4589740..df2024d 100755 --- a/tap-win32/common.h +++ b/tap-win32/common.h @@ -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 diff --git a/tap-win32/constants.h b/tap-win32/constants.h index a16e425..d4bd1c9 100755 --- a/tap-win32/constants.h +++ b/tap-win32/constants.h @@ -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 diff --git a/tap-win32/error.c b/tap-win32/error.c index 77746e6..696d84e 100755 --- a/tap-win32/error.c +++ b/tap-win32/error.c @@ -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; } diff --git a/tap-win32/i386/OemWin2k.inf.in b/tap-win32/i386/OemWin2k.inf.in index a5450ad..2e3fcda 100755 --- a/tap-win32/i386/OemWin2k.inf.in +++ b/tap-win32/i386/OemWin2k.inf.in @@ -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 - -[tap0901] - %DeviceDescription% = tap0901.ndi, tap0901 +!ifdef AMD64 + %Provider% = @@PRODUCT_TAP_ID@@, NTamd64 +!else + %Provider% = @@PRODUCT_TAP_ID@@ +!endif + +!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 diff --git a/tap-win32/inf64.patch b/tap-win32/inf64.patch deleted file mode 100644 index a619a3e..0000000 --- a/tap-win32/inf64.patch +++ /dev/null @@ -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 - - ;--------------------------------------------------------------- diff --git a/tap-win32/tapdrvr.c b/tap-win32/tapdrvr.c index 16a46cd..989b44c 100755 --- a/tap-win32/tapdrvr.c +++ b/tap-win32/tapdrvr.c @@ -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 @@ -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; -- cgit