VS2010 DDK编译驱动程序环境配置详细步骤
首先,建立一个文件,内容如下:
将内容里的 “D:\WinDDK”替换你的DDK安装路径
<?xml version="1.0"encoding="utf-8"?>
<Project ToolsVersion="4.0"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>D:\WinDDK\bin\x86;$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup>
<IncludePath>D:\WinDDK\inc\crt;D:\WinDDK\inc\api;D:\WinDDK\inc\ddk;$(IncludePath)</IncludePath>
<TargetExt>.sys</TargetExt>
<LibraryPath>D:\WinDDK\lib\wxp\i386;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WIN32=100;_X86_=1;WINVER=0x501;DBG=1</PreprocessorDefinitions>
<CallingConvention>StdCall</CallingConvention>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ntoskrnl.lib;Hal.lib;wdm.lib;wdmsec.lib;wmilib.lib;ndis.lib;MSVCRT.LIB;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Link>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EnableUAC>false</EnableUAC>
<SubSystem>Console</SubSystem>
<Driver>Driver</Driver>
<EntryPointSymbol>DriverEntry</EntryPointSymbol>
<RandomizedBaseAddress>
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
文件的后缀为:“.props”
打开VS2010
新建一个控制台的空文件工程
右键项目—>属性
选择 配置管理器
新建一个配置(此处已经建好了“Driver”)
名字自拟,命名后确定即可。
打开“属性管理器”
选中“Driver”,右键 “添加现有属性表”
再弹出的对话框,选择刚才的“.props”文件即可。
添加简单代码:
(直接粘贴过来,注释中文都乱码了,截图了只好,代码是全的)
看生成的驱动文件如下图: