Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
5.6 KiB

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="Microsoft Word 97">
<TITLE>SCSI Scanner Kernel-mode Driver</TITLE>
<META NAME="Template" CONTENT="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
</HEAD>
<BODY TEXT="#000000" LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff" leftmargin="8">
<FONT FACE="Verdana"><H2><A NAME="MYSAMPLE">SCSI Scanner Kernel-mode Driver</A> </H2>
<span style="color:#FF0000">[This is preliminary documentation and subject to change.]</span>
<H3>SUMMARY</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
This sample is the source code for the SCSI scanner kernel-mode driver for Windows NT&#174;/Windows&#174; 2000. It is provided as an example of a SCSI device driver and to make debugging easier. It can be used with any SCSI scanner driver provided in Windows NT/Windows 2000, including any from Hewlett-Packard, Microtek, Ricoh, and Umax.<P>
<H3>BUILDING THE SAMPLE</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
To build the sample, open a DDK command window, change to the Scsiscan directory, and use the <B>build</B> command. Before you can use the sample, you need to install a SCSI scanner that uses Scsiscan (for example, any of the drivers included in Windows 2000).
<P>
To install the scanner, shut down the machine, attach the scanner, and boot. The scanner will be detected and installed by the operating system. Hpscan.inf is provided in this directory for reference, but the .inf file in %SystemRoot%\inf that corresponds to your scanner will be used during install.<P>
After the scanner is installed, you can copy the built sample, Scsiscan.sys, over the version in %SystemRoot%\System32\Drivers. If the existing driver is in use, stop the Still Image service using the Computer Management application, and then start it after copying.<P>
This sample has not been tested on Alpha platforms. It has not been confirmed to be 64-bit compliant. The code builds properly with Microsoft Visual C&#174; 6.0. Plug and Play and Power Management are implemented in Scsiscan.sys. <P>
Building this sample produces one file: Scsiscan.sys. Both free and checked versions are buildable. The sample has been tested with a binary that was built with Visual C 5.0.<P>
<H3>TOOLS</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
The minidriver is used by three software components: the Scanners and Cameras control panel, the Still Image service, and by an imaging application indirectly through a TWAIN data source. Control Panel uses the minidriver to check on the status of the device. The Still Image service will check if the device has an event pending, and a TWAIN data source will acquire an image through the minidriver.<P>
By building and using a checked (debug) version of the minidriver and a debugger, you can examine how it works in each of these instances. To debug the minidriver when it is called by Control Panel, use <B>Control sticpl.cpl</B> as the command for the debugger to execute. Put a breakpoint in one or more of the functions that the control panel calls (for example, GetStatus, Diagnostic, Initialize, LockDevice, UnLockDevice). To debug the minidriver when it is called by the Still Image service, use <B>Stisvc.exe -a</B> as the command and put a breakpoint in GetStatus, Initialize, DeviceReset, LockDevice, or UnLockDevice. To debug an application's or TWAIN data source's use of the minidriver, use the application as the command for the debugger and acquire an image using the application. Almost any function in the minidriver can be called, but RawReadData and RawWriteData, in particular, will be of interest. If the scanner supports events (i.e., if it has the <B>Copy</B> button on it), the GetNotificationData function will also be of interest.<P>
The Stillvue application in the Scancam\App directory of this DDK can be used to test any function in the minidriver. See the documentation in that directory for more information.<P>
<H3>RESOURCES</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
To get a logo for your device, consult the <A HREF="http://www.microsoft.com/hwtest">WHQL Web site</a> for information and test suites.<P>
Your device should support Plug and Play, even if it uses the parallel or serial port. Download Plug and Play specs from their <A HREF="http://www.microsoft.com/hwdev/respec/pnpspecs.htm">Web site</A>.<P>
<H3>CODE TOUR</H3>
<H4>File Manifest</H4>
</FONT><U><PRE>File&#9;&#9; Description
</U>
Scsiscan.htm&#9; The documentation for this sample (this file)
Private.h&#9; Scsiscan definitions
Scsi.h&#9; Port and class driver definitions
Srb.h&#9; Defines interface between Scsiscan and port driver
Scsiscan.c&#9; Main code of Scsiscan, including entry point
Class.c&#9; Supporting functions for Scsiscan
Scsiscan.rc&#9; Version information resource
Makefile&#9; The makefile for the project; do not edit.
Sources&#9; DDK build instructions
Scsiscan.def&#9; DLL definition
Hpscan.inf&#9; Installation information for the sample
</PRE></FONT><FONT FACE="Verdana"><H4>Programming Tour</H4></FONT><FONT FACE="Verdana" SIZE=2><P>
Scsiscan.c contains most of the code for the driver. It implements SSReadWrite and SSDeviceControl, which handle ReadFile, WriteFile, and DeviceIoControl calls from Scsiscan clients.<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>