Windows Image Acquisition Enhancements In Windows Vista Avijit

  • Slides: 39
Download presentation
Windows Image Acquisition Enhancements In Windows Vista Avijit Sinha Program Manager D 2–Digital Documents

Windows Image Acquisition Enhancements In Windows Vista Avijit Sinha Program Manager D 2–Digital Documents Platform and Solutions

Agenda Scanning infrastructure in Windows Vista Push Scanning Demo WIA Enhancements in Windows Vista

Agenda Scanning infrastructure in Windows Vista Push Scanning Demo WIA Enhancements in Windows Vista Multi-image scanning Demo WIA Service Security Context change Additional Info WDK Samples and Tools WIA Automation Layer and WIA Video 64 -bit support TWAIN support in Windows Vista

Windows Scanning Infrastructure For Network And Locally Connected Scanners Windows Vista WSD Scan Protocol

Windows Scanning Infrastructure For Network And Locally Connected Scanners Windows Vista WSD Scan Protocol Network connected Network Scanners Locally connected Scanners WIA Scanner TWAIN Scanner Windows Rally Scan WIA Class Driver for Network Connected Scanners Windows Rally IHV WIA Driver for Network Connected Scanners Vista WIA Driver for Locally Connected Scanner Windows XP or Windows Server 2003 WIA Driver TWAIN Data Source Scanned Document Storage Routing Agent Routing Destination Windows Fax and Scan Application W I A S E R V I C E Routing Dialog Scan Profiles Dialog Scan Dialog Windows Photo Gallery Scan Profiles Windows Vista WIA application Windows XP or Windows Server 2003 WIA application TWAIN Compatibility Layer TWAIN Data Source Manager TWAIN application Key Device New or Enhanced in Windows Vista Unchanged in Windows Vista

Push Scanning From A Network Connected MFP Image. Runner 3170

Push Scanning From A Network Connected MFP Image. Runner 3170

Scanner Tree Example WIA represents scanners and images on a scanner using a tree

Scanner Tree Example WIA represents scanners and images on a scanner using a tree of items XP/Windows Server 2003 Windows Vista Root Item Flatbed Item Image Item Feeder Item Film Item Storage Item

WIA Items And Properties WIA “items” are used to represent both device attributes and

WIA Items And Properties WIA “items” are used to represent both device attributes and device data Two kinds of items Applications use IWia. Item(2) (application items) – each application has its own “item tree” Drivers use IWia. Drv. Item (driver items) – there is only one “driver item tree” per device Where do IWia. Drv. Items come from? IWia. Drv. Items are created by the driver using WIA helper functions

WIA Data Transfers Application Request Transfer Return from Transfer Optional Imaging Filter 5 Process

WIA Data Transfers Application Request Transfer Return from Transfer Optional Imaging Filter 5 Process boundary 1. Lock driver WIA 2. Ask driver to commit properties to device 3. Ask driver for data 4. Unlock driver 1 5. Imaging filter processes data from scanner 2 3 Key 4 Microsoft IHV Driver Simplified data transfer ISV

Stream-Based Transfers IWia. Transfer for stream-based data transfers Not required to support legacy transfers

Stream-Based Transfers IWia. Transfer for stream-based data transfers Not required to support legacy transfers to get a logo Legacy applications will still work via the compatibility layer Implement the code for data transfer in drv. Acquire. Item. Data Check the l. Flags parameter for WIA_MINIDRV_TRANSFER_DOWNLOAD. If true, the transfer is stream-based Call Query. Interface on the minidriver callback, requesting IID_IWia. Mini. Drv. Transfer. Callback Call IWia. Transfer: : Get. Next. Stream to get an IStream interface, and write data directly to that interface via IStream: : Write Send progress messages, such as WIA_TRANSFER_MSG_END_OF_STREAM, via IWia. Transfer

Multi-Page Transfers Multi-page transfers are supported with IWia. Transfer Drivers needs to call IWia.

