vigny 发表于 2013-9-12 01:52:12

编译驱动出现错误,请各位帮忙看下!

我是Windows 7 64位操作系统 开发环境为VS2008 +DKK
今天安装了一个ddkbuild
编译的时候出现

1>------ 已启动全部重新生成: 项目: Driver.W7, 配置: W7 checked (PREfast) Win32 ------
1>正在执行生成文件项目操作
1>OSR DDKBUILD.CMD V7.4/r60 (2009-11-28) - OSR, Open Systems Resources, Inc.
1>DDKBLD: ERROR #3: To build using type W7 you need to set the %W7BASE% environment variable to point to the Windows 7/Windows 2008 Server R2 DDK base directory!
1>USAGE:
1>======
1>ddkbuild <target> <build type> <directory> [-WDF] [-PREFAST] [-CUV]
1>Values for <target>:
1>   ---------------------------------------------------------------------------
1>    Target OS version and architecture| Miscellaneous
1>   -------------------------------------|-------------------------------------
1>    <target>    | Windows   | CPU   | Base directory | <target> alias(es)
1>   -------------|-------------|---------|----------------|--------------------
1>    -NT4      | NT 4.0      | x86   | %NT4BASE%      |
1>    -W2K      | 2000      | x86   | %W2KBASE%      |
1>    -W2K64      | 2000      | Itanium | %W2KBASE%      | -W2KI64
1>    -WXP      | XP          | x86   | %WXPBASE%      | -XP
1>    -WXP64      | XP          | Itanium | %WXPBASE%      | -WXPI64, -XP64
1>    -WXP2K      | 2000      | x86   | %WXPBASE%      | -XPW2K
1>    -WNET       | 2003      | x86   | %WNETBASE%   |
1>    -WNET64   | 2003      | Itanium | %WNETBASE%   | -WNETI64
1>    -WNETXP   | XP          | x86   | %WNETBASE%   |
1>    -WNETXP64   | XP          | Itanium | %WNETBASE%   |
1>    -WNETAMD64| 2003/XP x64 | x64   | %WNETBASE%   | -WNETX64, -WNETA64
1>    -WNET2K   | 2000 SP3    | x86   | %WNETBASE%   | -WNETW2K
1>    -WLH      | Vista/2008| x86   | %WLHBASE%      |
1>    -WLH2K      | 2000 SP4    | x86   | %WLHBASE%      |
1>    -WLHXP      | XP          | x86   | %WLHBASE%      |
1>    -WLHXP64    | XP          | Itanium | %WLHBASE%      |
1>    -WLHNET   | 2003      | x86   | %WLHBASE%      |
1>    -WLHNETI64| 2003      | Itanium | %WLHBASE%      | -WLHNET64
1>    -WLHNETX64| 2003/XP x64 | x64   | %WLHBASE%      | -WLHNETA64
1>    -WLHI64   | Vista/2008| Itanium | %WLHBASE%      | -WLH64
1>    -WLHX64   | Vista/2008| x64   | %WLHBASE%      | -WLHA64
1>    -W7         | 7/2008 R2   | x86   | %W7BASE%       | -WIN7
1>    -W7I64      | 7/2008 R2   | Itanium | %W7BASE%       | -WIN764
1>    -W7X64      | 7/2008 R2   | x64   | %W7BASE%       | -WIN7A64
1>    -W7LH       | Vista/2008| x86   | %W7BASE%       | -WIN7WLH
1>    -W7LHI64    | Vista/2008| Itanium | %W7BASE%       | -WIN7WLH64
1>    -W7LHX64    | Vista/2008| x64   | %W7BASE%       | -WIN7WLHA64
1>    -W7NET      | 2003      | x86   | %W7BASE%       | -WIN7NET
1>    -W7NETI64   | 2003      | Itanium | %W7BASE%       | -WIN7NET64
1>    -W7NETX64   | 2003/XP x64 | x64   | %W7BASE%       | -WIN7NETA64
1>    -W7XP       | XP          | x86   | %W7BASE%       | -WIN7XP
1>   ---------------------------------------------------------------------------
1>    Support for NT4 and W2K DDKs is deprecated and not checked anymore
1>    in new versions. It may or may not work properly.
1>   ---------------------------------------------------------------------------
1>Values for <build type>:
1>      checked, chk   indicates a checked build
1>      free, fre      indicates a free build
1>Remaining parameters (all optional):
1>      <directory>      path to build directory, try . (current directory)
1>                any flags you think should be passed to build (try /a
1>                     for clean)
1>      -WDF             performs a WDF build
1>      -PREFAST         performs a PREFAST build
1>      -CUV             uses the Call Usage Verifier, implies a PREFAST build
1>Special files:
1>      The build target directory (where the DIRS or SOURCES file resides) can
1>      contain the following files:
1>      - ddkprebld.cmd
1>      Allows to include a step before the BUILD tool from the DDK is called
1>      but after the environment for the respective DDK has been set!
1>      - ddkpostbld.cmd
1>      Allows to include a step after the BUILD tool from the DDK is called,
1>      so the environment is still available to the script.
1>      - ddkbldenv.cmd
1>      Allows to set (or override) _any_ environment variables that may exist
1>      in the global environment. Thus you can set the base directory for the
1>      DDK from inside this script, making your project more self-contained.
1>      DDKBUILD will only handle those files which exist, so you may choose to
1>      use none, one or multiple of these script files.
1>      (All scripts execute inside their current directory. Consider this!)
1>Examples:
1>      "ddkbuild -NT4 checked ." (for NT4 BUILD)
1>      "ddkbuild -WXP64 chk ."
1>      "ddkbuild -WXP chk c:\projects\myproject"
1>      "ddkbuild -WNET64 chk ."      (IA64 build)
1>      "ddkbuild -WNETAMD64 chk ."   (AMD64/EM64T build)
1>      "ddkbuild -WNETXP chk . -cZ -WDF"
1>      "ddkbuild -WNETXP chk . -cZ -PREFAST"
1>      In order for this procedure to work correctly for each platform, it
1>      requires an environment variable to be set up for certain platforms.
1>      There is an auto-detection mechanism in this script, which will work best
1>      if the DDK/WDK was installed using the normal installer (i.e. not just
1>      copied). The auto-detection is based on the DDK/WDK for which you request
1>      a build. Whenever you set the variable explicitly, this will take
1>      precedence over the auto-detected path!
1>      The environment variables are as follows:
1>      %NT4BASE%- Set this up for "-NT4" builds
1>      %W2KBASE%- Set this up for "-W2K" and "-W2K64" builds
1>      %WXPBASE%- Set this up for "-WXP", "-WXP64", "-WXP2K" builds
1>      %WNETBASE% - Set this up for "-WNET*" builds
1>      %WLHBASE%- Set this up for "-WLH*" builds
1>      %W7BASE%   - Set this up for "-W7*" builds
1>      %WDF_ROOT% must be set if attempting to do a WDF Build previous to the
1>      Vista WDK (in later DDKs there is no need to set WDF_ROOT).
1>Path to this script:
1>   C:\WinDDK\ddkbuild.cmd
1>OSR DDKBUILD.CMD V7.4/r60 (2009-11-28) - OSR, Open Systems Resources, Inc.
1>-> report any problems to <info@osr.com> or <http://assarbad.net/contact/>
1>项目 : error PRJ0002 : 错误的结果 3 (从“C:\Windows\SysWow64\cmd.exe”返回)。
1>生成日志保存在“file://m:\项目源码\Driver\Driver\BuildLog.htm”
1>Driver.W7 - 1 个错误,0 个警告
========== 全部重新生成: 成功 0 个,失败 1 个,跳过 0 个 ==========


请问如何解决?

Tesla.Angela 发表于 2013-9-12 09:45:52

编译X64驱动要用WDK。
打开WDK(WIN7 X64 FREE),切换到源码所在目录,然后输入BUILD就可以编译了。

vigny 发表于 2013-9-12 13:12:12

本帖最后由 vigny 于 2013-9-12 20:59 编辑

问题已经解决,设置下系统环境变量即可
如图


还有编译成功无法获得生成出来的SYS文件的解决方法

在新建Driver Object的时候,不要选“create PREfast configuration”这个选项

Tesla.Angela 发表于 2013-10-15 23:52:06

这一个月LZ进步很快。。。
页: [1]
查看完整版本: 编译驱动出现错误,请各位帮忙看下!