Microsoft KB Archive/263993

{|
 * width="100%"|

INFO: Environments to Build Drivers

 * }

Q263993

-

The information in this article applies to:


 * Microsoft Windows NT 4.0 Driver Development Kit (DDK)
 * Microsoft Windows 2000 Driver Development Kit (DDK)

-

SUMMARY
This article discusses a procedure for creating the correct environment in which to build drivers for Windows 2000 and Windows NT 4.0. In particular, the article clarifies the &quot;Environment&quot; section of the &quot;Print Driver Quick Start Sheet&quot; chapter in the Windows 2000 DDK documentation. The article focuses on how to understand the various batch files in order to avoid confusion when building for both versions. While the Software Development Kit (SDK) installation is required to build Windows NT 4.0 device drivers, the SDK installation is NOT required to build Windows 2000 device drivers.

MORE INFORMATION
The following is the installation order to build device drivers:


 * 1) Microsoft Visual C++.
 * 2) Microsoft Platform SDK (optional for Windows 2000 device drivers).
 * 3) The appropriate DDK.

This installation order forces the definition of environment variables in a product that was installed earlier (for example, Visual C++) before they are used in a product that is installed later (for example, DDK).

NOTE: If the developer installs all of the products in the order listed and selects the option to register the environment variables, the correct environment is created when the developer clicks the appropriate icon for checked or free build. There is no need to then touch or run any of the batch files.

NOTE: If it is not possible to uninstall and reinstall the products in the correct order, following is a summary of the batch files that can be run to create a proper build environment. For each batch file, the default installation directory is shown, as well as the environment variables (EVs) that MUST be defined, the EVs to be defined, and the EVs that are updated by the batch file. You can examine the various batch files for the exact definitions of these environment variables. Essentially, creating the correct build environment is the result of running up to three batch files in this order:


 * 1) The Vcvars32.bat file, from Visual C++.
 * 2) The Setenv.bat file, from the Platform SDK (optional for Windows 2000).
 * 3) The Setenv.bat file, from the DDK.

VCVars32.bat - Exposes the compiler, linker, other Visual C++ tools, libraries, and header files to the build environment.


 * Default folder: C:\Program Files\Microsoft Visual Studio\VC98\Bin\
 * Assumes EVs:
 * Defines EVs: VSCommonDir, MSDevDir, MSVCDir
 * Updates EVs: Path, Lib, Include

SetEnv.bat - Exposes additional tools, libraries, and headers files from the SDK to the build environment.


 * Default folder: C:\Platform SDK\
 * Assumes EVs: MSVCDir, MSDevDir, MSSDK
 * Defines EVs: MSTOOLS, same as MSSDK
 * Updates EVs: Path, Lib, Include

SetEnv.bat - Exposes additional tools, libraries, and headers files unique to the DDK for the build environment.


 * Default folder: C:\DDK\bin for Windows NT 4.0; C:\NTDDK\bin for Windows 2000
 * Assumes EVs: MSDevDir, MSSDK and MSTOOLS
 * Defines EVs: BaseDir, NTMakeEnv
 * Updates EVs: Path, Lib, Include

The SetEnv.bat file takes two parameters: the first specifies the DDK root folder, and the second specifies either the checked or free build mode. Some tools and utilities in Windows NT 4.0 are not aware of long paths with embedded blank spaces. You must either enclose long paths in double quotation marks or use their short-name equivalents. For example:

"set MSVCDir=&quot;C:\Program Files\Microsoft Visual Studio\VC98&quot;" "set MSVCDir=C:\PROGRA~1\MICROS~4\VC98" The DDK installation copies the Vcvars32.bat batch file from the Visual Studio folder, makes minor modifications, and then saves it as the Ddkvars.bat batch file in the same folder as Setenv.bat. Running Ddkvars.bat produces the same results as running Vcvars32.bat.

Each time that the Path, Lib, and Include environment variables are updated, the newer values are placed ahead of the older values.

Additional query words:

Keywords : kbdocerr kbDDK kbOSWinNT400 kbOSWin2000 kbDSupport kbGrpDSNTDDK

Issue type : kbinfo

Technology : kbWinNTsearch kbWinNT400xsearch kbwin2000Search kbwin2000DDK kbAudDeveloper kbWinDDKSearch kbWinNT400DDK