VS2005+WDK+DriverStudio

来源:互联网 发布:测试性软件teams 编辑:程序博客网 时间:2024/05/02 01:49
配置一个好的开发环境是学习驱动开发的第一步,我在这里介绍一下VS2005+DDK2003+DriverStudio3.2配置过程,我在这里给大家一个step by step的。好了,废话不多说了,让我们开始吧!

step1:
就从下载软件开始吧,VS2005 DDK2003 DriverStudio3.2这几个就不用说了,迅雷上都有下载。 还有两个补丁,分别是:
下载ds3.2.1补丁,按照提示安装
    ftp://ftp.compuware.com/pub/driverstudio/outgoing/patch/DS3.2.1.zip

Host

(1).     Copy the files osinfo.dat and osinfob.dat from the host directory into the following directories.

                    <Install Directory>\Compuware\DriverStudio

                    < Install Directory>\Compuware\DriverStudio\VisualSoftICE

    (2).     Copy the file DS.exe the host directory into the following directory

                    <Install Directory>\Compuware\DriverStudio

 Target

(1).     Copy all the .sys and all the .dat files found in the root of the target directory to the system32\drivers directory.

(2).     Copy the siksym.sys from the appropriate subdirectory (IA64, AMD64 or X86) into the system32 drivers directory. Note: only copy the one that applies to that specific target.


     下载DSDDKEnv.zip补丁,一定按照提示安装注册否则出现错误提示(在一个头文件中出现错误,位置处有WIN...>501类似的文字)
    ftp://ftp.compuware.com/pub/driverstudio/outgoing/patch/DSDDKEnv.zip

  (1)Close all development environment windows.

  (2)Copy the file DSDDKEnv8.dll into the <INSTALL_DIR>\DriverStudio\Common\Bin directory. Select "yes" if prompted to copy over an existing one.

  (3)   Copy the file DSDDKEnv8UI.dll into the <INSTALL_DIR>\DriverStudio\Common\Bin\1033 directory. Select "yes" if prompted to copy over an existing one.

  (4)   Then unregister the older version. Go to start->run and type "regsvr32 -u <INSTALL_DIR>\DriverStudio\Common\Bin\dsddkenv8.dll"

  (5)  Then register the new copy. Go to start->run and type "regsvr32 "<INSTALL_DIR>\DriverStudio\Common\Bin\dsddkenv8.dll"

这里,需要注意的是。<INSTALL_DIR>不能有空格,即DriverStudio不能安装在文件名含空格的

 

文件夹中。

step2:
安装完成后,修改VS2005如下:
在vs2005 ->Tools-> Options ->Projects and solutions -> vc++ Directories ->
     include files 添加 ddk安装目录下的inc文件夹下的 ddk文件夹
     library files 添加   ddk 安装目录下的lib文件夹下的 wxpi386文件夹


step3:
打开DriverStudioDriverWizardTemplates目录的WdmDriver.sln.net文件找到“Microsoft Visual Studio Solution File, Format Version 9.00”这一行,在其后下一行加入“# Visual Studio 2005”保存即可,以后用DriverWizard生成的工程就可以正常双击打开了。
修改后象这样:
...
$$FILE $$ProjectName$$.sln
$$IFDEF GENERATE_SLN2002
Microsoft Visual Studio Solution File, Format Version 7.00
$$ENDIF
$$IFDEF GENERATE_SLN2003
Microsoft Visual Studio Solution File, Format Version 8.00
$$ENDIF
$$IFDEF GENERATE_SLN2005
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
$$ENDIF
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$$ProjectName$$", "Driver$$ProjectName$$.vcproj", "$$ProjectGuid$$"
EndProject

step4:
所有程序-〉compuware DriverStudio->develope->DDK Build Setting
ddk root directory 选择DDK2003安装路径 如 D:WINDDK3790.1218

OK!
当然补丁的安装在补丁中有文档介绍了,照它的操作就好了。
 
