1 / 39

Windows Image Acquisition Enhancements In Windows Vista

Windows Image Acquisition Enhancements In Windows Vista. Avijit Sinha Program Manager D2–Digital Documents Platform and Solutions. Agenda. Scanning infrastructure in Windows Vista Push Scanning Demo WIA Enhancements in Windows Vista Multi-image scanning Demo

fox
Télécharger la présentation

Windows Image Acquisition Enhancements In Windows Vista

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Windows Image Acquisition Enhancements In Windows Vista Avijit SinhaProgram Manager D2–Digital Documents Platform and Solutions

  2. 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

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

  4. Push Scanning From A Network Connected MFP ImageRunner 3170

  5. Root Item Root Item Image Item StorageItem FilmItem FeederItem FlatbedItem Scanner Tree Example WIA represents scanners and images on a scanner using a tree of items XP/Windows Server 2003 Windows Vista

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

  7. Key Microsoft IHV ISV 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 1 2 3 4 4. Unlock driver 5. Imaging filter processes data from scanner Driver Simplified data transfer

  8. Stream-Based Transfers • IWiaTransfer 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 drvAcquireItemData • Check the lFlags parameter for WIA_MINIDRV_TRANSFER_DOWNLOAD. If true, the transfer is stream-based • Call QueryInterface on the minidriver callback, requesting IID_IWiaMiniDrvTransferCallback • Call IWiaTransfer::GetNextStream 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 IWiaTransfer

  9. Multi-Page Transfers • Multi-page transfers are supported with IWiaTransfer • Drivers needs to call IWiaTransfer::GetNextStream to get streams for the next pages • Drivers should call GetNextStream 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

  10. New WIA Interfaces • In Windows Vista, WIA provides new COM interfaces • IWiaItem2, IWiaDevMgr2, IEnumWiaItem2 • IWiaTransfer, IWiaTransferCallback • IWiaImageFilter, IWiaSegmentationFilter, IWiaPreview • IWiaErrorHandler, IWiaAppErrorHandler

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

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

  13. 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

  14. 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

  15. 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)

  16. Item Tree with Segmented Images Segmentation Filter The Segmentation Filter createschild items and sets the coordinatesof the sub-images into each item. It does not acquire the images Segmentation Filter WIA Application WIA service Key Scanner Driver 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

  17. 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[MyDriver.AddReg]…HKCR,CLSID\{UiClassId}\shellex\ SegmentationFilter\{FilterClassId} Segmentation Filter

  18. 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 Scanner Driver WIA Application Key IWiaPreview IWiaTransfer Microsoft WIA Service IHV Image Processing Filter ISV

  19. In-proc COM component implementing IWiaImageFilter and IWiaTransferCallback 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[MyDriver.AddReg]…HKCR,CLSID\{UiClassId}\shellex\ ImageProcessingFilter\{FilterClassId} Image Processing Filter

  20. 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

  21. WIA Component Interfaces Key Microsoft IWiaUIExtension(2) IShellExtInit … IHV WIA Application ISV COM Proxy SegmentationFilter Optional vendor UI Default UI IWiaDevMgr(2) IWiaItem(2) IWiaDrvItem … Processboundary WIA service Vendor filter IStiUsd IWiaMiniDrv Vendor User Mode Driver (USD) Vendor Error Handler User Mode Kernel Mode Bus Driver

  22. Multi-image Scanning MP780

  23. Security Context Change • Driver now runs under LocalService 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

  24. 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

  25. Security Context Change • File system access • Under LocalSystem in Windows XP, driver had Read/Write access to almost any directory • Under LocalService, 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 “LocalSystem” or “LocalService”

  26. Security Context Change • Registry Access • Much of the registry is available for the driver to read • WIA drivers should only write to the DeviceData section of the registry key that is handed to them in the IStiUSD::Initialize entry point

  27. 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., Global\MyDeviceLock • Set the object permissions correctly when creating the object • Don’t rely on default permissions

  28. 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 AppID key • Call CoInitializeSecurity with the EOAC_APPID • This allows administrators to adjust permissions if necessary

  29. 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 LocalService account, unless • Activating an installed COM component • Windows NT service etc

  30. 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

  31. 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

  32. 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

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

  34. WIA On x64 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

  35. TWAIN • Support same as Windows Server 2003 SP1 • Only 32-bit TWAIN DSM in Windows Vista • STI hosting component in x64 Windows Vista to enable 32-bit TWAIN data-source and 64-bit STI driver combination to be functional

  36. 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

  37. 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/StillImage/default.mspx • Consult general security references • Security topics on MSDN • “Writing Secure Code” (ISBN 0-7356-1588-8)

  38. © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

More Related