Sample WIA Scanner Driver

[This is preliminary documentation and subject to change.]

SUMMARY

This sample shows how to write a Windows Image Acquisition (WIA) user-mode minidriver for a scanner. It simulates scanning by reading image information from 3 specific bitmaps files which are automatically copied to your system directory when the driver is installed. 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 Whistler. This sample will not work on Windows 98 or Windows 2000.

BUILDING THE SAMPLE

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\wiatscan.

3.      Execute the "build" command. After the build completes, a driver named Wiatscan.dll will be located in a subdirectory.

USING THE SAMPLE

To use the driver, first install it following these steps:

  1. Copy Wiatscan.dll from the appropriate object subdirectory under Wiatscan to a new, empty directory.
  2. Copy Wiatscan.inf and all of the *.bmp files located in the Wiatscan directory to the same directory.
  3. In Windows Me or Whistler, open the “New Device” icon located in the Scanners and Cameras control panel.
  4. Click the “Have Disk” button and enter the name of the folder created in step 1.
  5. Click OK, Next, or Finish until the wizard is finished.

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.

RESOURCES

WIA information: http://www.microsoft.com/hwdev/wia

DDK information: http://www.microsoft.com/ddk/

CODE TOUR

File Manifest

Files        Description
------------ -------------------------------------------------------
defprop.h    Property header file
device.cpp   Implements STI minidriver for backward compatibility
makefile     Used for building the driver--do not modify
minidrv.cpp  Implements scanner functions
resource.h   Header file for resources
sources      Controls building of driver
test1bt.bmp  1 bit deep sample image
test8bt.bmp  8 bit deep sample image
test24bt.bmp 24 bit deep sample image
testusd.cpp  Implements COM functionality
testusd.h    Main header file
testusd.rc   Resource definitions
testusd.rcv  Version resource definitions
validate.cpp Implements property handling
wiatscan.def Linker command file
wiatscan.htm This readme file
wiatscan.inf Installation file for this driver

Programming Tour

Will be added in a future revision.