Multi-Page Transfers Multi-page transfers are supported with IWia. Transfer Drivers needs to call IWia. Transfer: : Get. Next. Stream to get streams for the next pages Drivers should call Get. Next. Stream in a loop S_OK to indicate another page has been requested Multiple files can be produced by this method – the application requests the file types, and each page can represent a file; Previously a single transfer resulted in a single file For multi-page TIFF files, request a single stream and write all the pages to the stream For multiple file transfers, request a stream for each file

New WIA Interfaces In Windows Vista, WIA provides new COM interfaces IWia. Item 2,

New WIA Interfaces In Windows Vista, WIA provides new COM interfaces IWia. Item 2, IWia. Dev. Mgr 2, IEnum. Wia. Item 2 IWia. Transfer, IWia. Transfer. Callback IWia. Image. Filter, IWia. Segmentation. Filter, IWia. Preview IWia. Error. Handler, IWia. App. Error. Handler

IWia. Item Versus IWia. Item 2 IWia. Item versus IWia. Item 2 is a

IWia. Item Versus IWia. Item 2 IWia. Item versus IWia. Item 2 is a superset of IWia. Item interface remains unchanged to guarantee compatibility New WIA items are only accessible through IWia. Item 2 supports multi-region scanning, IWia. Item does not IWia. Item 2 and IWia. Item support the preview filter Windows Vista has a WIA Compatibility layer to ensure that Windows XP applications (IWia. Item) work with Windows Vista drivers Windows Vista applications (IWia. Item 2) work with Windows XP drivers

WIA Compatibility Layer Windows XP or Windows Server 2003 WIA Application Windows XP or

WIA Compatibility Layer Windows XP or Windows Server 2003 WIA Application Windows XP or Windows Server to Windows Vista Compat Layer Windows Vista WIA Application Windows Vista to Windows XP or Windows Server Compat Layer WIA service Windows XP or Windows Server 2003 WIA driver Windows Vista WIA driver Key Flatbed and Feeder Scanners can be accessed from older (v 1) and newer (v 2) WIA Applications Microsoft Storage and Film Scanners can only be accessed from IHV newer (v 2) WIA Apps (e. g. , Windows Fax and Scan App, Windows Photo Gallery, New Scanning Common ISV Dialog, etc)

Windows Vista WIA Driver Implications New functionality enables Simplified driver development in many areas

Windows Vista WIA Driver Implications New functionality enables Simplified driver development in many areas e. g. , data transfers Looser coupling between value-add components Example: Core driver functionality (data transfer, property negotiation) and enhanced functionality (Image Processing, Segmentation) can be separately implemented Recommendation: Write separate drivers for older WIA (Windows XP and Windows Server 2003) and enhanced WIA (Windows Vista) functionality WIA drivers developed for Windows XP and Windows Server 2003 will continue to work on Windows Vista but will not be able to expose enhanced WIA functionality (e. g. , image segmentation, live preview, error handling) Therefore it is easier to have separate drivers and install different package depending on operating system

WIA Vendor Customization And Extensions Vendors can optionally provide components to enhance the user

WIA Vendor Customization And Extensions Vendors can optionally provide components to enhance the user experience UI customization DLL Image processing filter Segmentation filter Error handler These components run in the application process Not the same process as the driver

UI Customization WIA provides system-supplied UI Provides consistent user-interface across many devices Less work

UI Customization WIA provides system-supplied UI Provides consistent user-interface across many devices Less work for vendors Much of the UI is replaceable or extensible Scan dialogs (replaceable only) Shell extension (Windows XP and Server 2003 only) Property pages (extensible only) Context menu (Windows XP and Server 2003 only)

Segmentation Filter WIA Application Segmentation Filter WIA service Scanner Driver The Segmentation Filter creates

