ddkbuild.bat,cmd,拷到了winddk目录下,加了wxpbase环境变量,vc目录选好了。
用ddkwizard建一个driver,选winxp的驱动,生成工程。原封不动的编译,只能得到win7的驱动。
ddkwizard连win7都不支持,怎么会出现这种情况?!
高手帮忙看一下好么,多谢了!!
下面是vs的输出提示:
1>------ 已启动生成: 项目: Driver1.WXP, 配置: WXP checked (PREfast) Win32 ------
1>正在执行生成文件项目操作
1>OSR DDKBUILD.CMD V7.3/r27 (2008-09-06) - OSR, Open Systems Resources, Inc.
1>DDKBLD: >> Setting custom environment variables [ddkbldenv.cmd] ...
1>DDKBLD: << Finished setting custom environment variables [ddkbldenv.cmd] ...
1>Launching OACR monitor
1>OACR NOTE : Not starting monitor (oacr running in job that doesn't allow break-away)
1>DDKBLD: >> Performing pre-build steps [ddkprebld.cmd] ...
1>DDKBLD: New build number is 1 ...
1>DDKBLD: << Finished pre-build steps [ddkprebld.cmd] ...
1>DDKBLD: WXP (checked) using the Windows XP DDK and %WXPBASE%
1>DDKBLD: Directory: C:\DOCUME~1\nick\桌面\first\Driver1\Driver1 + argument(s): -cZ -prefast
1>DDKBLD: WXPBASE: C:\WinDDK\760016~1.0
1>DDKBLD: Run prefast build -MI -Ze -cZ for checked version in .
1>driver1.cpp
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.207 for 80x86
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>cl /Fo"c:\docume~1\nick\桌面\first\driver1\driver1\objchk_win7_x86\i386/"
1> /FC
1>
1> /Ii386
1> /I.
1> /Ic:\docume~1\nick\桌面\first\driver1\driver1\objchk_win7_x86\i386
1> /IC:\WinDDK\760016~1.0\inc\api
1> /IC:\WinDDK\760016~1.0\inc\api
1> /IC:\WinDDK\760016~1.0\inc\ddk
1> /IC:\WinDDK\760016~1.0\inc\ddk
1> /IC:\WinDDK\760016~1.0\inc\crt
1> /D_X86_=1
1> /Di386=1
1>
1> /DSTD_CALL
1> /DCONDITION_HANDLING=1
1> /DNT_UP=1
1>
1> /DNT_INST=0
1> /DWIN32=100
1> /D_NT1X_=100
1> /DWINNT=1
1> /D_WIN32_WINNT=0x0601
1> /DWINVER=0x0601
1> /D_WIN32_IE=0x0800
1>
1>
1>
1> /DWIN32_LEAN_AND_MEAN=1
1>
1> /DDEVL=1
1> /DDBG=1
1> /D__BUILDMACHINE__=WinDDK
1> /DFPO=0
1>
1>
1> /D_DLL=1
1> /DNDEBUG
1>
1> /DDEPRECATE_DDK_FUNCTIONS=1
1> /DMSC_NOOPT
1> /DNTDDI_VERSION=0x06010000
1>
1>
1>
1>
1> /c
1> /Zc:wchar_t-
1> /Zl
1> /Zp8
1> /Gy
1> /Gm-
1> -cbstring
1> /W3
1>
1> /Gz
1>
1>
1> /hotpatch
1> /EHs-c-
1>
1> /GR-
1> /GF
1> /GS
1> /Zi
1> /Od
1> /Oi
1>
1>
1> /Oy-
1> /Zi
1> /Fdc:\docume~1\nick\桌面\first\driver1\driver1\objchk_win7_x86\i386\
1>
1>
1> /DKMDF_MAJOR_VERSION_STRING=01
1> /DKMDF_MINOR_VERSION_STRING=009
1> /wd4603
1> /wd4627
1> /typedil-
1> /FIC:\WinDDK\760016~1.0\inc\api\warning.h
1>
1>
1>
1>
1>
1> .\driver1.cpp
1>driver1.cpp
1>Microsoft (R) Incremental Linker Version 9.00.30729.207
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>/MERGE:_PAGE=PAGE
1>/MERGE:_TEXT=.text
1>/SECTION:INIT,d
1>/OPT:REF
1>/OPT:ICF
1>/IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221
1>/INCREMENTAL:NO
1>/release
1>/NODEFAULTLIB
1>/WX
1>/debug
1>/debugtype:cv,fixup,pdata
1>/version:6.1
1>/osversion:6.1
1>/functionpadmin:5
1>/safeseh
1>/pdbcompress
1>/STACK:0x40000,0x1000
1>/driver
1>/base:0x10000
1>/subsystem:native,6.01
1>/entry:GsDriverEntry@8
1>/out:c:\docume~1\nick\桌面\first\driver1\driver1\objchk_win7_x86\i386\Driver1.sys
1>c:\docume~1\nick\桌面\first\driver1\driver1\objchk_win7_x86\i386\drvversion.res
1>c:\docume~1\nick\桌面\first\driver1\driver1\objchk_win7_x86\i386\driver1.obj
1>C:\WinDDK\760016~1.0\lib\win7\i386\BufferOverflowK.lib
1>C:\WinDDK\760016~1.0\lib\win7\i386\ntoskrnl.lib
1>C:\WinDDK\760016~1.0\lib\win7\i386\hal.lib
1>C:\WinDDK\760016~1.0\lib\win7\i386\wmilib.lib
1>DDKBLD: The PREfast logfile is "PREfast_defects_chk_win7_x86.xml"!
1>DDKBLD: Build complete
1>DDKBLD: Building browse information files
1>DDKBLD: >> Performing post-build steps [ddkpostbld.cmd] ...
1>DDKBLD: << Finished post-build steps [ddkpostbld.cmd] ...
1>生成日志保存在“file://c:\Documents and Settings\nick\桌面\first\Driver1\Driver1\BuildLog.htm”
1>Driver1.WXP - 0 个错误,0 个警告
========== 生成: 1 已成功, 0 已失败, 0 最新, 0 已跳过 ==========
生成的文件“c:\docume~1\nick\桌面\first\driver1\driver1\objchk_win7_x86\i386\Driver1.sys
”
这个不管的,照样用,关键看你使用ddkwizard生成项目的时候选择了什么ddk
在vs里面编辑 然后用ddk命令行直接build就行了 方便的很 用vs编译很容易出错
1.DDKDDKWizard和ddkbuild.bat,ddkbuild.cmd还没有同步更新完.现在下载最新的1.30版就可以了.
2.你用的是WDK 7.0, 在环境变量设定时要设定 W7BASE 这个变量值.
3.在新建项目时,要选择你使用的WDK或者DDK版本,当然选择Windows7/Windows 2008 R2那个.
4.在Solution Configuration选框中, 选定 "W7 XP *" 其中的一个. [*代表checked, free, checked(PRE fast)]
5.编译,就生成XP的相关驱动文件了.
附注:
安装什么样的DDK或WDK,就设定相应的环境变量.(不要按你想开发驱动的目标平台来设定)
(这是正确答案,把分全给我:P)
那是因为装的是wdk7,默认win7系统,找到wdk安装目录bin文件夹下的setenv.bat文件,找到下面内容
set _FreeBuild=true
set _IA64bit=false
set _AMD64bit=false
set _BscMake=FALSE
set _RunOacr=TRUE
set _VersionedHeaders=TRUE
set _LatestOsTarget=WIN7
set RAZZLETOOLPATH=%BASEDIR%\Bin
set separate_object_root=FALSE
set DDK_TARGET_OS=Win7
改成下面:
set _FreeBuild=true
set _IA64bit=false
set _AMD64bit=false
set _BscMake=FALSE
set _RunOacr=TRUE
set _VersionedHeaders=TRUE
set _LatestOsTarget=WINXP
set RAZZLETOOLPATH=%BASEDIR%\Bin
set separate_object_root=FALSE
set DDK_TARGET_OS=WinXP
你再编译一下就好了,其实只是驱动外面的文件夹名字不对头,里面的驱动是xp的
顶7楼,说的太实用了,嘿嘿,我明白了,哈哈,现在一切正常了,嘿嘿
引用: 引用 8 楼 hellward 的回复:
那是因为装的是wdk7,默认win7系统,找到wdk安装目录bin文件夹下的setenv.bat文件,找到下面内容
set _FreeBuild=true
set _IA64bit=false
set _AMD64bit=false
set _BscMake=FALSE
set _RunOacr=TRUE
set _VersionedHeaders=TRUE
set _Latest……
8楼说的 估计 对楼主更有用
是build environments 没有修改过来,选择上windows xp 就好了
开始菜单:
|-Windows Driver Kits
|-WDK 7600.16385.1
|-Build Environments
|-Windows 7
|-Windows Server 2003
|-Windows Vista and Windows Server 2008
|-Windows XP