Content: Use VC 6.0 to edit (not compiled) Driver's source file is a very good choice, especially with Visual Assist, more convenient. The editor is over, it is more convenient in VC . I have a reference for the Site, the DSW generated by the DS, and the log file generated by the Build. In fact, the M $ site is to change the VC's setting based on the build's log file. Me TOO is limited to 2K DDK because XP DDK and 2003 DDK do not require VC 6.0. And when I use VC6 to Build, I will tell you "Compiler Version Not Supported by Windows DDK", but there is no further try. (Note: There is a BT manner, still add XP setting, of course, the path is set to set the pair, then modify the DSP file with UltraEdit, depending on the corresponding CL, MIDL, RC, LINK, what is changed to XP DDK, 嘿) DDK has a link, 98, 2k DDK seems to be VC5, if you do this, actually use VC6's LINK. Don't consider Source, Dir, make files.
The DDK's build is actually an called NMAKE tool, while NMAKE wants to adjust the corresponding files such as CL.EXE, LINK.EXE, and so on. The option setting of the CL, the main note of the DDK's include path problem, the LINK option is to let Link go to Link out a sys instead of exe, huh, huh
Preparatory work: 1. DDK (huh, say nonsense) installed. The directory name is best not to bring a space. 2. Create a Workspace to add files such as C, H, RC. 3, configurations, add Checked, Free, don't debug, Release (in fact, this is not necessary, checked, debug, see how you call it). The rest is to change the settings, so that the VC has an SYS file for you Build.
Let's come one by one. All changes are all under Project-> Setting. Mainly concentrated under C / C and Link. 1, General, just one, not use mfc; 2, debug, no change; 3, C / C :
1.1 General: 3.1.1 Warning Level, use Level3, drive, stable overwhelming, and DDK Sample is Warning 3, Warnings As ErrorS is selected; 3.1.2 Optimizations, Checkled, I am disable (Debug), province When using Softice, there will be a variable saying Watch can't, for Free, I am Customize, will tell; 3.1.3 debug info, free is of course, you have to be your business, checked, I use C7; VC default Program Database for / "Edit & Continue /", and Link / Driver option conflict; 3.1.4 preprocessor definitions, some I have not figured out, some may be DS, probably talking. Here is my DSW. RDRDBG, SRVDBG, FPO = 0, WIN32 = 100, STD_CALL, CONDition_Handling = 1, NT_UP = 1, NT_INST = 0, _NT1X_ = 100, WinNT = 1, _WIN32_WINNT = 0x0400, Win32_Lean_and_mean = 1, DEVL = 1, _dll = 1, _X86_ = 1, $ (CPU) = 1, NTVersion = / 'WDM /', Winver = 0x500, NTDebug = NTSD, DBG = 1std_call does not have to say, Driver's function is __stdcall, in fact, there is setting in other places . Winver = 0x500 is because you are for 2k. XP is 0x501, but it is useless, anyway, it can't use VC6. _X86_ = 1, no words, hey. The CPU, etc., etc. are not this value. If DBG, Free, do not define, or 0. FPO, Checked is 0, Free of 1. I think I should refer to Fram-Pointer Omission, NTDEBUG = Checked? NTSD: NTSDNodebug Win32_Lean_and_mean, Exclude Rarely-UseTUFF from Windows Headers, Non-MFC, with this time that can reduce Build. There are no relationships, do not affect other NT_UP, and 0 is indicated by MP, multiprocessor, 1 means you are in single processors. NT_INST, SET to TURN ON INSTRUMENTATION
Based on the DRIVER type, you may have to add other preprocessor definitions, such as NDIS IMD, you have to NDIS50, NDIS_MINIPORT_DRIVER, NDIS50_MINIPORT. 3.1.5 Project Options You only need to add a few more, including / qifdiv- / qif / qi0f, can be found on the MSDN. It is worth mentioning that the debug setting of the Workspace generated by the VC. The default has a GZ option, Catch Release-Build Errors in Debug Build, it will be said when compiled, Error LNK2001: Unresolved External Symbol __chkesp, it will be fine. 1.2 C Language doesn't say anything, don't rtti, Exception handling looks out if you use it. 1.3 Code Generation Use __stdcall with __stdcall, no matter (remember STD_CALL); 1.4 Customize is nothing to say, I usually function-level linking, because adding GF options, Eliminate Duplicate strings, I will not choose. 1.5 Listing files can be said to Listing File Type. If you want to see the assembly code, you can change here; 1.6 Optimizations Checked is naturally disable, free, I chosen is Full Optimization and Frame_Popinter OMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIMIZATION, and ONLY __INLINE, in fact, this is personal; 1.7 precompiled headers This is not Say, look at MSDN, defaults; 1.8 Preprocessor Preprocessor Definition Some Expedition, Head In Additional Include Directories, $ (BASEDIR) IncDDKWDM, $ (Basedir) IncDDK, $ (Basedir) Inc, $ (basedir) incwin98 , .... INC, this is my DSW, so the basedir's environment variable should be set, I will use the DS tool to START VC, it happens to be set, of course you can write directly The installation path of your DDK. Can't find the include path, will trigger a lot of errors, such as WDM.H has an error. . . It is a question that many people ask;
4, okay, turn to LINK 4.1 General Select Ignore All Default Libraries, you can choose Generate Map file, the map file is sometimes useful; Checked is of course necessary to select Generate Debug Info, Link Incrementally is not selected; Objects / Library Modules, add WDM.LIB, etc., ntoskrnl.lib seems to output some functions such as Sprintf, Strcat (Note 1), which may still have other, such as ndis.lib; don't forget Output File Name to change to YourName. SYS, can not be Yourname.exe 4.2 debug to change, select Debug Info, I choose Both Formats; 4. One of the focus of INPUT, Additional Lib Path, $ (Basedir) libchki386, this is a DSW Used, Checked Fills the path of check 2, free fills the path of Freelib 4.4 Output In entry-point symbol, fill in DriveEntry, or _Driveentry @ 8, the same; Base Address should fill in 0x10000, Stack, RESERVE Should be filled in 0x40000, Commit Fill in 0x1000; Version Info, fill itself; 4.5 Project Options, focus, many options To add them directly here. To add include: / machine: ix86, CPU-related / debug: Full, / debugty: Both According to the M $ site, in order to make Windbg to find your Symbol, these two are all, but also separately Linker is coming to Link once, VC does not recognize / debug: Full, Free doesn't have this problem. According to M $ method, you can write a LNK file, in Post-build step, then Link once, add link @ YourLnk.lnk, this LNK file, you can extract from the log file, if you don't need to use, it doesn't matter; / Driver, Use this linker option to build a Windows NT Kernel Mode Driver, MSDN said / Ignore: 4001, 4037, 4039, 4065, 4070, 4078, 4087, 4089, 4096, 4210 Check MSDN / MERGE: _PAGE = Page / Merge : _Text = .text / section: init, d, Driverentry can be placed in init section. / Fullbuild / release, add checksum / force: Multiple / Opt: REF / OPT: ICF / Align: 0x20 / Option: ICF / ALIGN: 0X20 / OPT: ICF / Align: 0x20 / Option: Native: Native
Special attention / Subsystem: Native and / Driver should not miss it. A long string / ignore allows you to pass by Warning Level 4, Warning Level 4 is a bit of a little metamorphosis, but most of them are nonsense :), most of the options, you can see the log file output by Build output, you can understood. So you can add some necessary options yourself according to your DRIVER.
Read more, the more you feel ignorant
If there is any place, please point out.