Sample WIA Camera 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 camera. It simulates a camera by reading images from a directory on the hard disk. This sample driver can be used as a starting point for your development, but your driver should access the camera hardware through one of the kernel drivers provided with Windows.

This sample is implemented in 3 parts. This part is the main minidriver. The “Fakecam” sample implements a camera microdriver that this driver calls. The third part is the sample UI extension “Extend.”

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\wdm\wia\wiacam.

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

4.      Also build the microdriver in src\wdm\wia\fakecam and the user interface extension located in the src\wdm\wia\extend directory.

USING THE SAMPLE

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

  1. Copy Wiacam.dll from the appropriate object subdirectory under Wiacam to a new, empty directory.
  2. Do the same with Extend.dll and Fakecam.dll.
  3. Copy Wiacam.inf to the same directory.
  4. In Windows Me or Windows XP, open the “New Device” icon in the Scanners and Cameras control panel.
  5. Click the “Have Disk” button and enter the name of the folder created in step 1.
  6. Click OK, Next, or Finish until the wizard is finished.

Sample camera driver reads images from "image" directory of the profile folder of LOCAL SERVICE account. The default location of this directory is "c:\Documents and Settings\LocalService\image", however it may be different on a particular Windows installation. You may need to enable viewing of hidden and protected OS files in order to browse this folder (to do so, open Windows Explorer, choose Tools, Folder Options, View, then check "Show hidden files and folders", and uncheck "Hide protected operating system files").

Use one of these options to test this driver:

1.      The Scanners and Cameras Wizard accessible from the Start menu.

2.      The Namespace extension accessible by opening the camera in Explorer.

3.      The Wiatest application provided in this DDK.

4.      Microsoft Paint, a native WIA application.

5.      Any TWAIN compliant application.

RESOURCES

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

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

CODE TOUR

File Manifest

Files            Description
------------     -------------------------------------------------------
CCamMicro.cpp    Implements wrapper for microdriver DLL
CcamMicro.h      Header for microdriver DLL wrapper
Child.cpp        Implements functions for non-root items
IStiUSD.cpp      Implements STI interfaces
IWiaMiniDrv.cpp  Implements WIA interfaces
Makefile         Used for building the driver--do not modify
pch.h            Precompiled header
resource.h       Header file for resources
Root.cpp         Implements functions for root item
Sources          Controls building of driver
wiacam.cpp       Implements COM and DLL functions
wiacam.def       Linker command file
wiacam.h         Main header for driver
wiacam.htm       This readme
wiacam.inf       Installation file
wiacam.rc        Resource definitions
wiacam.rcv       Additional resource definitions