Segmentation Filter WIA Application Segmentation Filter WIA service Scanner Driver The Segmentation Filter creates child items and sets the coordinates of the sub-images into each item. It does not acquire the images Key Microsoft IHV ISV Detects regions in preview image “Cuts out” the regions creating multiple images Scenario: Scanning multiple separate photos at the same time from a flatbed scanner Item Tree with Segmented Images

Segmentation Filter Segmentation filter enables IHVs to provide region detection code and expose this

Segmentation Filter Segmentation filter enables IHVs to provide region detection code and expose this functionality to WIA application In-proc COM component (runs in the application’s process) Microsoft will provide a replaceable segmentation filter Segmentation filter must support all image formats that the driver supports! Simple modification to driver’s INF file [My. Driver. Add. Reg] … HKCR, CLSID{Ui. Class. Id}shellex Segmentation. Filter{Filter. Class. Id}

Image Processing Filter Used for two purposes Filtering scanned image to do image processing

Image Processing Filter Used for two purposes Filtering scanned image to do image processing that can’t be done in hardware Provide live preview by modifying preview image with realistic estimate of the final scan (no more flowers!) The live preview is used by the Preview Component provided by Microsoft in Windows Vista Invoked in the application process by WIA components WIA Application Scanner Driver Key IWia. Preview IWia. Transfer Microsoft WIA Service Image Processing Filter IHV ISV

Image Processing Filter In-proc COM component implementing IWia. Image. Filter and IWia. Transfer. Callback

Image Processing Filter In-proc COM component implementing IWia. Image. Filter and IWia. Transfer. Callback Runs in the application’s process Needs to support any image format that driver supports Filter and driver need to read WIA_DPS_PREVIEW to determine what the current purpose is E. g. , preview scan or final scan Recommend to move filtering functionality from driver to filter At a minimum, all filters should implement brightness and contrast Simple modification to driver’s INF file [My. Driver. Add. Reg] … HKCR, CLSID{Ui. Class. Id}shellex Image. Processing. Filter{Filter. Class. Id}

Error Handling Provides status and error messages during data acquisitions “Lamp warming up” “Cover

Error Handling Provides status and error messages during data acquisitions “Lamp warming up” “Cover open” “Paper Jam” Can show UI (if application allows) Runs in application’s process Microsoft provides a default error handler with limited number of messages

WIA Component Interfaces Key Microsoft IWia. UIExtension(2) IShell. Ext. Init … IWia. Dev. Mgr(2)

WIA Component Interfaces Key Microsoft IWia. UIExtension(2) IShell. Ext. Init … IWia. Dev. Mgr(2) IWia. Item(2) IWia. Drv. Item … WIA Application IHV COM Proxy ISV Optional vendor UI Default UI Segmentation Filter Process boundary WIA service Vendor filter ISti. Usd IWia. Mini. Drv Vendor User Mode Driver (USD) Vendor Error Handler User Mode Bus Driver Kernel Mode

Multi-image Scanning MP 780

Multi-image Scanning MP 780

Security Context Change Driver now runs under Local. Service account Assumptions about access to

Security Context Change Driver now runs under Local. Service account Assumptions about access to resources can cause “Access denied” errors under new security context Typical areas affected File system access Registry access Named kernel objects Out-of-process COM objects Creating and opening other processes

Security Context Change Many problems can be solved by putting correct security descriptors on

Security Context Change Many problems can be solved by putting correct security descriptors on objects To share objects with other components Create a discretionary access control list (DACL) that allows access to the object

Security Context Change File system access Under Local. System in Windows XP, driver had

Security Context Change File system access Under Local. System in Windows XP, driver had Read/Write access to almost any directory Under Local. Service, driver has mainly Read access only If driver only reads files, then usually not a problem Drivers should create or write their private files in the %userprofile% directory Note: The user account in this case is “Local. System” or “Local. Service”

Security Context Change Registry Access Much of the registry is available for the driver

Security Context Change Registry Access Much of the registry is available for the driver to read WIA drivers should only write to the Device. Data section of the registry key that is handed to them in the ISti. USD: : Initialize entry point

