VS2010 Configuring the Drive environment

Source: Internet
Author: User

Reprinted from Http://www.cppblog.com/guojingjia2006/archive/2011/03/19/142211.htmlWinDDK

http://www.microsoft.com/en-us/download/confirmation.aspx?id=11800, the link can go down to everything that the WDK needs, including related tools, sample code, documentation, and so on.

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. Configuration executable directory: e:\ source code \winddk\bin\x86;
B. Configuration include directory: E:\ source \WINDDK\INC\DDK
E:\ Source \winddk\inc\crt
E:\ Source \winddk\inc\api
C. Configuration Library Directory: e:\ source code \winddk\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)
Senior
calling convention __stdcall (/GZ)//Required

7.  linker settings  
General  
     enable incremental link: no (/incremental:no)                             //recommended  
     ignore import library: Yes                                                     //optional   
     (When set to this value, Must be added in the additional library directory: E:\ source \winddk\lib\win7\i386  This project will not rely on the IDE environment settings)  

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"

Debugging:
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            // Delete the data in the box. (Yes, no, no, not either.)   //required  
    the   e:\xxx.sys:fatal error LNK1295 appears:  
"/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!

VS2010 Configuring the Drive environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.