你装了VC6.0 直接安装wdk,通过开始里面的建立项目来建立驱动,附件中打包了wdk7600。最新版还要新,如果觉得麻烦,直接装个VS,在安装的时候直接勾选上驱动开发相关的即可。没有什么要过多设置的。
1、安装VS2010,安装WDK7.0(DDK)2、新建VC++->EmptyProject3、打开ConfigurationManager并新建一个名称为“dirver”的SolutionConfiguration并将“dirver”设为ActiveSolutionConfiguration.4、打开View->propertyManager。5、在"dirver"solutionconfiguration上点击右键,选择AddnewpropertySheet。取名为“dirverProperty”.并对他进下以下设置。5.1.C\C++-General-DebugInformationFormat=ProgramDatabase(/Zi)5.2.C\C++-Preprocessor-PreprocessorDefinitions=_X86_[addalsoDBGforDebugconfig]【WIN32_DEBUG_X86_i386STD_CALLCONDITION_HANDLINGWIN32_LEAN_AND_MEANNT_UPSRVDBGDBG_IDWBUILD_WIN32_WINNT=0x0400%(PreprocessorDefinitions)】5.3.C\C++-CodeGeneration-EnableC++Exceptions=No5.4.C\C++-CodeGeneration-BasicRuntimeChecks=Default5.5.C\C++-CodeGeneration-BufferSecurityCheck=No(/GS-)5.6.C\C++-Advanced-CallingConvention=__stdcall(/Gz)5.7.C\C++-Advanced-CompileAs=CompileasCCode(/TC)[ifyouaregoingtouseplainC]5.8.Linker-General-OutputFile=$(OutDir)\$(ProjectName).sys5.9.Linker-General-EnableIncrementalLinking=Default5.10.Linker-Input-AdditionalDependencies=ntoskrnl.libhal.lib$(NOINHERIT)[addhereneededlibsheree.g.ntoskrnl.libhal.lib]【不知道上面是不是笔误,应该为:ntoskrnl.libhal.lib%(AdditionalDependencies)】5.11.Linker-Input-IgnoreAllDefaultLibraries=Yes(/NODEFAULTLIB)5.12.Linker-ManifestFile-GenerateManifest=No5.13.Linker-System-SubSystem=Native(/SUBSYSTEM:NATIVE)5.14.Linker-System-Driver=Driver(/DRIVER)5.15.Linker-Advanced-EntryPoint=DriverEntry5.16.Linker-Advanced-BaseAddress=0x100005.17.Linker-Advanced-RandomizedBaseAddress=Disable(/DYNAMICBASE:NO)【这个也是错误的:应该置空】5.18.Linker-Advanced-DataExecutionPrevention(DEP)=Disable(/NXCOMPAT:NO)【这个也是错误的:应该置空】6.ConfigVC++Directories6.1OpenOpenuppropertymanagerbyclickingonMenuView->PropertyManager.6.2ExpandtheprojectnodeandthentheConfiguration|Platformnodes,youwillsee"Microsoft.cpp..users"fileforeachConfiguration|Platform.Thesearethefilesfortheglobalsettings,similartotheoldtools/Options/VC++Directories.6.3Multi-Select"Microsoft.cpp..users",rightclickandbringupthepropertypagewindow6.4Inthepropertypagewindow,clickon"VC++Directories"(forexample)intheleftpane,addnewpathsforthedirectoriessuchas"IncludeDirectories".separatedbysemicolons(eg:IncludeDirectoriesconfigAs:$(ddkroot)\INC$(ddkroot)\INC\WNET$(ddkroot)\INC\DDK\WNETLibraryDirectoriesconfigAs:$(ddkroot)\LIB\WNET\I386)6.5MakesuretosavethesettingsbeforeshuttingdownVisualStudio.6.6Re-launchVisualStudioandthenewsettingswillbeineffect.6.7Note:Ifyouwouldliketoonlychangethesettingsforoneproject,youcanrightclickontheprojectandbringupthepropertypage.Changethesettingsfor“VC++Directories”,thesesettingswillbepersistedtotheprojectfile.七.OK.Havedone.Nowyoucantestitwithsimplecode,e.g.:#include"ntddk.h"NTSTATUSDriverEntry(PDRIVER_OBJECTDriverObject,PUNICODE_STRINGRegistryPath){returnSTATUS_UNSUCCESSFUL}特别说明:1.VisualStudio2010在智能设备开发方面只支持WindowsPhoneOS7.0。如果你要为WindowsCE5.0和WindowsMobile6.5开发应用程序,请安装VisualStudio2008。2.做驱动开发时,SDK的版本要和WDK的版本一致,即Win7WDK要配Win7SDK,否则会出现编译错误。VS2010里集成了WindowsSDK7.0A。3.如果出现类似如下编译错误,解决方法是:拷贝C:\ProgramFiles(x86)\MicrosoftVisualStudio10.0\VC\include\sal.h,然后覆盖掉C:\WinDDK\7600.16385.1\inc\api\sal.h。C:\ProgramFiles\MicrosoftVisualStudio10.0\VC\include\crtdefs.h(550):errorC2143:syntaxerror:missing')'before'const'C:\ProgramFiles\MicrosoftVisualStudio10.0\VC\include\crtdefs.h(550):errorC2143:syntaxerror:missing'{'before'const'.欢迎分享,转载请注明来源:内存溢出
评论列表(0条)