Windows 7 configuration-driven development environment (using WDK)

Source: Internet
Author: User

1. Install VS2010; Download the WDK (the early DDK), unzip the installation (grmwdk_en_7600_1);

2. Create an empty project in VS2010, the project can be named "Driver";

3. Configure the solution to add a configuration scheme called driver;


4. Configure engineering properties;



This time you need to enter the installation path of your own WDK, mine is this:

Executable directory: G:\WinDDK\7600.16385.1\bin\x86

contains files (3): G:\WinDDK\7600.16385.1\inc \api

G:\WinDDK\7600.16385.1\inc\CRT

G:\WinDDK\7600.16385.1\inc\ddk

Library Catalog: G:\WinDDK\7600.16385.1\lib\win7\i386

5. Create a new C + + file;

6. Set the project Properties ;


General: Target file name extension. sys

C + + drop-down menu:

preprocessor  
Preprocessor definition: win32=100;_x86_=1; winver=0x501;dbg=1         //required  

advanced  
     calling convention   __stdcall (/gz)                                          //Required  

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

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)


Among the linker:


General
To enable incremental linking:No (/incremental:no)//Recommended selection
Ignore import library: Yes// optional
(When set to this value, you must add the following in the additional library directory:G:\WinDDK\7600.16385.1\lib\win7\i386the project will 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: is a (/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)//Must be selected
Stack Reserve Size: 4194304//Optional
Stack Commit size: 4096//optional
drivers: Drivers (/driver)//Required
      

Advanced: 
    Entry point: DriverEntry//Must be selected
Random Base:Clear           //Erase the data in the box. (yes, no no no, it's not a clean text box.)//Must be selected
    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): Clear //Must be selected
Otherwise it will appear e:\xxx.sys:fatal error LNK1295: "/nxcompat:no" and "/driver" specification are incompatible; links do not use "/nxcompat:no"

      setting effect and: Yes (/release)                                //Optional

      Base address: 0x10000                                              //Suggest   
&NBSP;&NBSP;&NBSP;&NBSP;
&NBSP; command line:

/section:init,d/ignore:4078 (recommended not to write in, will error!) )

Test code:


#include "Ntddk.h"

NTSTATUS
DriverEntry (Pdriver_object driverobject,punicode_string Registrypath)
{
return status_unsuccessful;
}

Reference documents:

Http://www.cnblogs.com/xlhblog/archive/2011/03/22/1991785.html

Http://www.cppblog.com/guojingjia2006/archive/2011/03/19/142211.html




Windows 7 configuration-driven development environment (using WDK)

Related Article

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.