VC6.0 + WDK 7600.16385.1 development environment configuration

Before using the VisualDDK very cool, it can be directly used VS to debug, but only supports Visual2005 above, in addition to the flagship version of VS2008 Chinese support is not good, but unfortunately I was forced down a VS2010. Undoubtedly Visual DDK with it is really very cool, at least you can save time configuration environment. In addition, the two-machine debugging with Visual KD, much faster than traditional serial debugging speed up.

Today, would like to use to write the driver code VC6.0, VC6.0, after all, small and flexible point, but nonetheless VisualDDK little support. Well herself to configure the look of the environment. Refer to the online and other articles, combined with their own practice, and finally get understanding.

VC6.0 + WDK 7600.16385.1, here is mainly to develop NT style drivers under XP, I am here mainly to test this, other similar.

 

1. Install good VC6 and WDK, irrespective of the order.

 

From the Start menu, find the program directory WDK (Windows Driver Kits), enter the relevant compilation environment, where select "Windows XP Checked Build Environment", enter the command "build", this time to compile their own WDK you will need about 1 minute .

 

2. VC6 Set Include / Lib / Executable directory.

 

Enter the menu bar -> Project -> Options -> Contents

 

PS: to each his own need to compile a directory of the platform can, Include want to make sure you find ntddk.h etc., Lib and Include correspondence, Executable want to make sure you find cl.exe and so on.

 

For example, set up under XP platform:

"the Include Files" section includes:

D:\WinDDK\7600.16385.1\inc\ddk
D:\WinDDK\7600.16385.1\inc\api
D:\WinDDK\7600.16385.1\inc\crt

Ah, or that under the bar CRT is shorthand for C Runtime Library

"Library Files" section includes:

D:\WinDDK\7600.16385.1\lib\wxp\i386
D:\WinDDK\7600.16385.1\lib\Crt\i386

PS: Here choose their own platform library bar, WXP representation of XP, I386 is the CPU architecture.

"Executable" section contains:

D:\WinDDK\7600.16385.1\bin\x86\x86

Note that these directories you want to move it just added on top, press the arrow icon on the line, otherwise problems may occur.


 

 

3. Save the configuration, and now to the empty project to build a c file, copy the following:

 

If one change, to change a lot of places, we have to point it directly. Ah, description, the configuration of the following is the debug version of Check.

 

Empty C / C ++ and Link Option text box below, in the following form.

 

Option C / C ++ option to fill in:

/nologo /Gz /MLd /W3 /WX /Z7 /Od /DWIN32=100 /D _X86_=1 /D WINVER=0x500 /D DBG=1 /Fo"MyDriver_Check/"/Fd"MyDriver_Check/" /FD /c

Description:

  / Nologo: compiling said they did not display copyright information

  / Gz: The default function call using a standard invocation, namely __stdcall

  / W3: using the third stage warning mode.

  / WX: The warning message becomes the error message, the maximum degree of reliability of the code. Code that runs in kernel mode, there is no mechanism for error, error blue screen, this option is necessary.

  / Z7: generate debugging information with C7 mode. VC default Program Database for "Edit & Continue" and link the / driver option conflict.

  / Od: turn off debug mode. Drivers do not like the Win32-based applications that use VC debugger to debug, you need to use the kernel debugger to debug.

  / D WIN32 = 100 / D _X86_ = 1 / D WINVER = 0x500 / D DBG = 1: define macros necessary.

  / Fo "MyDriver_Check /": Set the intermediate code generating path.

  / Fd "MyDriver_Check /": Set pdb file directory location. pdb file contains a large number of symbols for debugging drivers helpful.

  / FD: generate file dependencies.

  / C: compile only performed without being connected.


Option LINK option to fill in:

 

NT drive:

ntoskrnl.libhal.lib usbd.lib /nologo /base:"0x10000" /stack:0x400000,0x1000/entry:"DriverEntry" /incremental:no/pdb:"MyDriver_Check/Driver1.pdb"/map:"MyDriver_Check/Driver1.map" /debug /machine:I386 /nodefaultlib/out:"MyDriver_Check/Driver1.sys" /subsystem:native /driver/SECTION:INIT,D   /IGNORE:4078

Description:

  ntoskrnl.lib hal.lib usbd.lib: qudong drivers need to link the library file. Increased or decreased as needed.

  / Nologo: represents the copyright information is not displayed links.

  / Base: "0x10000": load the base address of the driver.

  / Stack: 0x400000,0x1000: setting using the stack size.

  / Entry: "DriverEntry": address entry function, this function must sign a standard function calls.

  / Incremental: no: non-incremental link.

  / Pdbtype: sept option enables debugging information stored in their respective PDB file, which can speed up the link speed, unfavorable debugging information is dispersed, multiple PDB files when debugging. [Optional]

  /pdb:"MyDriver_Check/Driver1.pdb ": Set pdb file name.

  /map:"MyDriver_Check/Driver1.map ": Set map file name. [Optional]

  / Debug: link Deubg way.

  / Machine: I386: the generated code is 386 compatible platform.

  / Nodefaultlib: do not use the default library.

  /out:"MyDriver_Check/Driver1.sys ": the name of the final program output.

  / Subsystem: native: subsystem is the core system.

  / Driver: compile the driver.

  / SECTION: INIT, D: the period is set to INIT disposable.

  / IGNORE: 4078: 4078 Number ignored warning error.



WDN drive:

ntoskrnl.libhal.lib usbd.lib /nologo /base:"0x10000" /stack:0x400000,0x1000/entry:"DriverEntry" /subsystem:console /incremental:no /pdb:"MyDriver_Check/Driver1.pdb"/debug /machine:I386 /nodefaultlib /out:" MyDriver_Check/Driver1.sys"/subsystem:native /driver /SECTION:INIT,D /IGNORE:4078


 

4. Save the configuration, test. NT to drive, for example.

 

Now to the empty project to build a c file, copy the following:

#include<ntddk.h>
NTSTATUSDriverEntry(
        IN PDRIVER_OBJECT DriverObject,
        IN PUNICODE_STRING RegistryPath
        )
{
        NTSTATUS status = STATUS_UNSUCCESSFUL;
        return status;
}


If CPP file, copy the following passage:

#ifdef__cplusplus
extern"C"
{
#endif
#include<NTDDK.h>
#ifdef__cplusplus
};
#endif
extern “C” NTSTATUSDriverEntry(
        IN PDRIVER_OBJECT DriverObject,
        IN PUNICODE_STRING RegistryPath
        )
{
        NTSTATUS status = STATUS_UNSUCCESSFUL;
        return status;
}

Compiled by the configuration was successful! ! !



After compiling and, in MyDriver_Check \ subdirectory of the source code directory will generate relevant driver



Every new project had to be reconfigured, but you can configure a project, after writing the code, copy this project and make changes on it.

 

So far, the configuration is complete.



Reproduced in: https: //my.oschina.net/iwuyang/blog/198617

Guess you like

Origin blog.csdn.net/weixin_33994444/article/details/91897409