RT,我用的是DDKWizard + VS2008 已经按照要求设置好了WLHBASE和W7BASE环境变量,但是编译的时候还是不对……到底是什么问题啊 …… 
这是结果:1>------ 已启动生成: 项目: Driver1.W7, 配置: W7 checked 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> [flags] [-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>      [flags]          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>     D:\WINDDK\ddkbuild.cmd
1>  OSR DDKBUILD.CMD V7.4/r60 (2009-11-28) - OSR, Open Systems Resources, Inc.
1>  -> report any problems to <[email protected]> or <http://assarbad.net/contact/>
1>项目 : error PRJ0002 : 错误的结果 3 (从“C:\WINDOWS\system32\cmd.exe”返回)。
1>生成日志保存在“file://d:\Projects\Driver1\Driver1\BuildLog.htm”
1>Driver1.W7 - 1 个错误,0 个警告
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
各位帮帮忙啊,高分相送

解决方案 »

  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!貌似你的系统环境变量没有设置正确
      

  2.   

    sources文件中的TARGETTYPE=默认代码、SOURCES=默认为空,须要改为TARGETTYPE=DRIVER、SOURCES=xxx.c 即可成功编译...
      

  3.   

    前提:要将“C:\WinDDK”目录加入“PATH”环境变量。
      

  4.   


    额....因为没在用DDKwizard了 改用vitualDDK ...所以就没解决....
      

  5.   

    在DDKBUILD.CMD里面 找到DetectBaseDirTemp,我设的WLHBASE,我没有看到W7BASE, 由于我的ddk版本是 6001.18001,而这个文件里用的是6000,18001,所以报跟你相同的错误,我把文件里的version改成6001.18001,就ok了,所以你要先确定你的ddk版本,如果是Win7,那么就要设W7BASE,但是原始的DDKBUILD.cmd中没有,就需要你自己添加,方法可以参考WLHBASE:
    set BASEDIROS=Windows Vista/Windows 2008 Server
    set BASEDIRVAR=WLHBASE
    :: Compatibility between BUILD and VS ... prevent pipes from being used
    %OSR_ECHO% Clearing %%VS_UNICODE_OUTPUT%% ...
    set VS_UNICODE_OUTPUT=
    :: Return to caller if the BASEDIR is already defined (either customized or global)
    if DEFINED %BASEDIRVAR% goto :CommonCheckNoErrorWithReturn
    ::call :DetectBaseDirTemp "6001.18000 6000"
    call :DetectBaseDirTemp "6001.18001"
    if DEFINED BASEDIRTEMP if exist "%BASEDIRTEMP%" goto :CommonCheckSetVarWithReturn
    goto :CommonCheckErrorNotSupportedWithReturn
      

  6.   

    我也遇到这个问题了。
    对着网上的各种教程把环境变量设了N多遍,还是没解决。
    最后一怒之下把VS2008关掉再打开,这个问题就解决了,不知道能不能通用,有出现相同问题的朋友可以试一下