SCSI Scanner Kernel-mode Driver

[This is preliminary documentation and subject to change.]

SUMMARY

This sample is the source code for the SCSI scanner kernel-mode driver for Windows NT®/Windows® 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.

BUILDING THE SAMPLE

To build the sample, open a DDK command window, change to the Scsiscan directory, and use the build 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).

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.

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.

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® 6.0. Plug and Play and Power Management are implemented in Scsiscan.sys.

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.

TOOLS

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.

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 Control sticpl.cpl 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 Stisvc.exe -a 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 Copy button on it), the GetNotificationData function will also be of interest.

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.

RESOURCES

To get a logo for your device, consult the WHQL Web site for information and test suites.

Your device should support Plug and Play, even if it uses the parallel or serial port. Download Plug and Play specs from their Web site.

CODE TOUR

File Manifest

File			Description

Scsiscan.htm	 	The documentation for this sample (this file)
Private.h	    	Scsiscan definitions
Scsi.h	       		Port and class driver definitions
Srb.h	        	Defines interface between Scsiscan and port driver
Scsiscan.c	   	Main code of Scsiscan, including entry point
Class.c	      		Supporting functions for Scsiscan
Scsiscan.rc	  	Version information resource
Makefile	     	The makefile for the project; do not edit.
Sources	      		DDK build instructions
Scsiscan.def	 	DLL definition
Hpscan.inf	   	Installation information for the sample

Programming Tour

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.

Top of page

© 1999 Microsoft Corporation