This sample shows how to write a Windows Image Acquisition (WIA) user-mode minidriver for a scanner. It simulates scanning by producing a test pattern image. This sample driver is an excellent starting point for your development, but your driver should access the scanner hardware through one of the kernel drivers provided with Windows, Usbscan.sys or Scsiscan.sys, if possible.
At the time of this writing, WIA is only supported on Windows Me and Windows XP. This sample will not work on Windows 98 or Windows 2000.
1. Automatic document feeder capabilities
a. Configure the feeder using the ADF.WIA config file.
i. Load the feeder with a specified number of pages
ii. Set errors on the feeder, to test error returns.
1. Paper Jams (keyword “jam”)
2. Paper Empty (keyword “empty”)
3. General Errors (keyword “general”)
4. Device offline (keyword “offline”)
iii. Example: (Error=jam) This will produce an ADF paper JAM..
2. Scan, Copy, and Fax button support. (both interrupt events, and polled events)
a. Alter and save the .WIA button files to trigger events in the driver
i. SCANBUTTON.WIA, for Scan button presses
ii. COPYBUTTON.WIA, for Copy button presses
iii. FAXBUTTON.WIA, for Fax button presses
3. This sample demonstrates how to handle a transfer of an unknown size.
a. Random infinite page lengths will be sent from the fake scanner device to simulate different page lengths that a user could insert into the document feeder.
To build the sample follow these steps:
1. In the Start menu, select "Free Build Environment" or "Checked Build Environment" under "Windows DDK" to open a command window and set basic environment variables needed to build drivers.
2. Change to the directory containing the sample driver source code, src\preview\wdm\wia\wiascroll.
3. Execute the "build" command. After the build completes, a driver named wiascroll.dll will be located in a subdirectory.
To use the driver, first install it following these steps:
Use one of these options to test this driver:
1. The Scanners and Cameras Wizard accessible from the Start menu or by double-clicking the scanner in Explorer.
2. The Wiatest application provided in this DDK tools directory.
3. Microsoft Paint, a native WIA application.
4. Any TWAIN compliant application.
WIA information: http://www.microsoft.com/hwdev/wia
DDK information: http://www.microsoft.com/ddk/
Files Description
------------ -------------------------------------------------------
istiusd.cpp Implements STI minidriver for backward compatibility
iwiaminidrv.cpp Implements COM WIA mini-driver functions
makefile Used for building the driver--do not modify
pch.h precompiled header
resource.h Header file for resources
sources Controls building of driver
validate.cpp Implements property handling
wiaprop.h Property header file
wiascroll.cpp Implements COM DLL functionality
wiascroll.h Main header file
wiascroll.rc Resource definitions
wiascroll.rcv Version resource definitions
wiascroll.def Linker command file
wiascroll.htm This readme file
wiascroll.inf Installation file for this driver
Will
be added in a future revision.