Tap-Win32的编译

最近接触到Tap-Win3的相关东西,下载了源码后死活编译不过,网上到处查也没查到,问人也没人搭理,只好自己摆弄,最终发现只是一些简单的驱动信息定义而已,主要是自己以前没有接触过驱动,啥都不知道,现在记录一下,方便像自己这样的新手。

1、common.h

将config.h相关内容注释掉,因为在DDK环境编译永不倒。

/*

#if defined(HAVE_CONFIG_H)
#include "config.h"
#else
#if defined(_MSC_VER) && !defined(TAP_DRIVER_MAJOR_VERSION)
#include "config-win32.h"
#else
#include "../config.h"
#endif
#endif

*/

 

2、constants.h

#define PRODUCT_STRING "TAp-Win32 Adapter V9"

3、tapdrvr.c

//#include "../../autodefs/defs.h"  不需要这个文件

将相关DDKVER_MAJOR的内容注释掉,这里是因为我只在Windows XP下实验,所以其他就不管了。

//#if DDKVER_MAJOR < 5600
#include <ndis.h>
#include <ntstrsafe.h>
#include <ntddk.h>
//#else
//#include <ntifs.h>
//#include <ndis.h>
//#include <ntstrsafe.h>
//#endif

4、将SOURCE.in更名为SOURCE

内容修改如下:(主要修改一些驱动版本相关信息)

# Build TAP-Win32 driver.
# Build Command: build -cef

MAJORCOMP=ntos
MINORCOMP=ndis

TARGETNAME=tap0901
TARGETTYPE=DRIVER
TARGETPATH=.
TARGETLIBS=$(DDK_LIB_PATH)/ndis.lib $(DDK_LIB_PATH)/ntstrsafe.lib
INCLUDES=$(DDK_INCLUDE_PATH)

# The TAP version numbers here must be >=
# TAP_WIN32_MIN_x values defined in
# config-win32.h
C_DEFINES=
C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MAJOR_VERSION=9
C_DEFINES=$(C_DEFINES) -DTAP_DRIVER_MINOR_VERSION=1
C_DEFINES=$(C_DEFINES)

# Produce the same symbolic information for both free & checked builds.
# This will allow us to perform full source-level debugging on both
# builds without affecting the free build's performance.
!IF "$(DDKBUILDENV)" != "chk"
NTDEBUGTYPE=both
USE_PDB=1
!ELSE
NTDEBUGTYPE=both
USE_PDB=1
!ENDIF

# Set compiler optimizations:
# /Ox - Full optimization enabled
# /Os - favor speed over size when optimizing
# /Od - Disable all optimizations
# /Oi - Enable optimization for intrinsic functions
# /Fc - Generate mixed assembler/source code files
#
# For both checked and free builds, make sure that any intrinsic
# functions are compiled correctly. To do this, ensure that /Oi
# is selected for both free and checked builds. There is a bug in
# VC++ 6.0 (at least through SP4) where, if you specify any
# intrinsic functions in your code with "#pragma intrinsic" but
# you don't have the /Oi optimization enabled, neither a call
# to the function, nor the intrinsic inline version of the function
# will end up in your object code. This bug only applies to free
# builds, but just to be safe we'll make sure that the flag is
# enabled for all builds.

!IF "$(DDKBUILDENV)" != "chk"
MSC_OPTIMIZATION=/Ox /Oi /Fc
!ELSE
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

# Generate a browser information file for use in IDE development
#BROWSER_INFO=1
#BROWSERFILE=$(TARGETNAME).BSC -n

# Abort compilation on warnings by adding /WX
MSC_WARNING_LEVEL=/W3 /WX

SOURCES=tapdrvr.c resource.rc
5、将上层目录的config-win32拷贝到Tap-Win32目录下,同时修改resource.h的包含#include "config-win32.h",方便拷贝

并注释//#include "autodefs/defs.h"

在WDK和DDK 2003上编译通过。

 

下载链接http://download.csdn.net/source/2151789

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值