2025-04-27 07:49:33 -04:00

141 lines
10 KiB
HTML

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="Microsoft Word 97">
<TITLE>Print QuickStart</TITLE>
</HEAD>
<BODY LINK="#0000ff">
<FONT FACE="Verdana" SIZE=5><H2>Print Driver Quick Start Sheet</H2>
</FONT><FONT FACE="Verdana" SIZE=2>
<H3>Creating Your Own Printer Driver</H3>
The DDK includes sample source code for many Microsoft&#174; Windows&#174; 2000 drivers that you can use as a base for your own driver development. Choose the driver that most closely matches your device and spend some time analyzing and experimenting with it. Please note that the DDK assumes you are conversant with kernel-mode C programming and debugging on Windows 2000. <P>
<H3>Compiling Your Driver</H3>
Windows 2000 DDK drivers are built using the <B>build</B> utility, which uses a set of rules and project files which specify how drivers should be created.<P>
The <I>dirs</I> file specifies which directories in the subtrees contain source code files that are to be built. The <I>sources</I> file specifies which source files are required to build the current driver.<P>
If your driver will consist of multiple binaries, or the source will be kept in multiple directories, you may need to create a <I>dirs</I> file specifying which directories are to be built and in what order. Each separate binary will require a <I>sources</I> file describing which files are to be compiled/linked to create the driver.<P>
Each driver directory also contains a <I>makefile.</I> As <B>build</B> spawns the <B>nmake</B> utility for each source file listed in <I>sources</I>, <B>nmake</B> uses the <I>makefile</I> to generate dependency and command lists. The standard <I>makefile</I> in a driver source code directory directs <B>nmake</B> to the master <B>nmake</B> macro definition file, <B>makefile.def</B>. This file defines the flags for the build tools such as the compiler and linker. <B>Makefile.def</B> simplifies the creation of platform-independent driver projects and is similar to the <B>ntwin32.mak</B> file in the Win32 SDK.<P>
Once you have your <I>dirs</I>, <I>sources</I> and <I>makefile</I> files created, the next step is to run <B>build</B>. <B>Build</B> will parse the <I>sources</I> file and spawn <B>nmake</B> for each source file. <B>Nmake</B> will evaluate the macros in <B>makefile.def</B> and spawn the C compiler with the proper switches. After the compile stages are completed, <B>build</B> will spawn <B>nmake</B> again to link the objects and complete the driver building phase.<P>
If your <I>sources</I> file is correct, running <B>build</B> is all that is required to compile and link your driver. Using <B>build</B> and <B>makefile.def</B> removes the guesswork from such things as which compiler switches are required, and what arguments the linker requires. By adding the appropriate defines to the <I>sources</I> file, it is possible to control the build options in a platform-independent fashion.<P>
During driver development you will need to build free and checked versions of your driver. This is controlled by environment variable settings which are interpreted by <B>build</B> and <B>nmake</B>. These variables are set by <I>setenv.bat</I>, as discussed previously. To build a free driver, run <B>build</B> from the free environment. To build a checked driver, run <B>build</B> from the checked environment.<P>
Template files (.tpl) for <I>dirs</I>, <I>sources</I>, <I>makefile</I>, and other files can be found in the \<I>destination</I>\doc directory. Working versions of these files can be found in driver source subdirectories of the DDK. Examining these files along with <B>makefile.def</B> (located in the \<I>destination</I>\inc directory) will provide additional information.<P>
For more information about the <B>build</B> utility, see the Windows 2000 <I>Programmer's Guide</I>.<P>
<H3>Environment for Compiling Driver Samples</H3>
<B>Note:</B> Make sure you set environment specifics for your C development environment first: <P><blockquote>
<B>set path=%path%;c:\msdev\bin</B>
<B>set include=%include%;c:\msdev\include</B>
<B>set lib=%lib%;c:\msdev\lib</B></blockquote>
Then switch to <B>c:\ddk\src\print\</B> and select the driver to build. <P>
To build, simply type <B>BLD</B>. <B>Note:</B> You may need to run BLD from psprint first.<P>
Logs are in build.log and build.wrn. <P>
Output .dll products are in <B>c:\ddk\lib\i386</B> unless otherwise noted in build.log.<P>
<H3>Placing a Custom Sample in the Build Tree for Compiling</H3>
Most monolithic drivers are coded using a template scheme. This entails selecting the driver which most closely resembles the target device type. Switching into its $HOME directory and cleaving the source for your driver into a new subdirectory <I>under</I> it. Then make your changes and test them. Say you are using the text-only sample driver as your template. <P>
Create and switch to <B>c:\ddk\src\print\newdrv</B><P>
Type <B>cd newdrv</B><P>
Type <B>xcopy \ddk\src\print\textonly\*.* ..\newdrv /s </B><P>
To build, simply type <B>bld</B>. <B>Note:</B> You may need to run BLD from psprint first.<P>
Logs are in build.log and build.wrn. <P>
Output .dll products are in <B>c:\ddk\lib\i386</B> unless otherwise noted in build.log.<P>
The <I>dirs</I> file specifies which directories in the subtrees contain source-code files which are to be built. The <I>sources</I> file specifies which source files are required to build the current driver. <P>
If your driver will consist of multiple binaries, or the source will be kept in multiple directories, you may need to create a <I>dirs</I> file specifying which directories are to be built and in what order. Each separate binary will require a <I>sources</I> file describing which files are to be compiled/linked to create the driver.<P>
<H3>Building a Device Driver Installation Diskette</H3>
The Windows 2000 printer device driver installation diskette includes the following files: OEMSETUP.INF, DRVUI.DLL, DRV.DLL, DISK1 DRV.HLP.
The creation of a disk with these items on it will constitute a driver installation disk which will install as part of the Windows phase of setup (after the original install of Windows 2000). <P>
<H3>Resources</H3>
<H4>Device Driver Development URLs</H4>
The sites listed below are an excellent resource for device driver development, debugging, and testing.<P>
<blockquote>
<li><a href="http://www.microsoft.com/hwdev">http://www.microsoft.com/hwdev</a>
(For hardware developers only.)<P>
<li><a href="http://www.microsoft.com/support/products/developer/ddk_hardware/">http://www.microsoft.com/support/products/developer/ddk_hardware/</a>
(For device driver writers only.)<P>
</li></blockquote>
E-mail ntwish@microsoft.com with product suggestions.<P>
Newsgroups at msnews.microsoft.com include:<P>
<blockquote>
<li>microsoft.public.win32.programmer.kernel
(Microsoft Windows 95 and Microsoft Windows NT&#174; driver/kernel programming <P>
<li>microsoft.public.win16.programmer.kernel
(Legacy Windows driver programming) <P>
<li>microsoft.public.usasalesinfo.developer.sdk-ddk
(SDK- and DDK-related information.)</li></blockquote><P>
<H4>Other Newsgroups</H4><P>
comp.os.ms-windows.programmer.nt.kernel-mode
(Development of Windows NT kernel-mode drivers.) <P>
Other competitive device driver developer houses include:<P>
<blockquote>
<li><a href="http://www.bhs.com">http://www.bhs.com</a> (Beverly Hills Software&#151;Windows NT Resource Center)
<li><a href="http://www.blackice.sendfax.com">http://www.blackice.sendfax.com</a> (Black Ice Software)
<li><a href="http://www.bluewatersystems.com">http://www.bluewatersystems.com</a> (Blue Water Systems)
<li><a href="http://www.chsw.com">http://www.chsw.com</a> (Cherry Hill Software)
<li><a href="http://www.ntinternals.com">http://www.ntinternals.com</a> (NT Internals)
<li><a href="http://www.numega.com">http://www.numega.com</a> (Nu-Mega Technologies)
<li><a href="http://www.vireo.com">http://www.vireo.com</a> (Vireo software&#151;Driver Wizards)
<li><a href="http://www.tetradyne.com ">http://www.tetradyne.com </a> (Tetradyne Software)
</li>
</blockquote>
<P>
<H4>Device Driver Development Books</H4>[PSC1]
Refer to the materials below for additional information regarding device driver development, debugging and testing.<P>
<blockquote>
<li>Windows NT Workstation Resource Kit, Microsoft Press (ISBN: 1-57231-343-9)
<li>Inside Windows NT, by Helen Custer, Microsoft Press (ISBN: 1-55615-481-X)
<li>Inside the Windows NT File System, by Helen Custer, Microsoft Press (ISBN: 1-55615-660-X)
<li>The Windows Device Driver Book, by Art Baker, Prentice Hall (ISBN: 0-13-184474-1)
<li>Windows NT DDK Graphics Device Driver Development/Design Guide and Reference (Windows NT DDK)
<li>Advanced Windows NT, by Jeffrey Richter, Microsoft Press (ISBN: 1-55615-567-0)
<li>Microsoft Windows NT Server Resource Kit by Microsoft Corporation, 1995 (ISBN: 1-57231-344-7)
<li>Microsoft Windows NT Workstation Resource Kit by Microsoft Corporation, 1995 (ISBN:1-57231-343-9)
<li>Advanced Windows (with CD-ROM) by Jeffrey M. Richter, 1996 (ISBN:1-57231-548-2)
</li></blockquote>
<P>
<H4>E-Mail Discussion Groups</H4>
<B>The DDK-L e-mail discussion group</B>: Separate areas for Windows 95, Windows NT, network, and file system driver discussions. <P>
<B>NTDEV&#151;Windows NT device drivers</B>: To subscribe, send "SUBSCRIBE NTDEV" in the body of a message to majordomo@atria.com. <P>
<B>NTIFS&#151;Windows NT installable file systems</B>: To subscribe, send "SUBSCRIBE NTDEV" in the body of a message to majordomo@atria.com. <P>
<B>The VCOMM mailing list&#151;Win32 Comm API and Driver Issues</B>: For more information, send "info VCOMM" in the body of a message to majordomo@corp.nsc.com.<P>
</FONT><P ALIGN="CENTER"><A HREF="#top"><FONT FACE="Verdana" SIZE=2>Top of page</FONT></A><FONT FACE="Verdana" SIZE=2> </P></FONT>
<TABLE CELLSPACING=0 BORDER=0 WIDTH=624>
<TR><TD VALIGN="MIDDLE" BGCOLOR="#00ffff" HEIGHT=2>
<P></TD>
</TR>
</TABLE>
<FONT FACE="MS Sans Serif" SIZE=1><P>&copy; 1999 Microsoft Corporation</FONT><FONT FACE="Verdana" SIZE=2> </P></FONT></BODY>
</HTML>