我知道ddk的例子可以在ddk的环境下编译.
ddk的例子程序怎样在vc下编译?

解决方案 »

  1.   

    先配置好编译环境,Tools->Options->Directories,添加DDK的include、lib等目录。
    新建一个VC项目,然后往WorkSpace里面添加例子程序的文件,编译就可以了
      

  2.   

    添加DDK的include、lib等目录,然后编译就是了
      

  3.   

    安装driverstudio,用它的source to vcproject转换工具转换source文件,然后就可以编译了。
      

  4.   

    如何开发winnt下的驱动,ddk的使用和vc这样结合?  
    能在那里找到与驱动开发有关的资料。最好是详细一点。  
    ---------------------------------------------------------------  
     
    http://www.driverdevelop.com/index.php  
     
    驱动开发网,里面的论坛非常不错,你可以看看  
    ---------------------------------------------------------------  
     
    在vc的tools-->options...中设置ddk的标准路经即可,当然了最好把ddk的头文件路径放在第一个位置,至于驱动开发,可以到driverdevelop驱动网上找资料  
    ---------------------------------------------------------------  
     
    装一个driver  studio和vc配合使用,非常方便.  
    ---------------------------------------------------------------  
     
    现在谁还用WINNT??  
    我介绍一下我在WIN2000下开发驱动的方法。  
     
    在vc的tools-->options...中设置ddk的标准路经即可,当然了最好把ddk的头文件路径放在第一个位置,至于驱动开发,可以到driverdevelop驱动网上找资料  
    ========================================================  
    这样不行,还需要设置很多环进变量,即便如此,还是无法使用  
     
    装一个driver  studio和vc配合使用,非常方便.  
    ===========================================  
    但是这样编写DDK的例子可能还是有些问题的  
     
     
    我介绍一些在WIN2000SP4+2000DDK+VC6SP6环境用VC6编译DDK的例子  
    1  用makefile方法编译,首先编写makefile文件,假设为build.bat下面是makefile内容“//”为注释不要加入文件  
     
    @echo  off  
    echo  Function  :  开始2000DDK编译环境设置并编译WDM  Driver  File  
    echo  on  
    call  F:\NTDDK\bin\setenv.bat  F:\NTDDK  checked  //打开编译器环境设置  
    f:  
    cd  F:\编程开发\驱动开发\我的作品\filedisk\2003-04-30_FILESRC\sys  //转到自己代码目录文件夹  
    build  -b  -w  -nmake  /a//编译连接按照你的要求来  
     
    2  用VC6建立DDK代码工程,file->new->projects->makefile,现在好DDK例子所在目录,下一步makefile  step1-2对话框  Commandline填写build.bat完成,然后在tool->options->Directories->Executable  files添加build.bat文件夹,  
     
    3  编译连接,大功告成  
     
    用这种方法就可以用VC6来编写驱动,用DDK自己的编译器编译程序在VC的OUTPUT栏中察看编译信息,并根据提示可修改代码,这样基本上就能把VC6和DDK融为一体了  
     
    下面是BUILD的命令说明  
     
    F:\NTDDK>build  /?  
    BUILD:  Object  root  set  to:  ==>  objfre  
    BUILD:  /i  switch  ignored  
     
    BUILD:  Version  4.03.2134  
     
    Usage:  BUILD  [-?]  display  this  message  
                   [-3]  same  as  -Z  but  will  add  a  third  pass  zero  pass  
                   [-a]  allows  synchronized  blocks  and  drains  during  link  pass  
                   [-b]  displays  full  error  message  text  (doesn't  truncate)  
                   [-c]  deletes  all  object  files  
                   [-C]  deletes  all  .lib  files  only  
                   [-D]  check  dependencies  before  building  (on  by  default  if  BUILD_PRODUCT  
    !=  NT)  
                   [-e]  generates  build.log,  build.wrn  &  build.err  files  
                   [-E]  always  keep  the  log/wrn/err  files  (use  with  -z)  
                   [-f]  force  rescan  of  all  source  and  include  files  
                   [-F]  when  displaying  errors/warnings  to  stdout,  print  the  full  path  
                   [-G]  enables  target  specific  dirs  files  iff  one  target  
                   [-i]  ignore  extraneous  compiler  warning  messages  
                   [-I]  do  not  display  thread  index  if  multiprocessor  build  
                   [-k]  keep  (don't  delete)  out-of-date  targets  
                   [-l]  link  only,  no  compiles  
                   [-L]  compile  only,  no  link  phase  
                   [-m]  run  build  in  the  idle  priority  class  
                   [-M  [n]]  Multiprocessor  build  (for  MP  machines)  
                   [-o]  display  out-of-date  files  
                   [-O]  generate  obj\_objects.mac  file  for  current  directory  
                   [-p]  pause'  before  compile  and  link  phases  
                   [-P]  Print  elapsed  time  after  every  directory  
                   [-q]  query  only,  don't  run  NMAKE  
                   [-r  dirPath]  restarts  clean  build  at  specified  directory  path  
                   [-s]  display  status  line  at  top  of  display  
                   [-S]  display  status  line  with  include  file  line  counts  
                   [-t]  display  the  first  level  of  the  dependency  tree  
                   [-T]  display  the  complete  dependency  tree  
                   [-$]  display  the  complete  dependency  tree  hierarchically  
                   [-u]  display  unused  BUILD_OPTIONS  
                   [-v]  enable  include  file  version  checking  
                   [-w]  show  warnings  on  screen  
                   [-y]  show  files  scanned  
                   [-z]  no  dependency  checking  or  scanning  of  source  files  -  
                                   one  pass  compile/link  
                   [-Z]  no  dependency  checking  or  scanning  of  source  files  -  
                                   two  passes  
                   [-why]  list  reasons  for  building  targets  
     
                   [-all]  same  as  -386,  -axp64,  -alpha,  and  -ia64  
                   [-alpha]  build  targets  for  alpha  
                   [-axp64]  build  targets  for  axp64  
                   [-386]  build  targets  for  i386  
                   [-ia64]  build  targets  for  IA64  
     
                   [-x  filename]  exclude  include  file  from  dependency  checks  
                   [-j  filename]  use  'filename'  as  the  name  for  log  files  
                   [-nmake  arg]  argument  to  pass  to  NMAKE  
                   [-clean]  equivalent  to  '-nmake  clean'  
                   Non-switch  parameters  specify  additional  source  directories  
    BUILD:  Done  
     
     
    ---------------------------------------------------------------  
     
    安装driverstudio,有一个source  to  dsp  converter。把source文件生成dsp和dsw文件,在vc里头编辑。用driverstudio菜单下的build  with  ddk  BUILD.exe  进行编译。  
    书推荐《Programming  windows  driver  model》。网上有中文版,最最经典的驱动入门书籍。虽然windows  nt不是用wdm,但是windows  nt/2000系列的驱动都是非常类似,windows  nt用的是kdm,Kernel  Driver  Model,和WDM相比,仅仅是去掉了电源管理和pnp,其他的,一样。