PS:
关于Driver Studio 3.2 的安装详解
经过对VC、WINDDK、Driver Studio这三个软件反复的安装,终于可以使Driver Studio能在VC环境下正常编译了。俗话说久病成医,遇到的问题多了,自然就有了很多解决问题的方法,现在拿出来和大家一起分享一下。
1、分别安装VC、WINDDK、Driver Studio,为:VC-〉WINDDK-〉 Driver Studio。其实顺序也可以变一下的,笔者曾试过VC-〉 Driver Studio -〉WINDDK,没问题的,但最好按建议顺序安装;
2、注意安装DDK时,建议将例子等全部安装,否则Driver Studio编译时会提示缺少头文件;
3、在VS2005环境下,安装Driver Studio时会有对话框弹出,单击Ignore按钮,解决办法会在后面详细说明;
4、选择“DriverStudio->DDK Build Setting”,在“DDK Root Directory”选项中选入DDK目录,例如“C:\WINDDK\2600”。为了防止每次启动VC来编译WDM时,都要设置DDK目录,可以在“控制面板”的“系统”-〉“高级”-〉“环境变量E”设置中,添加一个值为C:\WINDDK\2600的系统变量BASEDIR;
5、用VC打开“…\DriverStudio\DriverWorks\source\VdwLibs.dsw”,用 Driver Studio进行编译,如果编译成功就OK了,然后可以进行驱动的开发了。
6、利用DriverWizard向导对所要开发的驱动类型进行正确配置,生成所需要的驱动工程框架。

安装DriverStudio3.2 过程中出现DSDDKEnv8.dll failed to register错误的解决方法 
原因:与VS2005集成时会发生此错误。
解决方法,补丁:ftp://ftp.compuware.com/pub/driverstudio/outgoing/patch/DSDDKEnv.zip
>Extract it into a temp directory. 
>Copy the file DSDDKEnv8.dll into the <INSTALL_DIR>\DriverStudio\Common\Bin directory. 
>Select "yes" if prompted to copy over an existing one. 
>Copy the file DSDDKEnv8UI.dll into the <INSTALL_DIR>\DriverStudio\Common\Bin\1033 directory. Select "yes" if prompted to copy over an existing one. 
>Then unregister the older version 
Go to start->run and type "regsvr32 -u "<INSTALL_DIR> \DriverStudio\Common\ Bin\ dsddkenv8.dll" 
注意〈INSTALL_DIR〉不能含有空格,否则命令无法执行,笔者曾将DriverStudio安装在C:\Program Files下,总是运行不了,为此郁闷了好久,后经别人提点才解决此问题,但不知其原因,请问有人知道吗?>Then register the new copy 
Go to start->run and type "regsvr32 <INSTALL_DIR>\ DriverStudio\ Common\ Bin\ dsddkenv8.dll" 
>DriverStudio menu should now be part of the VisualStudio 2005 menu

如果在vs2005+补丁后生成的解决方案文件.sln无法双击打开工程时可以使用文本编辑器打开.sln文件在第二行加入“# Visual Studio 2005”保存即可,例如:
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aa", "driver\aa.vcproj", "{6A0A9D07-FD4C-4D7C-805D-48D25FB4BE6C}"
EndProject

根治方法:
打开\DriverStudio\DriverWizard\Templates目录的WdmDriver.sln.net文件
找到“Microsoft Visual Studio Solution File, Format Version 9.00”这一行,在其后下一行加入“# Visual Studio 2005”保存即可,以后用DriverWizard生成的工程就可以正常双击打开了。

编译中可能遇到的问题(VS2005环境下)
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
这个错误,解决方法如下:
打开project->BaseClasses properties->configuration->C/C++ ->Command Line,增加/wd4430选项。
NextNode()或其他函数没有返回类型的原因,你的代码可能是从VC++里迁移到VS2005里面来编译出现的错误吧,在VC里你的函数没有返回类型他自动默认为INT,但在VS2005里就要报你上面的错误!