Security Context Change Named kernel objects Two main problems Namespaces Access permissions Applications and

Security Context Change Named kernel objects Two main problems Namespaces Access permissions Applications and drivers may run in different sessions Each has its own namespace Use the correct namespace when specifying the object name e. g. , GlobalMy. Device. Lock Set the object permissions correctly when creating the object Don’t rely on default permissions

Security Context Change Out-of-process COM components Require two types of permissions Launch permissions Access

Security Context Change Out-of-process COM components Require two types of permissions Launch permissions Access permissions Ensure the permissions on the COM objects are set correctly Use the COM supplied method of storing your permissions under the App. ID key Call Co. Initialize. Security with the EOAC_APPID This allows administrators to adjust permissions if necessary

Security Context Change Creating and opening processes WIA drivers should not manually start other

Security Context Change Creating and opening processes WIA drivers should not manually start other processes on the system In Fast User Switching or Terminal Services environment, it is often difficult to say who the “user” is In Windows XP, driver could launch the process under the incorrect account Generally not possible under Local. Service account, unless Activating an installed COM component Windows NT service etc

WIA In Windows Driver Kit (WDK) WDK contains a very rich set of WIA

WIA In Windows Driver Kit (WDK) WDK contains a very rich set of WIA samples and tools to help Scanner Driver Developers quickly develop and test their new WIA drivers Samples Monster Driver Sample includes Sample for flatbed, feeder, film and storage source Error Handler Sample WIA Transfer Sample Filters Sample WIA Micro driver sample Diagnostic Tools to help driver development WIA navigation and property tool WIA Trace Viewer

WIA Tools In The WDK Test tools required for Logo/Certification New Data Transfer Test

WIA Tools In The WDK Test tools required for Logo/Certification New Data Transfer Test tool New Item Tree and Properties Compatibility Test tool Error Handler Test tool Twain Data-source Compliance Test tool Power Management Test Tool for Scanners Additional tools Filter Test tool Imaging Driver Robustness Test tool

WIA Video Functionality deprecated in Windows Vista No infrastructure support in WIA for acquisition

WIA Video Functionality deprecated in Windows Vista No infrastructure support in WIA for acquisition from web cams Video acquisition support removed in older common dialogs

WIA Automation Layer Available as download from microsoft. com Is now inbox in Windows

WIA Automation Layer Available as download from microsoft. com Is now inbox in Windows Vista

WIA On x 64 Versions Of Windows Vista 32 -bit and 64 -bit functionality

WIA On x 64 Versions Of Windows Vista 32 -bit and 64 -bit functionality are identical 64 -bit extension host Allows 32 -bit WIA applications to work with 64 -bit WIA drivers by hosting 64 -bit WIA UI extensions

TWAIN Support same as Windows Server 2003 SP 1 Only 32 -bit TWAIN DSM

TWAIN Support same as Windows Server 2003 SP 1 Only 32 -bit TWAIN DSM in Windows Vista STI hosting component in x 64 Windows Vista to enable 32 -bit TWAIN data-source and 64 -bit STI driver combination to be functional

Call To Action IHVs Write drivers exposing the new item tree structure Write drivers

Call To Action IHVs Write drivers exposing the new item tree structure Write drivers that support the new stream based data transfer Differentiate your device by providing your own image processing filters Enhance device experience using error handlers ISVs Write WIA applications that use the new COM interfaces Provide focused experience for different scanners Provide a superior scanning experience by using imaging filters and error handling capabilities Ask the Experts at lunch today

References Refer to “Security-related Best Practices for WIA Driver Development” whitepaper to ensure your

References Refer to “Security-related Best Practices for WIA Driver Development” whitepaper to ensure your WIA drivers work well in the Local Service security context http: //www. microsoft. com/whdc/device/Still. Im age/default. mspx Consult general security references Security topics on MSDN “Writing Secure Code” (ISBN 0 -7356 -1588 -8)

© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names

© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U. S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.