1. Installing vs2010,wdk7.60 (grmwdk_en_7600_1)
2. Create a new VC console project (select Empty Project)
3. New project Configuration "Driver", click the drop-down button-click (Configuration Manager)
Enter the name (driver) Click OK, the others do not move Oh!
The effect after the completion!
Click the OK button to render the screen.
Right-click the new driver property and the following window will pop up!
4. Set VC + + path
< I installed the WDK under the E-drive >
A. Configuring the executable directory: E:\WinDDK\7600.16385.1\bin\x86;
B. Configuration include directory: E:\WINDDK\7600.16385.1\INC\DDK
E:\WinDDK\7600.16385.1\inc\crt
E:\WinDDK\7600.16385.1\inc\api
C. Configuration Library Directory: E:\WinDDK\7600.16385.1\lib\win7\i386
Create a new/C + + file or no C + + Setup options
< at first we created an empty project so there is no C + + file in the project, so now is the empty project-source file-Add a new item C + + File >
Conventional
Target file extension:. SYS//Required
6. Setting up C + + options
General Tab
1 Debug Information Format (C7 compatible (/z7)//optional
2 Warning Level (Level 2 (/W2)//optional
3 Treat Warnings as errors (yes (/WX)//optional
Optimization tab
Optimization (disable/od)//optional
Preprocessor
Preprocessor definition: win32=100;_x86_=1; Winver=0x501;dbg=1//Required
code Generation
Enable Minimal rebuild: no//optional
Basic run-time check: Default//Optional
Run-Time Library: Multithreaded debugging (/MTD) or multithreaded (/MT)//Recommended< I chose multi-threaded debugging (/MTD) >
Buffer Security Check: no//optional
(Avoid Link:error LNK2001: Unable to resolve external symbol __security_cookie)
Advanced
calling convention __stdcall (/GZ)//Required
7. Linker settings
General
Enable incremental linking: No (/INCREMENTAL:NO)//Recommended selection
Ignore import library: Yes//optional
(When set to this value, you must add: E:\WinDDK\7600.16385.1\lib\win7\i3865 in the additional library directory so that the project does not depend on the settings of the IDE environment)
If no (setting this value will depend on the settings of the IDE's environment)
input
Additional Dependencies
Ntoskrnl.lib; Hal.lib;wdm.lib;wdmsec.lib;wmilib.lib;ndis.lib; MSVCRT. LIB; LIBCMT. LIB//Required
NT-Type drive Ntoskrnl.lib WDM-Drive Wdm.lib
(Halxxx function in Hal.lib, wmixxx function in Wmilib.lib, ndisxxx function in Ndis.lib)
(You need to add Microsoft's standard library MSVCRT if necessary.) LIB MSVCRTD. LIB (Debug library) LIBCMT. Libibcmtd. LIB (Debug library))
(If there is a source file in the source, the Targetlibs field of the file will list the required libraries for that project)
Ignore all default libraries: Yes (/NODEFAULTLIB)//Required
manifest file :
Enable user Account Control (UAC) no//required
Otherwise it will appear >link:fatal error LNK1295: "/manifestuac" and "/driver" specification are incompatible; links do not use "/manifestuac"
Debug:
Generate Debug Information Yes (/DEBUG)//optional
Build image file: Yes (/MAP)//optional
Image file Name: $ (TargetDir) $ (TargetName). Map//optional
Systems (System)
SUBSYSTEM: Console (/subsystem:console)//Required
Stack Reserve Size: 4194304//optional
Stack commit size: 4096//optional
Drivers: Drivers (/driver)//Required
Advanced:
Entry point: driverentry//Required
Random Base: Empty//Erase the data in the box. (yes, no no no, it's not a clean text box.)Must-Choose
Otherwise it will appear e:\xxx.sys:fatal error LNK1295:
"/dynamicbase" is incompatible with the "/driver" specification; "/dynamicbase" is not used when linking
Data Execution Prevention (DEP): Empty// Delete the data in the box. (yes it's not either no nor is it a clean text box) //Required
Otherwise it will appear e:\xxx.sys:fatal error LNK1295:
"/nxcompat:no" is incompatible with the "/driver" specification; "/nxcompat:no" is not used when linking
Set effect and: Yes (/release)//optional
Base Address: 0x10000//Recommended option
command line:/section:init,d/ignore:4078 (recommended not to write in, will error!) )
Finally give a super simple code to test the success of our configuration??
#include "Ntddk.h"
NTSTATUS
DriverEntry (Pdriver_object driverobject,punicode_string Registrypath)
{
return status_unsuccessful;
}
If there is no error then congratulations on your configuration success!
Original address: http://www.cppblog.com/guojingjia2006/archive/2011/03/19/142211.html
I tried it and said it was easy to save.