Build the DDK compiling environment of VC

Source: Internet
Author: User

1. Environment: path of Windows XP SP1 ntddk (win2kddk) VC ++ 6.0ntddk: D:/ntddkddk: setenvcallbuild. bat builddriver. bat makefile. MK sourcesetenvcallbuild. bat is the command line (msdos) Execution file. The parameters are checked wxp or free wxp builddriver. bat is setenvcallbuild. files called by bat. Makefile. mk source is the file used by build-CZ. You do not need to modify makefile and makefile. mk. Souce contains the file to be compiled and is edited in notepad. The following uses ntddk/src/WDM/USB view as an example. 2. The code file name of each file is setenvcallbuild. bat // ----------------------------------- @ echo onrem % 1rem % 2 set ddkpath = D:/ntddkset prjdrv = E: Set prjpath = driver echo S1 % 1 echo S2 % 2 call builddriver. bat % ddkpath % prjdrv % prjpath % 1% 2 set ddkpath = set prjdrv = set prjpath = platform // Note: ddkpath = D:/ntddk is the path for ntddk installation, prjdrv = e indicates the drive letter of the file to be compiled, that is, the drive letter of the file. prjpath = driver Driver The folder where the file to be compiled is located. File Name builddriver. bat // -------------------------------------- @ echo offrem % 1rem % 2rem % 3rem % 4rem % 5 echo N1 % 1 echo N2 % 2 Echo N3 % 3 Echo N4 % 4 echo N5 % 5 if % 1 = "" Goto usageif % 3 = "" Goto usageif not exist % 1/bin/setenv. bat goto usagecall % 1/bin/setenv. bat % 1% 4% 5% 2cd % 3 build-CZ goto Exit: usageecho usage make sure your DDK path is valid!: Exit failed // file name makefile //--------------------------------------------############################### ######################################## ######## copyright (c) microsoft Corporation 1992-1997 # All Rights Reserved. ### makefile for usbview ################################### ######################################## #### paths are relative to the directory con Taining this file .! Ifdef win95_build # root of the SLM tree (I. e. the directory containing the dev Project ).! Ifndef rootroot = ../../../..! Endif defaultverdir = retailversionlist = retail debugis_32 = true commonmkfile = makefile. mk! Include $ (Root)/dev/master. mk! Else! Include $ (ntmakeenv)/makefile. def! Endif -------------------------------------- // file name makefile. MK //-----------------------------------------#################################### ######################################## ### copyright (c) microsoft Corporation 1996-1998 # All Rights Reserved. # makefile. MK for usbview ##################################### ######################################## # root = .. /.. /.. /.. /.. name = usbviewsrcdir =.. Is_32 = truewant_c1132 = truewant_wdmddk = trueis_ddk = true l32exe = certificate (name1_.exe l32res =. /$ (name ). resl32libsnodep = kernel32.lib user32.lib gdi32.lib comctl32.lib libc. lib cfgmgr32.libtargets = $ (l32exe) dependname = $ (srcdir)/depend. mkrcflags =-I $ (Root)/dev/INC # Enable Read-Only string pooling to coalesce all the redundant strings # cflags =-GF l32objs = usbview. OBJ/enum. OBJ/display. OBJ/ Debug. OBJ/devnode. OBJ/dispaud. OBJ! Include $ (Root)/dev/master. MK upload // file name source // export targetname = usbviewtargettype = programtargetpath = OBJ umtype = windowsumentry = winmainumbase = 0x1000000 targetlibs =/$ (sdk_lib_path)/kernel32.lib/$ (sdk_lib_path) /user32.lib/$ (sdk_lib_path)/gdi32.lib/$ (sdk_lib_path)/comctl32.lib/$ (sdk_lib_path)/cfgmgr32.lib primary des = .. /INC ;.. /.. /INC sources = usbview. c/display. c/enum. c/debug. c/devnode. c/dispaud. c/USB view. RC ----------------------------------------- // The files listed in sources need to be compiled. 3. Create a project 1) create a project and select makefile2) create a check driver in debug Note: wxp is Windows xp3) create a free drive in Release 4) import File 5) compile the Project 6) generate the result to generate the USB view.exe file in the objchk/ik. The principle is as follows: the DOS compilation method setenv is setenv. bat, whose parameter is the path where ntddk is located, indicates that the environment is successfully created and runs build-CZ in the directory to be compiled. Note: makefile is required in this directory. the running result of the MK source file is complete.

Reference: Ah Liang's "use vc6 to compile driver"

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.