C++--How to configure Visual Studio for compiling drivers
2008-12-19 09:28
323 查看
1. Setup Visual Studio 2008
2. Setup DDK (WDK)
3. Add to VS pathes to DDK include files, libs and bins.
4. Create new empty "Win32 project" and add source file (i.e. HelloWorld.c).
5. Configure project properties (All Configurations)
5.17. Linker - Advanced - Randomized Base Address = Disable (/DYNAMICBASE:NO)
5.18. Linker - Advanced - Data Execution Prevention (DEP) = Disable (/NXCOMPAT:NO)[/code]
6. OK. Have done. Now you can test it with simple code, e.g.:
2. Setup DDK (WDK)
3. Add to VS pathes to DDK include files, libs and bins.
4. Create new empty "Win32 project" and add source file (i.e. HelloWorld.c).
5. Configure project properties (All Configurations)
5.1. C/C++ - General - Debug Information Format = Program Database (/Zi)
5.2. C/C++ - Preprocessor - Preprocessor Definitions = _X86_ [add also DBG for Debug config]
5.3. C/C++ - Code Generation - Enable C++ Exceptions = No
5.4. C/C++ - Code Generation - Basic Runtime Checks = Default
5.5. C/C++ - Code Generation - Buffer Security Check = No (/GS-)
5.6. C/C++ - Advanced - Calling Convention = __stdcall (/Gz)
5.7. C/C++ - Advanced - Compile As = Compile as C Code (/TC) [if you are going to use plain C]
5.8. Linker - General - Output File = $(OutDir)/$(ProjectName).sys
5.9. Linker - General - Enable Incremental Linking = Default
5.10. Linker - Input - Additional Dependencies = ntoskrnl.lib hal.lib $(NOINHERIT) [add here needed libs here e.g. ntoskrnl.lib hal.lib]
5.11. Linker - Input - Ignore All Default Libraries = Yes (/NODEFAULTLIB)
5.12. Linker - Manifest File - Generate Manifest = No
5.13. Linker - System - SubSystem = Native (/SUBSYSTEM:NATIVE)
5.14. Linker - System - Driver = Driver (/DRIVER)
5.15. Linker - Advanced - Entry Point = DriverEntry
5.16. Linker - Advanced - Base Address = 0x10000
5.17. Linker - Advanced - Randomized Base Address = Disable (/DYNAMICBASE:NO)
5.18. Linker - Advanced - Data Execution Prevention (DEP) = Disable (/NXCOMPAT:NO)[/code]
6. OK. Have done. Now you can test it with simple code, e.g.:
#include "ntddk.h" NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath) { return STATUS_UNSUCCESSFUL;
source url: http://www.codeproject.com/KB/winsdk/vs2008_and_drivers.aspx
相关文章推荐
- C++--How to configure Visual Studio for compiling drivers
- C++--How to configure Visual Studio for compiling drivers
- C++--How to configure Visual Studio for compiling drivers
- How to compile a C/C++ DLL for 64 bit with Visual Studio?
- How to build zlib 1.2.3 using Visual Studio 2008 for 32-bit and 64-bit Windows
- How to embed Lua in C++ on Visual Studio
- How to configure and use Git with visual studio 2012 and TFS
- How to get Intellisense for Web.config and App.config in Visual Studio .NET?(转载)
- How to synhronize source files with Visual Studio for team work
- How to compile the IJG JPEG library (libjpeg) for Visual Studio 2010
- [转]How to Create HTML5 Website and Page Templates for Visual Studio 2010
- How to build an OLE DB application for SQL Server CE in Visual Studio 2005
- How To Customize the Development Environment for Visual Studio 2005 Express Editions
- How to debug c++ console application with argument in visual studio 2012
- How to Assign Visual Studio Shortcut for GhostDoc
- How to use Intel C++ Compiler in Visual Studio 2008
- How to set pycharm configure for remoting development
- Configure the Visual Studio Tools for Apache Cordova
- How to Configure Eclipse for Python --- 在eclipse中如何配置pydev
- How to Enable USB-Debugging with Nexus 5 for Android Studio